Skip to main content
Glama
localseodata

Local SEO Data

Official

organic_serp

Read-only

Retrieve full Google SERP results for a keyword and location, including organic listings, local pack, ads, and more. Costs 1 credit.

Instructions

Get full Google SERP results including organic listings, local pack, ads, People Also Ask, AI overview, LSA ads, and knowledge panel. Costs 1 credit.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keywordYesSearch keyword (e.g. "best plumber near me")
locationYesCity and state (e.g. "Orchard Park, NY")

Implementation Reference

  • The handler function that executes the organic_serp tool logic — calls the API endpoint /v1/serp/organic with keyword and location, then formats the result.
    withErrorHandling(async ({ keyword, location }) => {
      const result = await callApi("/v1/serp/organic", { keyword, location }, getAuth());
      return { content: [{ type: "text" as const, text: formatResult(result.data, result) }] };
    })
  • Input schema for the organic_serp tool — requires keyword (string) and location (string), both as Zod schemas.
    {
      keyword: z.string().describe('Search keyword (e.g. "best plumber near me")'),
      location: z.string().describe('City and state (e.g. "Orchard Park, NY")'),
    },
    READ_ONLY,
  • Registration of the organic_serp tool with the MCP server via server.tool(), including name, description, schema, read-only hint, and handler.
    server.tool(
      "organic_serp",
      "Get full Google SERP results including organic listings, local pack, ads, People Also Ask, AI overview, LSA ads, and knowledge panel. Costs 1 credit.",
      {
        keyword: z.string().describe('Search keyword (e.g. "best plumber near me")'),
        location: z.string().describe('City and state (e.g. "Orchard Park, NY")'),
      },
      READ_ONLY,
      withErrorHandling(async ({ keyword, location }) => {
        const result = await callApi("/v1/serp/organic", { keyword, location }, getAuth());
        return { content: [{ type: "text" as const, text: formatResult(result.data, result) }] };
      })
    );
  • formatResult helper used by the handler to format the API response data with credit usage metadata.
    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)}`;
    }
    
    type ToolResult = { content: { type: "text"; text: string }[]; isError?: boolean };
    
    /** Wrap an MCP tool handler so thrown errors always surface 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,
          };
        }
      };
    }
  • withErrorHandling wrapper that catches errors thrown by the handler and returns 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,
          };
        }
      };
    }
Behavior4/5

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

Annotations already declare readOnlyHint=true and destructiveHint=false. The description adds transparency by noting the tool 'costs 1 credit', which is a key behavioral trait not captured in annotations, and correctly indicates a read operation.

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 with zero wasted words, immediately stating the purpose and then listing contents and cost. Front-loaded and 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?

Given no output schema, the description lists components (organic, local pack, ads, etc.) but lacks details on response structure, pagination, or limits. For a complex SERP tool, this is adequate but not fully comprehensive.

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% and both parameters have clear descriptions (keyword and location). The description does not add further semantic detail beyond what the schema provides, so baseline 3 is appropriate.

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 gets 'full Google SERP results' and enumerates specific components (organic, local pack, ads, etc.), distinguishing it from sibling tools like 'local_pack' or 'ai_overview' which target individual SERP features.

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 use for comprehensive SERP analysis but provides no explicit guidance on when to prefer this tool over siblings like 'local_pack' or 'ai_overview', nor any exclusions or prerequisites.

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