get_keyword_suggestions
Generate keyword suggestions for SEO content planning using target keywords, language, and location parameters to improve search visibility.
Instructions
Get keyword suggestions from SEO Review Tools API.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| keyword | Yes | The keyword to get suggestions for. | |
| hl | No | The language for the suggestions. | |
| location | No | The location for the suggestions. |
Implementation Reference
- The core handler function that fetches keyword suggestions from the SEO Review Tools API using the provided keyword, language (hl), 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 tool definition object including schema for input parameters, description, and reference to the handler function. This is the object exported and used for registration.
const apiTool = { function: executeFunction, 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 dynamically imports the apiTool from each tool file (including get-keyword-suggestions.js) and collects them into an array for registration in the MCP system.
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:1-10 (helper)List of all tool file paths used by discoverTools to load the get_keyword_suggestions tool among others.
export const toolPaths = [ 'seo-api-workspace/seo-ap-is-seo-review-tools/get-website-traffic.js', 'seo-api-workspace/seo-ap-is-seo-review-tools/get-authority.js', 'seo-api-workspace/seo-ap-is-seo-review-tools/get-serp.js', 'seo-api-workspace/seo-ap-is-seo-review-tools/post-bulk-website-traffic.js', 'seo-api-workspace/seo-ap-is-seo-review-tools/get-backlinks.js', 'seo-api-workspace/seo-ap-is-seo-review-tools/get-seo-content-score.js', 'seo-api-workspace/seo-ap-is-seo-review-tools/get-keyword-statistics.js', 'seo-api-workspace/seo-ap-is-seo-review-tools/get-keyword-suggestions.js' ];