get_keyword_statistics
Analyze keyword performance with real-time statistics, including search volume, competition, and location-specific insights, to optimize SEO strategies effectively.
Instructions
Get keyword statistics from SEO Review Tools.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hl | No | The language for the response. | |
| keywords | Yes | The keywords to get statistics for. | |
| location | No | The location for the keyword statistics. |
Implementation Reference
- The handler function that executes the tool logic: makes a POST request to the SEO Review Tools API to fetch keyword statistics.const executeFunction = async ({ keywords, hl = 'English', location = 'United States' }) => { const baseUrl = 'https://api.seoreviewtools.com/keyword-statistics/'; const token = process.env.SEO_API_WORKSPACE_API_KEY; try { // Construct the request body const body = JSON.stringify({ keywords }); // Set up headers for the request const headers = { 'Content-Type': 'application/json', 'X-API-Key': token }; // Construct the URL with query parameters const url = new URL(baseUrl); url.searchParams.append('hl', hl); url.searchParams.append('location', location); // Perform the fetch request const response = await fetch(url.toString(), { method: 'POST', headers, body }); // Check if the response was successful if (!response.ok) { const errorData = await response.json(); throw new Error(errorData); } // Parse and return the response data const data = await response.json(); return data; } catch (error) { console.error('Error getting keyword statistics:', error); return { error: 'An error occurred while getting keyword statistics.' }; } };
- The tool schema and configuration, including the function name, description, and JSON Schema for parameters.const apiTool = { function: executeFunction, definition: { type: 'function', function: { name: 'get_keyword_statistics', description: 'Get keyword statistics from SEO Review Tools.', parameters: { type: 'object', properties: { keywords: { type: 'array', items: { type: 'string' }, description: 'The keywords to get statistics for.' }, hl: { type: 'string', description: 'The language for the response.' }, location: { type: 'string', description: 'The location for the keyword statistics.' } }, required: ['keywords'] } } } };
- lib/tools.js:7-16 (registration)Dynamic registration of tools via discoverTools, which imports apiTool from each path in toolPaths.export async function discoverTools() { const toolPromises = toolPaths.map(async (file) => { const module = await import(`../tools/${file}`); return { ...module.apiTool, path: file, }; }); return Promise.all(toolPromises); }
- tools/paths.js:8-8 (registration)The specific path to the get_keyword_statistics tool included in the toolPaths array for discovery.'seo-api-workspace/seo-ap-is-seo-review-tools/get-keyword-statistics.js',