Skip to main content
Glama
competlab

competlab-mcp-server

get_content_run_detail

Retrieve full competitor content intelligence data for a past run to analyze content strategy changes over time. Requires projectId and runId. Read-only JSON output.

Instructions

Get full competitor-by-competitor Content Intelligence data for a specific historical run. Returns the same data structure as get_content_dashboard but for a past point in time. Use this to investigate content strategy changes between runs. Requires runId from get_content_history. Read-only. Returns JSON object.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesProject ID (from list_projects)
runIdYesRun ID (from get_content_history)

Implementation Reference

  • src/index.ts:16-25 (registration)
    The tool 'get_content_run_detail' is registered via the generic loop over all ToolDef objects. Each tool is registered with server.tool() using its name, description, parameters, and a handler that calls apiGet with the path and query params.
    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 'get_content_run_detail': defines name, description, Zod schema parameters (projectId and runId as 24-char hex strings), and API path construction.
    {
      name: "get_content_run_detail",
      description:
        "Get full competitor-by-competitor Content Intelligence data for a specific historical run. Returns the same data structure as get_content_dashboard but for a past point in time. Use this to investigate content strategy changes between runs. Requires runId from get_content_history. Read-only. Returns JSON object.",
      parameters: z.object({
        projectId: objectId("Project ID (from list_projects)"),
        runId: objectId("Run ID (from get_content_history)"),
      }),
      path: (a) => `/v1/projects/${a.projectId}/content/history/${a.runId}`,
    },
  • The handler for 'get_content_run_detail' (shared by all tools) constructs the API path from the tool definition, extracts query parameters, and calls apiGet to fetch data from the CompetLab API.
    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);
    });
  • Helper function that creates a Zod schema for validating 24-character hex ObjectId strings.
    const objectId = (desc: string) =>
      z
        .string()
        .regex(/^[a-f\d]{24}$/i, "Invalid ID format — must be a 24-character hex string")
        .describe(desc);
  • Helper function apiGet that makes authenticated GET requests to the CompetLab API, handling API key checks, query params, error responses, and network errors.
    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 are provided, so the description carries the full burden. It declares the tool is 'Read-only' and returns a 'JSON object', which covers the most critical behavioral aspects. It also mentions a prerequisite (runId from get_content_history), adding useful context. No contradictions.

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 four sentences with no fluff. The first sentence front-loads the core purpose, the second provides differentiation, the third gives usage guidance, and the fourth states read-only and return format. Every sentence contributes meaningfully.

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?

For a simple retrieval tool with two parameters (both required, no enums, no output schema), the description covers purpose, usage context, prerequisite, read-only behavior, and return format. There are no gaps given the tool's complexity.

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

Parameters4/5

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

The input schema has full description coverage (100%), so baseline is 3. The description adds value by explaining that 'runId' comes from 'get_content_history', which provides relational context beyond the schema's regex pattern. This helps the agent understand how to obtain valid parameter values.

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 retrieves 'full competitor-by-competitor Content Intelligence data for a specific historical run'. The verb 'Get' and resource are specific. It also distinguishes itself from the sibling 'get_content_dashboard' by noting it returns the same data structure but for a past point in time, which helps the agent differentiate.

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?

The description explicitly says to use this tool to 'investigate content strategy changes between runs' and notes that it requires the 'runId' from 'get_content_history'. While it does not provide explicit when-not-to-use guidance, the context is clear enough for the agent to decide when this tool is appropriate.

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