Skip to main content
Glama
competlab

competlab-mcp-server

get_ai_visibility_dashboard

Retrieve AI Visibility scores for all competitors, measuring how ChatGPT, Claude, and Gemini rank your brand. Returns composite score, mention rate, per-provider breakdowns, and competitor rankings.

Instructions

Get the latest AI Visibility scores for all competitors. This is CompetLab's unique dimension — no other CI platform tracks how LLMs rank brands. Returns AI Visibility Score (weighted 0-100 composite), Mention Rate (fraction of queries where brand is mentioned), per-provider breakdowns (OpenAI, Claude, Gemini), competitor rankings, and aggregated AI analysis. Each check queries 3 prompts across 3 LLMs = 9 total AI queries. Use this for the current snapshot; use get_ai_visibility_history for past checks or get_ai_visibility_trend for time-series data. Read-only. Returns JSON object.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesProject ID (from list_projects)

Implementation Reference

  • Generic handler that registers all tools. For 'get_ai_visibility_dashboard', it calls tool.path(args) which resolves to /v1/projects/{projectId}/ai-visibility, then calls apiGet to fetch the data from the CompetLab API.
    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);
      });
    }
  • Schema definition for the get_ai_visibility_dashboard tool. Accepts projectId (24-char hex string). Returns AI Visibility Score (0-100), Mention Rate, per-provider breakdowns (OpenAI, Claude, Gemini), competitor rankings. Maps to GET /v1/projects/{projectId}/ai-visibility.
    // ── AI Visibility ─────────────────────────────────────────
    {
      name: "get_ai_visibility_dashboard",
      description:
        "Get the latest AI Visibility scores for all competitors. This is CompetLab's unique dimension — no other CI platform tracks how LLMs rank brands. Returns AI Visibility Score (weighted 0-100 composite), Mention Rate (fraction of queries where brand is mentioned), per-provider breakdowns (OpenAI, Claude, Gemini), competitor rankings, and aggregated AI analysis. Each check queries 3 prompts across 3 LLMs = 9 total AI queries. Use this for the current snapshot; use get_ai_visibility_history for past checks or get_ai_visibility_trend for time-series data. Read-only. Returns JSON object.",
      parameters: z.object({
        projectId: objectId("Project ID (from list_projects)"),
      }),
      path: (a) => `/v1/projects/${a.projectId}/ai-visibility`,
    },
  • src/index.ts:16-25 (registration)
    Tools are registered dynamically by iterating the tools array. server.tool() registers each with name, description, params schema, and a handler that calls apiGet.
    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);
      });
    }
  • apiGet helper that makes authenticated GET requests to api.competlab.com using the COMPETLAB_API_KEY env var. Returns JSON text wrapped in MCP content format.
    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,
        };
      }
    }
Behavior5/5

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

No annotations provided, so the description carries full burden. It declares 'Read-only,' explains the return structure in detail, and notes the cost: 'Each check queries 3 prompts across 3 LLMs = 9 total AI queries.' This adds significant value 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?

Four sentences, front-loaded with purpose. Every sentence adds unique value: purpose, unique claim, return breakdown, usage guidance, and cost disclosure. No wasted words.

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?

Without an output schema, the description thoroughly explains the return format: composite score, mention rate, per-provider breakdowns, rankings, and analysis. It also mentions the operational cost (9 queries). Completeness is high.

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?

Input schema has 100% coverage with a clear description for projectId. The tool description does not elaborate on the parameter, but the schema alone is sufficient. Baseline 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 'Get the latest AI Visibility scores for all competitors,' specifying both the action and resource. It distinguishes from sibling tools like get_ai_visibility_history and get_ai_visibility_trend by noting they are for past checks and time-series data.

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 provides usage guidance: 'Use this for the current snapshot; use get_ai_visibility_history for past checks or get_ai_visibility_trend for time-series data.' This tells the agent exactly when to choose this tool over its siblings.

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