wordstat_get_regions_distribution
Analyze keyword popularity across regions to identify where a phrase is searched most often.
Instructions
Get regional distribution for a keyword: where users search this phrase more often.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| phrase | Yes | Keyword/phrase to analyze in Wordstat. | |
| region | No | Distribution granularity. Default is REGION_ALL. | |
| devices | No | Optional device filter: all/desktop/phone/tablet. |
Implementation Reference
- src/register-tools.ts:336-359 (handler)The handler function for 'wordstat_get_regions_distribution' tool. It calls the Yandex API at /v2/wordstat/regions with the phrase, region (default REGION_ALL), and optional devices filter, then returns the results in structuredContent.
async ({ phrase, region, devices }) => { return withToolErrorHandling(async () => { const response = await client.post<Record<string, unknown>>("/v2/wordstat/regions", { phrase, region: region ?? "REGION_ALL", ...(devices !== undefined ? { devices } : {}), }); const structuredContent = { results: response.results, }; return { content: [ { type: "text", text: JSON.stringify(structuredContent, null, 2), }, ], structuredContent, }; }); }, ); - src/register-tools.ts:319-335 (schema)Registration and input schema for 'wordstat_get_regions_distribution'. Defines the tool metadata (description) and inputSchema with phrase (required string), region (optional WordstatRegionSchema enum), and devices (optional array of WordstatDeviceSchema).
server.registerTool( "wordstat_get_regions_distribution", { description: "Get regional distribution for a keyword: where users search this phrase more often.", inputSchema: { phrase: z.string().min(1).max(400).describe("Keyword/phrase to analyze in Wordstat."), region: WordstatRegionSchema.optional().describe( "Distribution granularity. Default is REGION_ALL.", ), devices: z .array(WordstatDeviceSchema) .max(3) .optional() .describe("Optional device filter: all/desktop/phone/tablet."), }, }, - src/register-tools.ts:319-359 (registration)The tool is registered via server.registerTool("wordstat_get_regions_distribution", ...) inside the registerYandexSearchTools function, which is called from src/index.ts line 19.
server.registerTool( "wordstat_get_regions_distribution", { description: "Get regional distribution for a keyword: where users search this phrase more often.", inputSchema: { phrase: z.string().min(1).max(400).describe("Keyword/phrase to analyze in Wordstat."), region: WordstatRegionSchema.optional().describe( "Distribution granularity. Default is REGION_ALL.", ), devices: z .array(WordstatDeviceSchema) .max(3) .optional() .describe("Optional device filter: all/desktop/phone/tablet."), }, }, async ({ phrase, region, devices }) => { return withToolErrorHandling(async () => { const response = await client.post<Record<string, unknown>>("/v2/wordstat/regions", { phrase, region: region ?? "REGION_ALL", ...(devices !== undefined ? { devices } : {}), }); const structuredContent = { results: response.results, }; return { content: [ { type: "text", text: JSON.stringify(structuredContent, null, 2), }, ], structuredContent, }; }); }, );