get_keyword_suggestions
Discover relevant keyword ideas for SEO optimization by generating keyword suggestions based on a specific term, language, and location to enhance content strategy.
Instructions
Get keyword suggestions from SEO Review Tools API.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hl | No | The language for the suggestions. | |
| keyword | Yes | The keyword to get suggestions for. | |
| location | No | The location for the suggestions. |
Implementation Reference
- The main handler function that fetches keyword suggestions from the SEO Review Tools API using the provided keyword, language, and location parameters.const executeFunction = async ({ keyword, hl = 'English', location = 'United States' }) => { const baseUrl = 'https://api.seoreviewtools.com/v2/keyword-suggestions/'; const apiKey = process.env.SEO_API_WORKSPACE_API_KEY; try { // Construct the URL with query parameters const url = new URL(baseUrl); url.searchParams.append('keyword', keyword); url.searchParams.append('hl', hl); url.searchParams.append('location', location); url.searchParams.append('key', apiKey); // Perform the fetch request const response = await fetch(url.toString(), { method: 'GET', headers: { 'Content-Type': 'application/json' } }); // 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 suggestions:', error); return { error: 'An error occurred while getting keyword suggestions.' }; } };
- The schema definition for the get_keyword_suggestions tool, including name, description, parameters, and required fields.definition: { type: 'function', function: { name: 'get_keyword_suggestions', description: 'Get keyword suggestions from SEO Review Tools API.', parameters: { type: 'object', properties: { keyword: { type: 'string', description: 'The keyword to get suggestions for.' }, hl: { type: 'string', description: 'The language for the suggestions.' }, location: { type: 'string', description: 'The location for the suggestions.' } }, required: ['keyword'] } } }
- lib/tools.js:7-16 (registration)The discoverTools function that dynamically imports and registers all tools, including get_keyword_suggestions, by spreading the apiTool export from each tool module.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:9-9 (registration)The path entry in toolPaths array that enables registration of the get_keyword_suggestions tool.'seo-api-workspace/seo-ap-is-seo-review-tools/get-keyword-suggestions.js'