Skip to main content
Glama
competlab

competlab-mcp-server

list_alerts

Retrieve paginated competitive alerts across dimensions like tech-trust and pricing. Filter by severity or competitor to see change diffs and action hints. Use this to find recent competitive changes before exploring detailed dashboards.

Instructions

Get paginated competitive alerts — detected changes across all monitored dimensions. Filter by dimension (tech-trust, content, positioning, pricing, ai-visibility), severity (critical, high, medium, info), and/or competitorId. Alerts include change diffs and action hints. Use this to find recent competitive changes before diving into specific dimension dashboards. 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)
dimensionNoFilter by dimension
severityNoFilter by severity level
competitorIdNoFilter by competitor ID (from list_competitors)

Implementation Reference

  • Schema definition for the list_alerts tool. Defines the name, description, input parameters (projectId, pagination, dimension, severity, competitorId), and the API path + query parameters.
    // ── Alerts ────────────────────────────────────────────────
    {
      name: "list_alerts",
      description:
        "Get paginated competitive alerts — detected changes across all monitored dimensions. Filter by dimension (tech-trust, content, positioning, pricing, ai-visibility), severity (critical, high, medium, info), and/or competitorId. Alerts include change diffs and action hints. Use this to find recent competitive changes before diving into specific dimension dashboards. Read-only. Returns paginated JSON array with pagination.hasMore flag.",
      parameters: z.object({
        projectId: objectId("Project ID (from list_projects)"),
        ...pagination,
        dimension: z
          .enum(["tech-trust", "content", "positioning", "pricing", "ai-visibility"])
          .optional()
          .describe("Filter by dimension"),
        severity: z
          .enum(["critical", "high", "medium", "info"])
          .optional()
          .describe("Filter by severity level"),
        competitorId: z
          .string()
          .optional()
          .describe("Filter by competitor ID (from list_competitors)"),
      }),
      path: (a) => `/v1/projects/${a.projectId}/alerts`,
      queryParams: ["page", "limit", "dimension", "severity", "competitorId"],
    },
  • src/tools.ts:20-27 (registration)
    ToolDef interface and the tools array where list_alerts is registered as a ToolDef object.
    export interface ToolDef {
      name: string;
      description: string;
      parameters: z.ZodObject<any>;
      path: (args: Record<string, any>) => string;
      queryParams?: string[];
    }
  • Generic handler that iterates over all registered tools. For list_alerts, it constructs the path '/v1/projects/{projectId}/alerts' with optional query params, then calls apiGet to make 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 used by all tool handlers to make HTTP GET requests to the CompetLab API. Handles authentication via COMPETLAB_API_KEY env var and returns the response.
    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,
        };
      }
    }
  • Reference to list_alerts in the 'competitive_overview' prompt, instructing users to call it with limit=10 and severity critical or high.
    "2. Call list_alerts (limit 10, severity critical or high) to surface the most important recent changes.",
Behavior4/5

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

With no annotations provided, the description takes full responsibility, disclosing read-only nature, pagination details ('Returns paginated JSON array with pagination.hasMore flag'), and content features ('change diffs and action hints'). This adds significant behavioral context beyond a simple 'list'.

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

Conciseness4/5

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

The description is well-organized: purpose first, then filters, then return content, then usage advice, then read-only note. At 3-4 sentences it's concise but covers necessary information without redundancy.

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 6 parameters and no output schema, the description adequately covers purpose, filters, return format, and usage guidance. It lacks details on pagination mechanics (e.g., how page/limit interact) but provides enough for an agent to use the tool correctly.

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?

Schema coverage is 100%, so the baseline is 3. The description adds value by summarizing filter parameters (dimension, severity, competitorId) and clarifying pagination defaults (though not all defaults are restated). It also explains the purpose of filters, e.g., 'Filter by dimension (tech-trust, ...)' which reinforces schema enums.

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 action ('Get paginated competitive alerts'), specifies the resource ('detected changes across all monitored dimensions'), and distinguishes from sibling tools like get_*_dashboard by positioning it as a broad overview before diving into specific dashboards.

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 advises using this tool 'to find recent competitive changes before diving into specific dimension dashboards,' providing clear context for when to use it versus alternatives. It implies when-not via the suggestion to then use dashboards, but lacks explicit exclusions.

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