Skip to main content
Glama
localseodata

Local SEO Data

Official

related_keywords

Read-only

Get semantically related keywords and metrics for up to 20 seed keywords in a specific geographic location.

Instructions

Find related keywords for up to 20 seed keywords. Returns semantically related keywords with metrics. Costs 2 credits.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keywordsYesArray of seed keywords
locationYesGeographic location (e.g. "Orchard Park, NY")
limitNoMax results. Default: 50, max: 1000

Implementation Reference

  • The 'related_keywords' tool handler function registered via server.tool(). It accepts keywords (array, max 20), location, and optional limit, then calls the API endpoint /v1/keywords/related and formats the result.
    server.tool(
      "related_keywords",
      "Find related keywords for up to 20 seed keywords. Returns semantically related keywords with metrics. Costs 2 credits.",
      {
        keywords: z.array(z.string().min(1)).min(1).max(20).describe("Array of seed keywords"),
        location: z.string().min(1).describe('Geographic location (e.g. "Orchard Park, NY")'),
        limit: z.number().int().min(1).max(1000).optional().describe("Max results. Default: 50, max: 1000"),
      },
      READ_ONLY,
      withErrorHandling(async ({ keywords, location, limit }) => {
        const result = await callApi(
          "/v1/keywords/related",
          { keywords, location, ...(limit && { limit }) },
          getAuth()
        );
        return { content: [{ type: "text" as const, text: formatResult(result.data, result) }] };
      })
    );
  • Input schema for the related_keywords tool using Zod: keywords (array of strings, 1-20), location (string), limit (optional integer 1-1000).
    {
      keywords: z.array(z.string().min(1)).min(1).max(20).describe("Array of seed keywords"),
      location: z.string().min(1).describe('Geographic location (e.g. "Orchard Park, NY")'),
      limit: z.number().int().min(1).max(1000).optional().describe("Max results. Default: 50, max: 1000"),
    },
  • The registerKeywordTools function that registers all keyword-related tools (including related_keywords) on the MCP server.
    export function registerKeywordTools(server: McpServer, getAuth: () => string) {
      server.tool(
        "search_volume",
        "Get search volume and keyword metrics for up to 1000 keywords. Returns monthly search volume, CPC, competition, and trend data. Costs 1 credit per 50 keywords.",
        {
          keywords: z.array(z.string().min(1)).min(1).max(1000).describe("Array of keywords to analyze"),
          location: z.string().min(1).describe('Geographic location (e.g. "Orchard Park, NY")'),
          language: z.string().optional().describe('Language code. Default: "en"'),
        },
        READ_ONLY,
        withErrorHandling(async ({ keywords, location, language }) => {
          const result = await callApi(
            "/v1/keywords/search-volume",
            { keywords, location, ...(language && { language }) },
            getAuth()
          );
          return { content: [{ type: "text" as const, text: formatResult(result.data, result) }] };
        })
      );
    
      server.tool(
        "keyword_suggestions",
        "Get keyword suggestions for a seed keyword. Returns related keywords with search volume and metrics. Costs 2 credits.",
        {
          keyword: z.string().min(1).describe('Seed keyword (e.g. "plumber")'),
          location: z.string().min(1).describe('Geographic location (e.g. "Orchard Park, NY")'),
          limit: z.number().int().min(1).max(1000).optional().describe("Max suggestions. Default: 50, max: 1000"),
          include_seed_keyword: z.boolean().optional().describe("Include seed keyword in results. Default: true"),
        },
        READ_ONLY,
        withErrorHandling(async ({ keyword, location, limit, include_seed_keyword }) => {
          const result = await callApi(
            "/v1/keywords/suggestions",
            {
              keyword,
              location,
              ...(limit && { limit }),
              ...(include_seed_keyword !== undefined && { include_seed_keyword }),
            },
            getAuth()
          );
          return { content: [{ type: "text" as const, text: formatResult(result.data, result) }] };
        })
      );
    
      server.tool(
        "related_keywords",
        "Find related keywords for up to 20 seed keywords. Returns semantically related keywords with metrics. Costs 2 credits.",
        {
          keywords: z.array(z.string().min(1)).min(1).max(20).describe("Array of seed keywords"),
          location: z.string().min(1).describe('Geographic location (e.g. "Orchard Park, NY")'),
          limit: z.number().int().min(1).max(1000).optional().describe("Max results. Default: 50, max: 1000"),
        },
        READ_ONLY,
        withErrorHandling(async ({ keywords, location, limit }) => {
          const result = await callApi(
            "/v1/keywords/related",
            { keywords, location, ...(limit && { limit }) },
            getAuth()
          );
          return { content: [{ type: "text" as const, text: formatResult(result.data, result) }] };
        })
      );
    
      server.tool(
        "keywords_for_site",
        "Get keywords a domain currently ranks for. Returns keywords with rank positions and search volume. Costs 3 credits.",
        {
          domain: z.string().min(1).describe('Domain to analyze (e.g. "example.com")'),
          location: z.string().min(1).describe('Geographic location (e.g. "Orchard Park, NY")'),
          limit: z.number().int().min(1).max(1000).optional().describe("Max results. Default: 50, max: 1000"),
        },
        READ_ONLY,
        withErrorHandling(async ({ domain, location, limit }) => {
          const result = await callApi(
            "/v1/keywords/for-site",
            { domain, location, ...(limit && { limit }) },
            getAuth()
          );
          return { content: [{ type: "text" as const, text: formatResult(result.data, result) }] };
        })
      );
    
      server.tool(
        "keyword_trends",
        "Get search trend data for up to 5 keywords over time. Periods: 3m, 6m, 12m (default), 5y. Costs 1 credit.",
        {
          keywords: z.array(z.string().min(1)).min(1).max(5).describe("Keywords to get trends for"),
          location: z.string().min(1).describe('Geographic location (e.g. "Orchard Park, NY")'),
          period: z.enum(["3m", "6m", "12m", "5y"]).optional().describe('Time period. Default: "12m"'),
        },
        READ_ONLY,
        withErrorHandling(async ({ keywords, location, period }) => {
          const result = await callApi(
            "/v1/keywords/trends",
            { keywords, location, ...(period && { period }) },
            getAuth()
          );
          return { content: [{ type: "text" as const, text: formatResult(result.data, result) }] };
        })
      );
    }
  • The withErrorHandling wrapper used to wrap the handler, ensuring thrown errors are surfaced 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,
          };
        }
      };
    }
  • The formatResult helper used to format the API response data into a text output with credits 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)}`;
    }
Behavior4/5

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

Annotations already indicate readOnlyHint=true and destructiveHint=false. The description adds value by stating the credit cost (2 credits) and that results include metrics. No contradictions. However, it does not discuss rate limits or other behavioral constraints, so not a 5.

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 with no wasted words. Purpose, constraint, result, and cost are all front-loaded. Highly 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?

The tool has 3 parameters, no output schema, and moderate complexity. The description covers the basic purpose and credit cost but is vague about what 'metrics' are returned. It does not explain the structure of the response or any prerequisites beyond the schema. Given the absence of an output schema, more detail on return values would improve completeness.

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 description coverage is 100%, so the schema documents all parameters. The description's mention of 'up to 20 seed keywords' restates the schema's maxItems constraint without adding new meaning. No additional semantic guidance provided beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states the action 'find' and resource 'related keywords', with constraints 'up to 20 seed keywords'. It also mentions returning 'semantically related keywords with metrics' and credit cost. However, it does not distinguish itself from sibling tools like 'keyword_suggestions' or 'keyword_trends', which limits differentiation.

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

Usage Guidelines2/5

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

No guidance on when to use this tool versus alternatives such as keyword_suggestions or keyword_trends. The description does not mention scenarios or exclusions, leaving the agent to infer usage from the tool name alone.

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