Skip to main content
Glama
competlab

competlab-mcp-server

get_competitor

Access competitor details including monitored homepage and pricing URLs. Get specific metadata beyond basic list. Requires projectId and competitorId. Returns JSON object.

Instructions

Get competitor details including monitored pages (homepage URL, pricing page URL) and configuration. Use this when you need specific competitor metadata beyond what list_competitors provides — for example, to find which URLs are being tracked. Requires competitorId from list_competitors. Read-only. Returns JSON object.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesProject ID (from list_projects)
competitorIdYesCompetitor ID (from list_competitors)

Implementation Reference

  • src/tools.ts:57-66 (registration)
    Tool registration entry for 'get_competitor' in the tools array. Defines name, description, Zod schema (projectId, competitorId), and path template (/v1/projects/{projectId}/competitors/{competitorId}).
    {
      name: "get_competitor",
      description:
        "Get competitor details including monitored pages (homepage URL, pricing page URL) and configuration. Use this when you need specific competitor metadata beyond what list_competitors provides — for example, to find which URLs are being tracked. Requires competitorId from list_competitors. Read-only. Returns JSON object.",
      parameters: z.object({
        projectId: objectId("Project ID (from list_projects)"),
        competitorId: objectId("Competitor ID (from list_competitors)"),
      }),
      path: (a) => `/v1/projects/${a.projectId}/competitors/${a.competitorId}`,
    },
  • Generic handler that iterates all tool definitions (including get_competitor) and calls the CompetLab API via apiGet using the tool's path and query parameters.
    for (const tool of tools) {
      server.tool(tool.name, tool.description, tool.parameters.shape, async (args: Record<string, any>) => {
        const path = tool.path(args);
        const query: Record<string, any> = {};
        for (const key of tool.queryParams ?? []) {
          if (args[key] !== undefined) query[key] = args[key];
        }
        return apiGet(path, Object.keys(query).length ? query : undefined);
      });
    }
  • The apiGet helper function that makes authenticated HTTP GET requests to the CompetLab API (https://api.competlab.com) for all tools including get_competitor.
    const API_BASE = "https://api.competlab.com";
    
    export async function apiGet(
      path: string,
      query?: Record<string, string | number>,
    ): Promise<{ content: Array<{ type: "text"; text: string }>; isError?: true }> {
      const apiKey = process.env.COMPETLAB_API_KEY;
      if (!apiKey) {
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify({
                error: "api_key_missing",
                message: "COMPETLAB_API_KEY environment variable is not set",
              }),
            },
          ],
          isError: true,
        };
      }
    
      const url = new URL(`${API_BASE}${path}`);
      if (query) {
        for (const [k, v] of Object.entries(query)) {
          if (v !== undefined) url.searchParams.set(k, String(v));
        }
      }
    
      try {
        const res = await fetch(url, {
          headers: { "CL-API-Key": apiKey },
        });
    
        const body = await res.text();
    
        if (!res.ok) {
          return { content: [{ type: "text", text: body }], isError: true };
        }
    
        return { content: [{ type: "text", text: body }] };
      } catch (err) {
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify({
                error: "api_unreachable",
                message:
                  err instanceof Error ? err.message : "Failed to reach CompetLab API",
                status: 503,
              }),
            },
          ],
          isError: true,
        };
      }
    }
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, but the description declares 'Read-only' and 'Returns JSON object', disclosing idempotent behavior and return type. Could benefit from noting error cases but sufficient for a simple get tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three concise sentences with front-loaded purpose, no redundancy, every sentence adds value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema, the description covers return type and key fields. Usage guidance and prerequisites are included. Could mention what happens on missing competitor but overall complete for a get-by-ID tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with descriptions for both parameters. The description reinforces the source of competitorId but adds no new semantic information beyond what's in the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'get' and resource 'competitor details' with specific fields (monitored pages, configuration), distinguishing it from sibling tools like list_competitors.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly tells when to use ('beyond what list_competitors provides') and provides a concrete example ('find which URLs are being tracked'), plus states prerequisite (competitorId from list_competitors).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/competlab/competlab-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server