get_webpage_seo_analysis
Analyze the SEO performance of any webpage to identify optimization opportunities and improve search engine visibility. Input the URL to receive actionable insights.
Instructions
Get SEO analysis for a given url
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | The url to analyze |
Input Schema (JSON Schema)
{
"properties": {
"url": {
"description": "The url to analyze",
"type": "string"
}
},
"required": [
"url"
],
"type": "object"
}
Implementation Reference
- index.js:685-686 (handler)The handler function for the 'get_webpage_seo_analysis' tool. It calls the shared makeRequest method to perform a GET request to the FetchSERP API endpoint '/api/v1/web_page_seo_analysis' with the tool arguments.case 'get_webpage_seo_analysis': return await this.makeRequest('/api/v1/web_page_seo_analysis', 'GET', args, null, token);
- index.js:522-535 (registration)Registration of the 'get_webpage_seo_analysis' tool in the listTools response, including its name, description, and input schema.{ name: 'get_webpage_seo_analysis', description: 'Get SEO analysis for a given url', inputSchema: { type: 'object', properties: { url: { type: 'string', description: 'The url to analyze', }, }, required: ['url'], }, },
- index.js:525-534 (schema)Input schema definition for the 'get_webpage_seo_analysis' tool, specifying the required 'url' parameter.inputSchema: { type: 'object', properties: { url: { type: 'string', description: 'The url to analyze', }, }, required: ['url'], },
- index.js:565-613 (helper)Shared helper method 'makeRequest' used by all tools, including 'get_webpage_seo_analysis', to make authenticated HTTP requests to the FetchSERP API.async makeRequest(endpoint, method = 'GET', params = {}, body = null, token = null) { const fetchserpToken = token || process.env.FETCHSERP_API_TOKEN; if (!fetchserpToken) { throw new McpError( ErrorCode.InvalidRequest, 'FETCHSERP_API_TOKEN is required' ); } const url = new URL(`${API_BASE_URL}${endpoint}`); // Add query parameters for GET requests if (method === 'GET' && Object.keys(params).length > 0) { Object.entries(params).forEach(([key, value]) => { if (value !== undefined && value !== null) { if (Array.isArray(value)) { value.forEach(v => url.searchParams.append(`${key}[]`, v)); } else { url.searchParams.append(key, value.toString()); } } }); } const fetchOptions = { method, headers: { 'Authorization': `Bearer ${fetchserpToken}`, 'Content-Type': 'application/json', }, }; if (body && method !== 'GET') { fetchOptions.body = JSON.stringify(body); } const response = await fetch(url.toString(), fetchOptions); if (!response.ok) { const errorText = await response.text(); throw new McpError( ErrorCode.InternalError, `API request failed: ${response.status} ${response.statusText} - ${errorText}` ); } return await response.json(); }