Skip to main content
Glama
localseodata

Local SEO Data

Official

ai_compare

Read-only

Compare AI visibility across competitor domains. See which domains get more AI mentions for selected keywords and locations.

Instructions

Compare multiple domains' AI visibility side by side. See which competitor gets more AI mentions. Costs 10 credits.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
domainsYesDomains to compare (e.g. ["yoursite.com", "competitor.com"])
keywordsYesKeywords to compare across
locationNoLocation for results (e.g. "Denver, CO"). Default: US

Implementation Reference

  • The handler function that executes the 'ai_compare' tool logic. It calls the API endpoint '/v1/ai/compare' with domains, keywords, and optional location, then formats the result.
      withErrorHandling(async ({ domains, keywords, location }) => {
        const result = await callApi(
          "/v1/ai/compare",
          { domains, keywords, ...(location && { location }) },
          getAuth()
        );
        return { content: [{ type: "text" as const, text: formatResult(result.data, result) }] };
      })
    );
  • Input schema for 'ai_compare' using Zod: requires domains (array of 2-5 strings), keywords (array of 1-10 strings), and optional location string.
    {
      domains: z.array(z.string().min(1)).min(2).max(5).describe('Domains to compare (e.g. ["yoursite.com", "competitor.com"])'),
      keywords: z.array(z.string().min(1)).min(1).max(10).describe("Keywords to compare across"),
      location: z.string().optional().describe('Location for results (e.g. "Denver, CO"). Default: US'),
    },
  • Registration of the 'ai_compare' tool via server.tool() within registerAIVisibilityTools(), which is called from server.ts.
    server.tool(
      "ai_compare",
      "Compare multiple domains' AI visibility side by side. See which competitor gets more AI mentions. Costs 10 credits.",
      {
        domains: z.array(z.string().min(1)).min(2).max(5).describe('Domains to compare (e.g. ["yoursite.com", "competitor.com"])'),
        keywords: z.array(z.string().min(1)).min(1).max(10).describe("Keywords to compare across"),
        location: z.string().optional().describe('Location for results (e.g. "Denver, CO"). Default: US'),
      },
      READ_ONLY,
      withErrorHandling(async ({ domains, keywords, location }) => {
        const result = await callApi(
          "/v1/ai/compare",
          { domains, keywords, ...(location && { location }) },
          getAuth()
        );
        return { content: [{ type: "text" as const, text: formatResult(result.data, result) }] };
      })
    );
  • src/server.ts:45-45 (registration)
    Registration call in the main server setup: registerAIVisibilityTools(server, getAuth) which includes the ai_compare tool.
    registerAIVisibilityTools(server, getAuth);
  • The withErrorHandling wrapper that wraps the handler to catch errors. Also callApi and formatResult helpers used by the handler.
    export function withErrorHandling<T>(
      fn: (args: T) => Promise<ToolResult>
    ): (args: T) => Promise<ToolResult> {
      return async (args) => {
        try {
          return await fn(args);
        } catch (err) {
          const message = err instanceof Error ? err.message : String(err);
          console.error(`[mcp] Tool error: ${message}`);
          return {
            content: [{ type: "text" as const, text: `Error: ${message}` }],
            isError: true,
          };
        }
      };
    }
Behavior4/5

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

Annotations indicate read-only, non-destructive, and open-world. The description adds the cost of 10 credits, which is not in annotations. It could provide more detail on what 'AI mentions' entails or data freshness, but 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?

Two sentences plus cost mention, entirely front-loaded, with no wasted words. Every sentence serves a purpose: what it does, what you see, and what it costs.

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

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the three parameters and no output schema, the description adequately covers the purpose and cost but does not specify the format of the comparison results or any pagination, which could be helpful for an agent.

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 description coverage is 100% for all 3 parameters, so the description adds limited value beyond the schema. It contextualizes the domains parameter with 'compare... side by side' but does not enhance understanding of keywords or location.

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 compares multiple domains' AI visibility side by side and tells which competitor gets more AI mentions. It distinguishes itself from sibling tools like ai_mentions and ai_visibility, which likely handle single domains.

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

Usage Guidelines3/5

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

The description implies usage for competitive analysis but does not explicitly state when to use this tool versus alternatives like ai_mentions or ai_visibility. It lacks when-not and 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/localseodata/mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server