Skip to main content
Glama
localseodata

Local SEO Data

Official

keyword_trends

Read-only

Retrieve search trend data for up to five keywords over time periods for a specific location to analyze interest patterns.

Instructions

Get search trend data for up to 5 keywords over time. Periods: 3m, 6m, 12m (default), 5y. Costs 1 credit.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keywordsYesKeywords to get trends for
locationYesGeographic location (e.g. "Orchard Park, NY")
periodNoTime period. Default: "12m"

Implementation Reference

  • The async handler function that executes the keyword_trends tool logic. It calls the API at /v1/keywords/trends with keywords, location, and an optional period parameter.
      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) }] };
      })
    );
  • Input schema for keyword_trends: keywords (array of 1-5 strings), location (string), and optional period (enum: '3m', '6m', '12m', '5y').
    "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"'),
    },
  • Registration of the 'keyword_trends' tool via server.tool() within registerKeywordTools(), with READ_ONLY hint and description about cost and usage.
    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) }] };
      })
    );
  • src/server.ts:42-42 (registration)
    Registration call registerKeywordTools(server, getAuth) that wires up the keyword_trends tool into the MCP server.
    registerKeywordTools(server, getAuth);
  • withErrorHandling wrapper used by the keyword_trends handler to catch and surface errors as MCP error content.
    /** 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,
          };
        }
      };
    }
Behavior3/5

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

Annotations already indicate read-only and non-destructive behavior. The description adds 'Costs 1 credit,' which is helpful but doesn't significantly expand beyond the 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?

Extremely concise: two short sentences that convey essential information. No wasted words, and critical details (limits, periods, cost) are front-loaded.

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 tool's simplicity, the description covers key aspects: purpose, constraints, period options, and cost. Lacks return format details, but no output schema exists. Reasonably complete for a read-only trend tool.

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 description coverage is 100%, so the schema already documents all parameters. The description reinforces the keyword limit and available periods but adds no additional meaning 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?

Clearly states the tool retrieves search trend data for keywords over time, with limits (up to 5) and period options. However, it doesn't explicitly differentiate from sibling tools like keyword_suggestions or search_volume.

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?

Provides basic guidance by listing periods and cost, but lacks explicit instructions on when to use versus alternatives or when not to use. The context is clear but not comprehensive.

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