get_authority_scores
Calculate authority scores for multiple URLs to assess their SEO performance. Retrieve metrics like Page Authority (PA) and Domain Authority (DA) for data-driven optimization.
Instructions
Get authority scores for a list of URLs.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| metrics | No | The metrics to retrieve, default is "pa|da". | |
| urls | Yes | The list of URLs to check authority scores for. |
Implementation Reference
- The core handler function that fetches authority scores for URLs by calling the SEO Review Tools bulk-authority-score API.const executeFunction = async ({ urls, metrics = 'pa|da' }) => { const baseUrl = 'https://api.seoreviewtools.com/bulk-authority-score/'; const token = process.env.SEO_API_WORKSPACE_API_KEY; try { // Prepare the request body const body = JSON.stringify({ urls }); // Set up headers for the request const headers = { 'Content-Type': 'application/json', 'X-API-Key': token }; // Perform the fetch request const response = await fetch(`${baseUrl}?metrics=${metrics}&key=${token}`, { method: 'POST', headers, body }); // 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 authority scores:', error); return { error: 'An error occurred while getting authority scores.' }; } };
- Input schema definition for the get_authority_scores tool, specifying urls as required array and optional metrics.type: 'function', function: { name: 'get_authority_scores', description: 'Get authority scores for a list of URLs.', parameters: { type: 'object', properties: { urls: { type: 'array', items: { type: 'string' }, description: 'The list of URLs to check authority scores for.' }, metrics: { type: 'string', description: 'The metrics to retrieve, default is "pa|da".' } }, required: ['urls'] } } }
- The apiTool export object that bundles the handler and schema, dynamically loaded for tool registration.const apiTool = { function: executeFunction, definition: { type: 'function', function: { name: 'get_authority_scores', description: 'Get authority scores for a list of URLs.', parameters: { type: 'object', properties: { urls: { type: 'array', items: { type: 'string' }, description: 'The list of URLs to check authority scores for.' }, metrics: { type: 'string', description: 'The metrics to retrieve, default is "pa|da".' } }, required: ['urls'] } } } };
- lib/tools.js:7-16 (registration)Dynamic registration loader that imports apiTool from each tool file listed in toolPaths, including get-authority.js.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)Helper array listing paths to all SEO tool files, enabling dynamic discovery and registration of get_authority_scores.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' ];