Skip to main content
Glama
ravinwebsurgeon

DataForSEO MCP Server

backlinks_available_filters

Discover and apply specific filters to refine backlink data retrieved from DataForSEO Backlinks API endpoints. Enhance precision by targeting relevant objects within the result array.

Instructions

Here you will find all the necessary information about filters that can be used with DataForSEO Backlinks API endpoints.

Please, keep in mind that filters are associated with a certain object in the result array, and should be specified accordingly.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
toolNoThe name of the tool to get filters for

Implementation Reference

  • The primary handler method for the 'backlinks_available_filters' tool. It fetches and caches filters from the DataForSEO API, optionally filters by a specific tool name, and returns the formatted response or error.
    async handle(params: any): Promise<any> { try { const filters = await this.fetchAndCacheFilters(); if (!params.tool) { return this.formatResponse(filters); } const toolFilters = filters[params.tool]; if (!toolFilters) { throw new Error(`No filters found for tool: ${params.tool}`); } return this.formatResponse(toolFilters); } catch (error) { return this.formatErrorResponse(error); } }
  • The getTools() method registers all backlinks tools, including 'backlinks_available_filters' via instantiation of BacklinksFiltersTool and mapping to its name, description, params, and handler.
    getTools(): Record<string, ToolDefinition> { const tools = [ new BacklinksTool(this.dataForSEOClient), new BacklinksAnchorTool(this.dataForSEOClient), new BacklinksBulkBacklinksTool(this.dataForSEOClient), new BacklinksBulkNewLostReferringDomainsTool(this.dataForSEOClient), new BacklinksBulkNewLostBacklinksTool(this.dataForSEOClient), new BacklinksBulkRanksTool(this.dataForSEOClient), new BacklinksBulkReferringDomainsTool(this.dataForSEOClient), new BacklinksBulkSpamScoreTool(this.dataForSEOClient), new BacklinksCompetitorsTool(this.dataForSEOClient), new BacklinksDomainIntersectionTool(this.dataForSEOClient), new BacklinksDomainPagesSummaryTool(this.dataForSEOClient), new BacklinksDomainPagesTool(this.dataForSEOClient), new BacklinksPageIntersectionTool(this.dataForSEOClient), new BacklinksReferringDomainsTool(this.dataForSEOClient), new BacklinksReferringNetworksTool(this.dataForSEOClient), new BacklinksSummaryTool(this.dataForSEOClient), new BacklinksTimeseriesNewLostSummaryTool(this.dataForSEOClient), new BacklinksTimeseriesSummaryTool(this.dataForSEOClient), new BacklinksBulkPagesSummaryTool(this.dataForSEOClient), new BacklinksFiltersTool(this.dataForSEOClient) // Add more tools here ]; return tools.reduce((acc, tool) => ({ ...acc, [tool.getName()]: { description: tool.getDescription(), params: tool.getParams(), handler: (params: any) => tool.handle(params), }, }), {}); }
  • Defines the input schema for the tool using Zod: optional 'tool' string parameter.
    getParams(): z.ZodRawShape { return { tool: z.string().optional().describe('The name of the tool to get filters for') }; }
  • Helper method to fetch available filters from DataForSEO API endpoint '/v3/backlinks/available_filters', cache them for 24 hours, and transform into tool-specific filter maps using TOOL_TO_FILTER_MAP.
    private async fetchAndCacheFilters(): Promise<ToolFilters> { const now = Date.now(); // Return cached data if it's still valid if (BacklinksFiltersTool.cache && (now - BacklinksFiltersTool.lastFetchTime) < BacklinksFiltersTool.CACHE_TTL) { return BacklinksFiltersTool.cache; } // Fetch fresh data const response = await this.client.makeRequest('/v3/backlinks/available_filters', 'GET', null, true) as DataForSEOFullResponse; this.validateResponseFull(response); // Transform the response into our cache format const filters: ToolFilters = {}; const result = response.tasks[0].result[0]; // Process each tool's filters for (const [toolName, filterPath] of Object.entries(BacklinksFiltersTool.TOOL_TO_FILTER_MAP)) { const pathParts = filterPath.split('.'); let current = result; // Navigate to the correct filter object for (const part of pathParts) { if (current && current[part]) { current = current[part]; } else { current = null; break; } } if (current) { filters[toolName] = current; } } // Update cache BacklinksFiltersTool.cache = filters; BacklinksFiltersTool.lastFetchTime = now; return filters; }

Other Tools

Related Tools

Latest Blog Posts

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/ravinwebsurgeon/seo-mcp'

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