Skip to main content
Glama

SEO Review Tools - MCP server

Official
get-backlinks.js2.17 kB
/** * Function to get backlinks for a specified URL using SEO Review Tools API. * * @param {Object} args - Arguments for the backlinks request. * @param {string} args.url - The URL for which to retrieve backlinks. * @param {number} [args.unique_domains=1] - Whether to return unique domains (1 for yes, 0 for no). * @returns {Promise<Object>} - The result of the backlinks request. */ const executeFunction = async ({ url, unique_domains = 1 }) => { const baseUrl = 'https://api.seoreviewtools.com/backlinks/'; const apiKey = process.env.SEO_API_WORKSPACE_API_KEY; try { // Construct the URL with query parameters const urlWithParams = new URL(baseUrl); urlWithParams.searchParams.append('url', url); urlWithParams.searchParams.append('unique_domains', unique_domains.toString()); urlWithParams.searchParams.append('key', apiKey); // Perform the fetch request const response = await fetch(urlWithParams.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 backlinks:', error); return { error: 'An error occurred while getting backlinks.' }; } }; /** * Tool configuration for getting backlinks using SEO Review Tools API. * @type {Object} */ const apiTool = { function: executeFunction, definition: { type: 'function', function: { name: 'get_backlinks', description: 'Get backlinks for a specified URL.', parameters: { type: 'object', properties: { url: { type: 'string', description: 'The URL for which to retrieve backlinks.' }, unique_domains: { type: 'integer', description: 'Whether to return unique domains (1 for yes, 0 for no).' } }, required: ['url'] } } } }; export { apiTool };

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/SEO-Review-Tools/SEO-API-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server