Skip to main content
Glama
localseodata

Local SEO Data

Official

ai_llm_response

Read-only

Send a prompt to ChatGPT, Claude, Gemini, or Perplexity and receive a structured AI response. Compare outputs across platforms for local SEO research.

Instructions

Query a specific LLM (ChatGPT, Claude, Gemini, Perplexity) and get its structured response. See what each AI says about a topic. Costs 8 credits.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptYesPrompt to send to the LLM (e.g. "What is the best plumber in Portland?"). Max 500 characters.
platformYesWhich LLM to query
modelNoOptional model name (e.g. gpt-4o, claude-sonnet-4-20250514, gemini-2.5-flash, sonar). Defaults to latest for each platform.

Implementation Reference

  • The tool 'ai_llm_response' is registered via server.tool() inside registerAIVisibilityTools(). It defines the tool name, description, input schema, and handler.
    server.tool(
      "ai_llm_response",
      "Query a specific LLM (ChatGPT, Claude, Gemini, Perplexity) and get its structured response. See what each AI says about a topic. Costs 8 credits.",
      {
        prompt: z.string().min(1).max(500).describe('Prompt to send to the LLM (e.g. "What is the best plumber in Portland?"). Max 500 characters.'),
        platform: z.enum(["chat_gpt", "claude", "gemini", "perplexity"]).describe("Which LLM to query"),
        model: z.string().max(100).optional().describe("Optional model name (e.g. gpt-4o, claude-sonnet-4-20250514, gemini-2.5-flash, sonar). Defaults to latest for each platform."),
      },
      READ_ONLY,
      withErrorHandling(async ({ prompt, platform, model }) => {
        const result = await callApi(
          "/v1/ai/llm-response",
          { prompt, platform, model },
          getAuth()
        );
        return { content: [{ type: "text" as const, text: formatResult(result.data, result) }] };
      })
    );
  • Input schema defined with Zod: prompt (string, 1-500 chars), platform (enum: chat_gpt, claude, gemini, perplexity), and optional model (string, max 100 chars).
    {
      prompt: z.string().min(1).max(500).describe('Prompt to send to the LLM (e.g. "What is the best plumber in Portland?"). Max 500 characters.'),
      platform: z.enum(["chat_gpt", "claude", "gemini", "perplexity"]).describe("Which LLM to query"),
      model: z.string().max(100).optional().describe("Optional model name (e.g. gpt-4o, claude-sonnet-4-20250514, gemini-2.5-flash, sonar). Defaults to latest for each platform."),
    },
  • The handler function (wrapped with withErrorHandling) calls the API endpoint /v1/ai/llm-response with prompt, platform, and model, then formats and returns the result.
    withErrorHandling(async ({ prompt, platform, model }) => {
      const result = await callApi(
        "/v1/ai/llm-response",
        { prompt, platform, model },
        getAuth()
      );
      return { content: [{ type: "text" as const, text: formatResult(result.data, result) }] };
    })
  • withErrorHandling wraps the handler to catch errors and return them as MCP error content.
    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,
          };
        }
      };
    }
  • formatResult formats the API response data along with credit usage metadata into a text string.
    export function formatResult(
      data: unknown,
      meta: { credits_used: number; credits_remaining: number; cached: boolean }
    ): string {
      const metaLine = `[${meta.credits_used} credit${meta.credits_used !== 1 ? "s" : ""} used | ${meta.credits_remaining} remaining${meta.cached ? " | cached" : ""}]`;
      return `${metaLine}\n\n${JSON.stringify(data, null, 2)}`;
    }
Behavior4/5

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

Annotations already provide read-only and non-destructive hints. The description adds the cost of 8 credits, which is valuable behavioral info not in annotations. It also mentions 'structured response' but does not detail pagination, rate limits, or caching behavior, keeping transparency adequate but not exhaustive.

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 two sentences (24 words) and immediately conveys the core action. It is front-loaded with the verb and resource, with no redundant information.

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 the simplicity of the tool (3 parameters, 1 enum, no nested objects), the description covers the essential purpose and cost. However, it lacks details on the output format (e.g., text vs. JSON, fields), which is important since no output schema is provided.

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?

Parameter descriptions in the schema are already complete (100% coverage). The description adds no additional meaning beyond what the schema provides, such as clarifying the model parameter or platform enum values. The cost info is global, not per-parameter.

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 'Query a specific LLM' and 'get its structured response', identifying the verb (query), resource (LLM), and output (response). It distinguishes from siblings like ai_compare by specifying target a single LLM.

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 mentions the specific LLMs (ChatGPT, Claude, Gemini, Perplexity) and the action of seeing what each AI says, implying use cases for single-LLM queries. However, it does not explicitly contrast with the sibling tool ai_compare or specify when not to use it.

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