get_seo_content_score
Analyze and optimize webpage SEO performance by evaluating title tags, meta descriptions, body content, and keywords using real-time data insights.
Instructions
Get the SEO content score from SEO Review Tools.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| body_content | Yes | The body content of the document, including HTML formatting. | |
| keyword | Yes | The main keyword for the SEO analysis. | |
| meta_description | Yes | The meta description of the content. | |
| relatedkeywords | Yes | Related keywords for the SEO analysis. | |
| title_tag | Yes | The title tag of the content. |
Implementation Reference
- The handler function that makes a POST request to the SEO Review Tools API to compute the SEO content score based on provided title, meta, body, keyword, and related keywords.const executeFunction = async ({ title_tag, meta_description, body_content, keyword, relatedkeywords }) => { const baseUrl = 'https://api.seoreviewtools.com/v5/seo-content-optimization/'; const token = process.env.SEO_API_WORKSPACE_API_KEY; const content_input = { title_tag, meta_description, body_content }; try { // Construct the URL with query parameters const url = new URL(baseUrl); url.searchParams.append('content', '1'); url.searchParams.append('keyword', keyword); url.searchParams.append('relatedkeywords', relatedkeywords.join('|')); url.searchParams.append('key', token); // Set up headers for the request const headers = { 'Content-Type': 'application/json' }; // Perform the fetch request const response = await fetch(url.toString(), { method: 'POST', headers, body: JSON.stringify({ content_input }) }); // 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 SEO content score:', error); return { error: 'An error occurred while getting the SEO content score.' }; } };
- The JSON schema definition for the tool's input parameters, including descriptions and required fields.definition: { type: 'function', function: { name: 'get_seo_content_score', description: 'Get the SEO content score from SEO Review Tools.', parameters: { type: 'object', properties: { title_tag: { type: 'string', description: 'The title tag of the content.' }, meta_description: { type: 'string', description: 'The meta description of the content.' }, body_content: { type: 'string', description: 'The body content of the document, including HTML formatting.' }, keyword: { type: 'string', description: 'The main keyword for the SEO analysis.' }, relatedkeywords: { type: 'array', items: { type: 'string' }, description: 'Related keywords for the SEO analysis.' } }, required: ['title_tag', 'meta_description', 'body_content', 'keyword', 'relatedkeywords'] } }
- The apiTool object that bundles the handler function and schema, exported for dynamic registration.const apiTool = { function: executeFunction, definition: { type: 'function', function: { name: 'get_seo_content_score', description: 'Get the SEO content score from SEO Review Tools.', parameters: { type: 'object', properties: { title_tag: { type: 'string', description: 'The title tag of the content.' }, meta_description: { type: 'string', description: 'The meta description of the content.' }, body_content: { type: 'string', description: 'The body content of the document, including HTML formatting.' }, keyword: { type: 'string', description: 'The main keyword for the SEO analysis.' }, relatedkeywords: { type: 'array', items: { type: 'string' }, description: 'Related keywords for the SEO analysis.' } }, required: ['title_tag', 'meta_description', 'body_content', 'keyword', 'relatedkeywords'] } } } }; export { apiTool };
- tools/paths.js:7-7 (registration)Path to the tool file included in the toolPaths array used for discovering and loading tools.'seo-api-workspace/seo-ap-is-seo-review-tools/get-seo-content-score.js',
- lib/tools.js:8-16 (registration)Dynamic import and registration of all tools by loading apiTool from each file listed in toolPaths.const toolPromises = toolPaths.map(async (file) => { const module = await import(`../tools/${file}`); return { ...module.apiTool, path: file, }; }); return Promise.all(toolPromises); }