Skip to main content
Glama
localseodata

Local SEO Data

Official

geogrid_scan

Read-only

Check local search rankings across a geographic area by scanning a grid of points around a business location.

Instructions

Run a geogrid rank scan to see where a business ranks across a geographic area. Creates a grid of points around the location and checks the business's rank at each point. Returns: grid (2D array of rank numbers indexed by row/col, 0 = not found), grid_points (flat array where each entry has row, col, lat, lng, rank — use this when the user asks to plot the grid on a map), center ({lat, lng}), average_rank, found_in, total_points. Costs 50 credits (5x5), 98 credits (7x7), or 162 credits (9x9). This is an async operation — the tool will poll until results are ready.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
businessYesBusiness name to track
place_idNoGoogle Place ID for precise matching (e.g. ChIJ...). When provided, the business is matched by Place ID instead of name, which is far more reliable.
locationYesCenter location for the grid
keywordYesSearch keyword to check rankings for
grid_sizeNoGrid dimensions. Default: 5x5
radius_milesNoRadius in miles from center. Default: 3

Implementation Reference

  • The main handler function for the geogrid_scan tool. Submits a geogrid scan job via POST /v1/geogrid/scan, then polls GET /v1/geogrid/status/{jobId} every 3 seconds (up to 120s timeout) for completion. Returns the grid data on success, error on failure, or a partial status message on timeout.
    withErrorHandling(async ({ business, place_id, location, keyword, grid_size, radius_miles }) => {
      // Submit the scan job
      const submitResult = await callApi(
        "/v1/geogrid/scan",
        {
          business,
          ...(place_id && { place_id }),
          location,
          keyword,
          ...(grid_size && { grid_size }),
          ...(radius_miles && { radius_miles }),
        },
        getAuth()
      );
    
      const jobData = submitResult.data as Record<string, unknown>;
    
      // If sandbox mode returned complete results immediately
      if (jobData.status === "complete") {
        return { content: [{ type: "text" as const, text: formatResult(jobData, submitResult) }] };
      }
    
      const jobId = jobData.job_id as string;
    
      // Poll for results
      const maxWaitMs = 120_000;
      const pollIntervalMs = 3_000;
      const startTime = Date.now();
    
      while (Date.now() - startTime < maxWaitMs) {
        await sleep(pollIntervalMs);
    
        const statusResult = await callApiGet(
          `/v1/geogrid/status/${jobId}`,
          getAuth()
        );
    
        const statusData = statusResult.data as Record<string, unknown>;
    
        if (statusData.status === "complete") {
          return {
            content: [{
              type: "text" as const,
              text: formatResult(statusData, {
                credits_used: submitResult.credits_used,
                credits_remaining: statusResult.credits_remaining,
                cached: false,
              }),
            }],
          };
        }
    
        if (statusData.status === "failed") {
          return {
            content: [{
              type: "text" as const,
              text: `Geogrid scan failed: ${statusData.error || "Unknown error"}`,
            }],
            isError: true,
          };
        }
      }
    
      // Timeout — return partial status
      return {
        content: [{
          type: "text" as const,
          text: `Geogrid scan is still running (job_id: ${jobId}). You can check status later. ${submitResult.credits_used} credits were used.`,
        }],
      };
    })
  • Input schema for geogrid_scan using Zod. Parameters: business (string), place_id (optional string), location (string), keyword (string), grid_size (optional enum: 5x5/7x7/9x9, default 5x5), radius_miles (optional positive number, default 3).
    {
      business: z.string().describe("Business name to track"),
      place_id: z.string().optional().describe("Google Place ID for precise matching (e.g. ChIJ...). When provided, the business is matched by Place ID instead of name, which is far more reliable."),
      location: z.string().describe("Center location for the grid"),
      keyword: z.string().describe("Search keyword to check rankings for"),
      grid_size: z.enum(["5x5", "7x7", "9x9"]).optional().describe("Grid dimensions. Default: 5x5"),
      radius_miles: z.number().positive().optional().describe("Radius in miles from center. Default: 3"),
    },
  • Registration of geogrid_scan via server.tool() inside registerGeogridTools, which is called from server.ts at line 39. The tool description explains the return format, credit costs (50/98/162 credits), and async polling behavior.
    export function registerGeogridTools(server: McpServer, getAuth: () => string) {
      server.tool(
        "geogrid_scan",
        "Run a geogrid rank scan to see where a business ranks across a geographic area. Creates a grid of points around the location and checks the business's rank at each point. Returns: `grid` (2D array of rank numbers indexed by row/col, 0 = not found), `grid_points` (flat array where each entry has `row`, `col`, `lat`, `lng`, `rank` — use this when the user asks to plot the grid on a map), `center` ({lat, lng}), `average_rank`, `found_in`, `total_points`. Costs 50 credits (5x5), 98 credits (7x7), or 162 credits (9x9). This is an async operation — the tool will poll until results are ready.",
        {
          business: z.string().describe("Business name to track"),
          place_id: z.string().optional().describe("Google Place ID for precise matching (e.g. ChIJ...). When provided, the business is matched by Place ID instead of name, which is far more reliable."),
          location: z.string().describe("Center location for the grid"),
          keyword: z.string().describe("Search keyword to check rankings for"),
          grid_size: z.enum(["5x5", "7x7", "9x9"]).optional().describe("Grid dimensions. Default: 5x5"),
          radius_miles: z.number().positive().optional().describe("Radius in miles from center. Default: 3"),
        },
        READ_ONLY,
        withErrorHandling(async ({ business, place_id, location, keyword, grid_size, radius_miles }) => {
          // Submit the scan job
          const submitResult = await callApi(
            "/v1/geogrid/scan",
            {
              business,
              ...(place_id && { place_id }),
              location,
              keyword,
              ...(grid_size && { grid_size }),
              ...(radius_miles && { radius_miles }),
            },
            getAuth()
          );
    
          const jobData = submitResult.data as Record<string, unknown>;
    
          // If sandbox mode returned complete results immediately
          if (jobData.status === "complete") {
            return { content: [{ type: "text" as const, text: formatResult(jobData, submitResult) }] };
          }
    
          const jobId = jobData.job_id as string;
    
          // Poll for results
          const maxWaitMs = 120_000;
          const pollIntervalMs = 3_000;
          const startTime = Date.now();
    
          while (Date.now() - startTime < maxWaitMs) {
            await sleep(pollIntervalMs);
    
            const statusResult = await callApiGet(
              `/v1/geogrid/status/${jobId}`,
              getAuth()
            );
    
            const statusData = statusResult.data as Record<string, unknown>;
    
            if (statusData.status === "complete") {
              return {
                content: [{
                  type: "text" as const,
                  text: formatResult(statusData, {
                    credits_used: submitResult.credits_used,
                    credits_remaining: statusResult.credits_remaining,
                    cached: false,
                  }),
                }],
              };
            }
    
            if (statusData.status === "failed") {
              return {
                content: [{
                  type: "text" as const,
                  text: `Geogrid scan failed: ${statusData.error || "Unknown error"}`,
                }],
                isError: true,
              };
            }
          }
    
          // Timeout — return partial status
          return {
            content: [{
              type: "text" as const,
              text: `Geogrid scan is still running (job_id: ${jobId}). You can check status later. ${submitResult.credits_used} credits were used.`,
            }],
          };
        })
      );
  • withErrorHandling wraps the handler to catch thrown errors and return them as MCP error content. Also relevant: callApi (POST helper), callApiGet (GET helper), formatResult (JSON formatting with credit metadata), and sleep utility in geogrid.ts (line 11).
    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,
          };
        }
      };
    }
Behavior5/5

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

Annotations already indicate readOnlyHint=true, destructiveHint=false, and openWorldHint=true. The description adds significant behavioral details: credit costs (50, 98, 162), async operation with polling, and the exact structure of returned data (grid, grid_points, center, etc.). No contradictions with 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?

The description is concise and well-structured: purpose first, then return format, then costs and async nature. Every sentence adds value without redundancy or fluff.

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

Completeness5/5

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

For a tool with 6 parameters (3 required), no output schema, and moderate complexity, the description fully covers return values, cost implications, and async behavior. It is complete and leaves no major gaps for agent understanding.

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 all parameters already have descriptions. The description adds value by noting that place_id is 'far more reliable' and explaining output parameters, but it does not add substantial new semantics for input parameters beyond the schema.

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's purpose: 'Run a geogrid rank scan to see where a business ranks across a geographic area.' The verb 'run', resource 'geogrid rank scan', and the specification of geographic area positioning distinguish it from siblings like 'local_pack' or 'organic_serp'.

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 explains what the tool does but does not explicitly state when to use it over alternatives or provide 'when not to use' guidance. Usage is implied through the purpose, but no direct comparative advice is given.

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