Skip to main content
Glama
shufl9dka

yandex-searchapi-mcp

by shufl9dka

wordstat_get_dynamics

Retrieve historical search frequency trends for a keyword over daily, weekly, or monthly periods, optionally filtered by region and device.

Instructions

Get how search frequency changes over time for a keyword (daily, weekly, or monthly).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
phraseYesKeyword/phrase to analyze in Wordstat.
periodNoAggregation period. Default is PERIOD_WEEKLY.
fromDateNoStart datetime in ISO-8601 format. If omitted, a safe default is used.
toDateNoEnd datetime in ISO-8601 format. If omitted, a safe default is used.
regionsNoOptional list of region IDs to filter statistics.
devicesNoOptional device filter: all/desktop/phone/tablet.

Implementation Reference

  • Registration of the 'wordstat_get_dynamics' tool with input schema and handler function.
    server.registerTool(
      "wordstat_get_dynamics",
      {
        description:
          "Get how search frequency changes over time for a keyword (daily, weekly, or monthly).",
        inputSchema: {
          phrase: z.string().min(1).max(400).describe("Keyword/phrase to analyze in Wordstat."),
          period: WordstatPeriodSchema.optional().describe(
            "Aggregation period. Default is PERIOD_WEEKLY.",
          ),
          fromDate: z
            .string()
            .optional()
            .describe("Start datetime in ISO-8601 format. If omitted, a safe default is used."),
          toDate: z
            .string()
            .optional()
            .describe("End datetime in ISO-8601 format. If omitted, a safe default is used."),
          regions: z
            .array(z.string().min(1))
            .max(100)
            .optional()
            .describe("Optional list of region IDs to filter statistics."),
          devices: z
            .array(WordstatDeviceSchema)
            .max(3)
            .optional()
            .describe("Optional device filter: all/desktop/phone/tablet."),
        },
      },
      async ({ phrase, period, fromDate, toDate, regions, devices }) => {
        return withToolErrorHandling(async () => {
          const selectedPeriod = period ?? "PERIOD_WEEKLY";
          const defaultRange = getDefaultDynamicsRange(selectedPeriod);
          const response = await client.post<Record<string, unknown>>("/v2/wordstat/dynamics", {
            phrase,
            period: selectedPeriod,
            fromDate: fromDate ?? defaultRange.fromDate,
            toDate: toDate ?? defaultRange.toDate,
            ...(regions !== undefined ? { regions } : {}),
            ...(devices !== undefined ? { devices } : {}),
          });
    
          const structuredContent = {
            results: response.results,
          };
    
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(structuredContent, null, 2),
              },
            ],
            structuredContent,
          };
        });
      },
    );
  • Handler function for wordstat_get_dynamics - posts to /v2/wordstat/dynamics API and returns results.
    async ({ phrase, period, fromDate, toDate, regions, devices }) => {
      return withToolErrorHandling(async () => {
        const selectedPeriod = period ?? "PERIOD_WEEKLY";
        const defaultRange = getDefaultDynamicsRange(selectedPeriod);
        const response = await client.post<Record<string, unknown>>("/v2/wordstat/dynamics", {
          phrase,
          period: selectedPeriod,
          fromDate: fromDate ?? defaultRange.fromDate,
          toDate: toDate ?? defaultRange.toDate,
          ...(regions !== undefined ? { regions } : {}),
          ...(devices !== undefined ? { devices } : {}),
        });
    
        const structuredContent = {
          results: response.results,
        };
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(structuredContent, null, 2),
            },
          ],
          structuredContent,
        };
      });
    },
  • Input schema for wordstat_get_dynamics: phrase (string), period (WordstatPeriodSchema), fromDate, toDate (ISO-8601 strings), regions (array of strings), devices (array of WordstatDeviceSchema).
    inputSchema: {
      phrase: z.string().min(1).max(400).describe("Keyword/phrase to analyze in Wordstat."),
      period: WordstatPeriodSchema.optional().describe(
        "Aggregation period. Default is PERIOD_WEEKLY.",
      ),
      fromDate: z
        .string()
        .optional()
        .describe("Start datetime in ISO-8601 format. If omitted, a safe default is used."),
      toDate: z
        .string()
        .optional()
        .describe("End datetime in ISO-8601 format. If omitted, a safe default is used."),
      regions: z
        .array(z.string().min(1))
        .max(100)
        .optional()
        .describe("Optional list of region IDs to filter statistics."),
      devices: z
        .array(WordstatDeviceSchema)
        .max(3)
        .optional()
        .describe("Optional device filter: all/desktop/phone/tablet."),
    },
  • getDefaultDynamicsRange helper function that calculates default fromDate/toDate based on the period (weekly/monthly/daily).
    function getDefaultDynamicsRange(period: "PERIOD_MONTHLY" | "PERIOD_WEEKLY" | "PERIOD_DAILY"): {
      fromDate: string;
      toDate: string;
    } {
      let toDate = new Date();
      const fromDate = new Date(toDate);
    
      if (period === "PERIOD_WEEKLY") {
        const day = toDate.getUTCDay();
        const deltaToPreviousSunday = day === 0 ? 7 : day;
        toDate.setUTCDate(toDate.getUTCDate() - deltaToPreviousSunday);
        toDate.setUTCHours(23, 59, 59, 0);
    
        fromDate.setTime(toDate.getTime());
        fromDate.setUTCDate(fromDate.getUTCDate() - 27);
        fromDate.setUTCHours(0, 0, 0, 0);
      } else if (period === "PERIOD_MONTHLY") {
        fromDate.setUTCMonth(fromDate.getUTCMonth() - 6);
        fromDate.setUTCDate(1);
        fromDate.setUTCHours(0, 0, 0, 0);
      } else {
        const dailyRange = getIsoDateRange(30);
        return dailyRange;
      }
    
      return {
        fromDate: fromDate.toISOString(),
        toDate: toDate.toISOString(),
      };
    }
  • WordstatPeriodSchema: zod enum defining the allowed period values PERIOD_MONTHLY, PERIOD_WEEKLY, PERIOD_DAILY.
    const WordstatPeriodSchema = z.enum(["PERIOD_MONTHLY", "PERIOD_WEEKLY", "PERIOD_DAILY"]);
Behavior2/5

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

No annotations are provided, and the description does not disclose any behavioral traits such as whether the operation is read-only, authentication requirements, rate limits, or potential side effects. For a tool that retrieves data, minimal transparency is given.

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 a single, clear sentence with no unnecessary words. It is front-loaded with the core action and resource.

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

Completeness2/5

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

No output schema is present, and the description does not explain the return format (e.g., time series data, value type). Given the tool's function (trend analysis), more contextual detail about the response would be helpful.

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 the description adds limited value over the schema. It mentions 'daily, weekly, or monthly' which is already captured by the period enum. Baseline 3 is appropriate as no additional semantic aid is provided.

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 verb 'Get', the resource 'search frequency changes over time for a keyword', and specifies time granularity options (daily, weekly, monthly). This distinguishes it from sibling tools like wordstat_get_top or wordstat_get_regions_distribution.

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?

No explicit guidance on when to use this tool versus alternatives (e.g., other wordstat tools). The context is implied but not stated, leaving the agent to infer usage from the name and description.

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/shufl9dka/yandex-searchapi-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server