Skip to main content
Glama
competlab

competlab-mcp-server

get_pricing_history

Retrieve paginated history of competitor pricing monitoring runs with completion timestamps. Track pricing changes over time and access specific run details using runId.

Instructions

Get paginated history of Pricing Intelligence monitoring runs with completion timestamps. Use this to track how competitor pricing changes over time. Retrieve specific run data with get_pricing_run_detail using the runId from this response. Read-only. Returns paginated JSON array with pagination.hasMore flag.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesProject ID (from list_projects)
pageNoPage number (1-indexed, default: 1)
limitNoItems per page (default: 20, max: 100)

Implementation Reference

  • Generic handler loop — the tool 'get_pricing_history' is handled by this loop which calls apiGet with the tool's path and queryParams. There is no dedicated handler function; the generic runtime dispatches based on the tool definition.
    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);
      });
    }
  • Tool definition for 'get_pricing_history' — defines the name, description, Zod input schema (projectId + pagination), the API path (/v1/projects/{projectId}/pricing/history), and query parameters (page, limit).
    {
      name: "get_pricing_history",
      description:
        "Get paginated history of Pricing Intelligence monitoring runs with completion timestamps. Use this to track how competitor pricing changes over time. Retrieve specific run data with get_pricing_run_detail using the runId from this response. Read-only. Returns paginated JSON array with pagination.hasMore flag.",
      parameters: z.object({
        projectId: objectId("Project ID (from list_projects)"),
        ...pagination,
      }),
      path: (a) => `/v1/projects/${a.projectId}/pricing/history`,
      queryParams: ["page", "limit"],
  • src/index.ts:16-25 (registration)
    The tool is registered generically by iterating over the tools array and calling server.tool() for each one, including 'get_pricing_history'.
    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 — the actual HTTP request function called by the handler. Makes a GET request to the CompetLab API with CL-API-Key header and optional query params.
    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,
        };
      }
    }
  • Pagination helper — the schema reuse helper used by get_pricing_history to define optional page/limit parameters.
    const pagination = {
      page: z.number().int().min(1).optional().describe("Page number (1-indexed, default: 1)"),
      limit: z
        .number()
        .int()
        .min(1)
        .max(100)
        .optional()
        .describe("Items per page (default: 20, max: 100)"),
    };
Behavior4/5

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

The description states it is read-only and returns a paginated JSON array with a hasMore flag, covering key behavioral traits. No annotations exist, so the description handles the burden well, though it could add details on rate limits or required permissions.

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 sentences, no wasted words. The most important information (purpose and pagination) is front-loaded, and each sentence adds distinct 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?

The description covers purpose, usage, safety, pagination, and relationship to a sibling tool. Without an output schema, it provides enough context for an agent to understand the return structure, though specific fields are not described.

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 all three parameters. The description adds context by linking projectId to list_projects and page to 1-indexing, but does not significantly augment the schema's meaning beyond that.

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 it retrieves paginated history of pricing intelligence monitoring runs with completion timestamps. It distinguishes itself from sibling tools like get_pricing_run_detail and dashboard tools by specifying the resource and action.

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?

It provides explicit usage context: 'Use this to track how competitor pricing changes over time' and directs to an alternative tool (get_pricing_run_detail) for specific run data, guiding when to use which tool.

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