keywords_data_google_ads_search_volume
Extract search volume data for specific keywords from Google Ads to optimize ad campaigns and refine keyword strategies based on location and language preferences.
Instructions
Get search volume data for keywords from Google Ads
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| keywords | Yes | Array of keywords to get search volume for | |
| language_code | No | Language two-letter ISO code (e.g., 'en'). optional field | |
| location_name | No | full name of the location optional field in format "Country" example: United Kingdom |
Implementation Reference
- The main handler function that executes the tool logic: makes a POST request to the DataForSEO /v3/keywords_data/google_ads/search_volume/live endpoint with the provided parameters and handles the response or error.async handle(params: any): Promise<any> { try { const response = await this.dataForSEOClient.makeRequest('/v3/keywords_data/google_ads/search_volume/live', 'POST', [{ location_name: params.location_name, language_code: params.language_code, keywords: params.keywords, }]); return this.validateAndFormatResponse(response); } catch (error) { return this.formatErrorResponse(error); } }
- Defines the Zod schema for input parameters: location_name (optional), language_code (optional), and keywords (array of strings).getParams(): z.ZodRawShape { return { location_name: z.string().nullable().default(null).describe(`full name of the location optional field in format "Country" example: United Kingdom`), language_code: z.string().nullable().default(null).describe(`Language two-letter ISO code (e.g., 'en'). optional field`), keywords: z.array(z.string()).describe("Array of keywords to get search volume for"), }; }
- Registers the GoogleAdsSearchVolumeTool by instantiating it and including it in the tools array, which is then mapped to a record of tool definitions (name, description, params, handler) returned by getTools().getTools(): Record<string, ToolDefinition> { const tools = [ new GoogleAdsSearchVolumeTool(this.dataForSEOClient), new DataForSeoTrendsDemographyTool(this.dataForSEOClient), new DataForSeoTrendsSubregionInterestsTool(this.dataForSEOClient), new DataForSeoTrendsExploreTool(this.dataForSEOClient), new GoogleTrendsCategoriesTool(this.dataForSEOClient), new GoogleTrendsExploreTool(this.dataForSEOClient), // Add more tools here ]; return tools.reduce((acc, tool) => ({ ...acc, [tool.getName()]: { description: tool.getDescription(), params: tool.getParams(), handler: (params: any) => tool.handle(params), }, }), {}); }