Skip to main content
Glama
competlab

competlab-mcp-server

list_competitors

Retrieve all competitors monitored for a project, including your own domain, to obtain competitorId values needed for alerts and changelogs.

Instructions

List all competitors being monitored for a project. Includes the user's own domain (marked isOwn: true) for self-analysis comparison. Returns domain, name, and status for each competitor. Use this to get competitorId values needed by list_alerts, get_competitor, and get_content_changelog. Read-only. Returns JSON array.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesProject ID (from list_projects)

Implementation Reference

  • Schema/definition for the list_competitors tool. Defines the input parameters (projectId) and the API path (/v1/projects/{projectId}/competitors). This is a ToolDef entry in the tools array.
    {
      name: "list_competitors",
      description:
        "List all competitors being monitored for a project. Includes the user's own domain (marked isOwn: true) for self-analysis comparison. Returns domain, name, and status for each competitor. Use this to get competitorId values needed by list_alerts, get_competitor, and get_content_changelog. Read-only. Returns JSON array.",
      parameters: z.object({
        projectId: objectId("Project ID (from list_projects)"),
      }),
      path: (a) => `/v1/projects/${a.projectId}/competitors`,
    },
  • src/index.ts:16-25 (registration)
    Generic registration loop that registers all tools (including list_competitors) with the MCP server using the tool name, description, and parameters from the ToolDef.
    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);
      });
    }
  • Generic handler for all tools. For list_competitors, constructs path /v1/projects/{projectId}/competitors and calls apiGet to execute the HTTP GET request.
    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 executes the actual HTTP GET request. list_competitors calls this with path=/v1/projects/{projectId}/competitors, passing the COMPETLAB_API_KEY as a header.
    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?

Without annotations, the description declares it is read-only and returns a JSON array, which informs agents of safety and output format. It also discloses that the user's own domain is included (isOwn: true), adding behavioral context beyond the schema.

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?

The description is brief, front-loaded with the core purpose, and every sentence adds value (e.g., explaining the own domain marker and downstream use). No waste.

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

Completeness5/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 adequately explains the return fields and the role of the tool in the workflow. It covers all essential information for a simple list 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?

The single parameter (projectId) has 100% schema coverage, so the description adds no additional semantics. It mentions 'for a project' but that is implicit. Baseline score of 3 is appropriate.

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 tool lists competitors for a project, specifies included fields (domain, name, status, isOwn), and distinguishes from sibling get_competitor by noting it returns multiple competitors.

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

Usage Guidelines4/5

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

It explicitly mentions using the tool to obtain competitorId values for other tools (list_alerts, get_competitor, etc.), providing clear context. It does not state when not to use it, but the use case is well-defined.

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