Skip to main content
Glama
localseodata

Local SEO Data

Official

ai_scraper

Read-only

Scrape ChatGPT or Gemini search results for a keyword to analyze AI-generated local SEO insights. Costs 3 credits per query.

Instructions

Scrape ChatGPT or Gemini search results for a keyword. Budget-friendly alternative to llm_response. Costs 3 credits.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keywordYesKeyword to scrape results for (e.g. "best electrician")
platformYesWhich platform to scrape (chat_gpt or gemini)
locationNoLocation for results (e.g. "Boston, MA"). Default: US

Implementation Reference

  • The handler function for the 'ai_scraper' tool. It calls the '/v1/ai/scraper' API endpoint with keyword, platform, and optional location parameters, then formats the result.
      withErrorHandling(async ({ keyword, platform, location }) => {
        const result = await callApi(
          "/v1/ai/scraper",
          { keyword, platform, ...(location && { location }) },
          getAuth()
        );
        return { content: [{ type: "text" as const, text: formatResult(result.data, result) }] };
      })
    );
  • Zod schema defining the input parameters for the ai_scraper tool: keyword (string), platform (enum: chat_gpt or gemini), and optional location (string).
    {
      keyword: z.string().min(1).describe('Keyword to scrape results for (e.g. "best electrician")'),
      platform: z.enum(["chat_gpt", "gemini"]).describe("Which platform to scrape (chat_gpt or gemini)"),
      location: z.string().optional().describe('Location for results (e.g. "Boston, MA"). Default: US'),
    },
  • Registration of the 'ai_scraper' tool using server.tool(), which ties the tool name, description, schema, and handler together.
    server.tool(
      "ai_scraper",
      "Scrape ChatGPT or Gemini search results for a keyword. Budget-friendly alternative to llm_response. Costs 3 credits.",
      {
        keyword: z.string().min(1).describe('Keyword to scrape results for (e.g. "best electrician")'),
        platform: z.enum(["chat_gpt", "gemini"]).describe("Which platform to scrape (chat_gpt or gemini)"),
        location: z.string().optional().describe('Location for results (e.g. "Boston, MA"). Default: US'),
      },
      READ_ONLY,
      withErrorHandling(async ({ keyword, platform, location }) => {
        const result = await callApi(
          "/v1/ai/scraper",
          { keyword, platform, ...(location && { location }) },
          getAuth()
        );
        return { content: [{ type: "text" as const, text: formatResult(result.data, result) }] };
      })
    );
  • src/server.ts:45-51 (registration)
    Top-level registration: registerAIVisibilityTools is called to register all AI visibility tools including ai_scraper.
      registerAIVisibilityTools(server, getAuth);
      registerCompetitiveTools(server, getAuth);
      registerLocationTools(server, getAuth);
      registerDiagnosticTools(server, getAuth);
    
      return server;
    }
  • The withErrorHandling wrapper used to catch errors and return structured MCP error content for the ai_scraper tool 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,
          };
        }
      };
    }
Behavior3/5

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

Annotations indicate readOnlyHint=true, destructiveHint=false, so safety profile is covered. Description adds cost (3 credits) and alternative hint, which is useful but does not elaborate on behavioral traits beyond annotations.

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, no fluff. First sentence states purpose, second adds cost and alternative. Extremely efficient.

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?

No output schema, so description should clarify return format. It does not. However, the core purpose is clear, and the tool is simple with well-documented parameters. Missing output info is a moderate gap.

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%, so baseline 3 applies. Description does not add extra meaning to parameters beyond what the schema already provides (e.g., keyword, platform, 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?

Description clearly states verb 'scrape' and resource 'ChatGPT or Gemini search results for a keyword'. It also differentiates from sibling 'ai_llm_response' by positioning itself as a budget-friendly alternative.

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?

Provides clear context: budget-friendly alternative to llm_response and costs 3 credits, indicating when to choose this tool over others. Lacks explicit when-not-to-use but context is sufficient.

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