Skip to main content
Glama
localseodata

Local SEO Data

Official

backlink_gap

Read-only

Identify backlink opportunities by comparing your domain with competitors. Discover referring domains that link to competitors but not to you to improve your link profile.

Instructions

Find backlink opportunities by comparing your domain against up to 5 competitors. Returns referring domains that link to competitors but not to you. Costs 10 credits.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
your_domainYesYour domain (e.g. "example.com")
competitor_domainsYesCompetitor domains to compare against
limitNoMax opportunities. Default: 50, max: 100

Implementation Reference

  • The handler function for the backlink_gap tool. Calls the /v1/backlinks/gap API endpoint with your_domain, competitor_domains, and optional limit, then formats the response.
    withErrorHandling(async ({ your_domain, competitor_domains, limit }) => {
      const result = await callApi(
        "/v1/backlinks/gap",
        { your_domain, competitor_domains, ...(limit && { limit }) },
        getAuth()
      );
      return { content: [{ type: "text" as const, text: formatResult(result.data, result) }] };
    })
  • Input schema for backlink_gap tool using Zod: your_domain (string), competitor_domains (array of 1-5 strings), limit (optional integer 1-100).
    {
      your_domain: z.string().min(1).describe('Your domain (e.g. "example.com")'),
      competitor_domains: z.array(z.string().min(1)).min(1).max(5).describe("Competitor domains to compare against"),
      limit: z.number().int().min(1).max(100).optional().describe("Max opportunities. Default: 50, max: 100"),
    },
  • The registerBacklinkTools function registers both backlink_summary and backlink_gap tools on the MCP server via server.tool().
    export function registerBacklinkTools(server: McpServer, getAuth: () => string) {
      server.tool(
        "backlink_summary",
        "Get backlink profile summary for a domain. Returns total backlinks, referring domains, spam score, and backlink type breakdown. Costs 5 credits.",
        {
          domain: z.string().min(1).describe('Domain to analyze (e.g. "example.com")'),
        },
        READ_ONLY,
        withErrorHandling(async ({ domain }) => {
          const result = await callApi("/v1/backlinks/summary", { domain }, getAuth());
          return { content: [{ type: "text" as const, text: formatResult(result.data, result) }] };
        })
      );
    
      server.tool(
        "backlink_gap",
        "Find backlink opportunities by comparing your domain against up to 5 competitors. Returns referring domains that link to competitors but not to you. Costs 10 credits.",
        {
          your_domain: z.string().min(1).describe('Your domain (e.g. "example.com")'),
          competitor_domains: z.array(z.string().min(1)).min(1).max(5).describe("Competitor domains to compare against"),
          limit: z.number().int().min(1).max(100).optional().describe("Max opportunities. Default: 50, max: 100"),
        },
        READ_ONLY,
        withErrorHandling(async ({ your_domain, competitor_domains, limit }) => {
          const result = await callApi(
            "/v1/backlinks/gap",
            { your_domain, competitor_domains, ...(limit && { limit }) },
            getAuth()
          );
          return { content: [{ type: "text" as const, text: formatResult(result.data, result) }] };
        })
      );
    }
  • src/server.ts:43-43 (registration)
    Invocation of registerBacklinkTools(server, getAuth) inside createMcpServer to wire up the backlink tools including backlink_gap.
    registerBacklinkTools(server, getAuth);
  • formatResult helper used by the handler to format API response data along with credit usage metadata.
    export function formatResult(
      data: unknown,
      meta: { credits_used: number; credits_remaining: number; cached: boolean }
    ): string {
      const metaLine = `[${meta.credits_used} credit${meta.credits_used !== 1 ? "s" : ""} used | ${meta.credits_remaining} remaining${meta.cached ? " | cached" : ""}]`;
      return `${metaLine}\n\n${JSON.stringify(data, null, 2)}`;
    }
    
    type ToolResult = { content: { type: "text"; text: string }[]; isError?: boolean };
    
    /** Wrap an MCP tool handler so thrown errors always surface as MCP error content */
    export function withErrorHandling<T>(
      fn: (args: T) => Promise<ToolResult>
    ): (args: T) => Promise<ToolResult> {
      return async (args) => {
        try {
          return await fn(args);
        } catch (err) {
          const message = err instanceof Error ? err.message : String(err);
          console.error(`[mcp] Tool error: ${message}`);
          return {
            content: [{ type: "text" as const, text: `Error: ${message}` }],
            isError: true,
          };
        }
      };
    }
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true and destructiveHint=false, but the description adds the credit cost and explains the result type (referring domains linking to competitors but not you). This enriches behavioral understanding beyond annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Description is two sentences long, front-loading the core purpose and adding only the credit cost as additional context. No waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With 3 parameters and no output schema, the description explains the tool's purpose, inputs, and output type. It lacks edge case handling but is sufficient for a simple tool. OpenWorldHint indicates it may not list all possibilities, so a 4 is fair.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Input schema covers 100% of parameters with descriptions. The description does not add significant parameter details beyond schema, so baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states the tool finds backlink opportunities by comparing your domain against up to 5 competitors. It distinguishes from siblings like 'competitor_gap' which is broader, and 'backlink_summary' which summarizes existing backlinks.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Description implies use when you want to discover backlink opportunities but lacks explicit when-not guidance or alternatives. No mention of prerequisites or comparisons to similar sibling tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/localseodata/mcp-server'

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