Skip to main content
Glama
davinoishi

Broken Link Checker MCP Server

by davinoishi

check_page_links

Check all links on a single HTML page for broken links, returning HTTP status codes and failure reasons. Supports excluding external links and respecting robots.txt exclusions.

Instructions

Check all links on a single HTML page for broken links. Returns detailed information about each link found including broken status, HTTP status codes, and reasons for failure.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesThe URL of the page to check for broken links
excludeExternalLinksNoIf true, only check internal links (default: false)
honorRobotExclusionsNoIf true, respect robots.txt and meta robots tags (default: true)

Implementation Reference

  • index.js:26-56 (handler)
    The core handler function that performs the link checking on a single page using HtmlUrlChecker from the broken-link-checker library. It enqueues the URL, processes link results, and resolves with results and any errors.
    function checkPageLinks(url, options = {}) {
      return new Promise((resolve, reject) => {
        const results = [];
        const errors = [];
    
        const htmlChecker = new HtmlUrlChecker(options, {
          link: (result) => {
            results.push({
              url: result.url.resolved,
              base: result.base.resolved,
              html: {
                tagName: result.html.tagName,
                text: result.html.text,
              },
              broken: result.broken,
              brokenReason: result.brokenReason,
              excluded: result.excluded,
              excludedReason: result.excludedReason,
              http: {
                statusCode: result.http?.response?.statusCode,
              },
            });
          },
          complete: () => {
            resolve({ results, errors });
          },
        });
    
        htmlChecker.enqueue(url);
      });
    }
  • Input schema definition for the check_page_links tool, specifying the required 'url' parameter and optional boolean flags for link filtering and robot exclusion respect.
    inputSchema: {
      type: "object",
      properties: {
        url: {
          type: "string",
          description: "The URL of the page to check for broken links",
        },
        excludeExternalLinks: {
          type: "boolean",
          description:
            "If true, only check internal links (default: false)",
          default: false,
        },
        honorRobotExclusions: {
          type: "boolean",
          description:
            "If true, respect robots.txt and meta robots tags (default: true)",
          default: true,
        },
      },
      required: ["url"],
    },
  • index.js:103-129 (registration)
    Tool registration in the ListToolsRequestSchema handler, defining the tool's name, description, and input schema.
    {
      name: "check_page_links",
      description:
        "Check all links on a single HTML page for broken links. Returns detailed information about each link found including broken status, HTTP status codes, and reasons for failure.",
      inputSchema: {
        type: "object",
        properties: {
          url: {
            type: "string",
            description: "The URL of the page to check for broken links",
          },
          excludeExternalLinks: {
            type: "boolean",
            description:
              "If true, only check internal links (default: false)",
            default: false,
          },
          honorRobotExclusions: {
            type: "boolean",
            description:
              "If true, respect robots.txt and meta robots tags (default: true)",
            default: true,
          },
        },
        required: ["url"],
      },
    },
  • server.js:38-68 (handler)
    Identical core handler function for the HTTP/SSE server version, performing link checking using HtmlUrlChecker.
    function checkPageLinks(url, options = {}) {
      return new Promise((resolve, reject) => {
        const results = [];
        const errors = [];
    
        const htmlChecker = new HtmlUrlChecker(options, {
          link: (result) => {
            results.push({
              url: result.url.resolved,
              base: result.base.resolved,
              html: {
                tagName: result.html.tagName,
                text: result.html.text,
              },
              broken: result.broken,
              brokenReason: result.brokenReason,
              excluded: result.excluded,
              excludedReason: result.excludedReason,
              http: {
                statusCode: result.http?.response?.statusCode,
              },
            });
          },
          complete: () => {
            resolve({ results, errors });
          },
        });
    
        htmlChecker.enqueue(url);
      });
    }
  • Input schema for check_page_links tool in the server.js version, matching the stdio version.
    inputSchema: {
      type: "object",
      properties: {
        url: {
          type: "string",
          description: "The URL of the page to check for broken links",
        },
        excludeExternalLinks: {
          type: "boolean",
          description:
            "If true, only check internal links (default: false)",
          default: false,
        },
        honorRobotExclusions: {
          type: "boolean",
          description:
            "If true, respect robots.txt and meta robots tags (default: true)",
          default: true,
        },
      },
      required: ["url"],
    },
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It describes the operation (checking links for broken status) and the return format (detailed information about each link), but doesn't mention important behavioral aspects like rate limits, timeout behavior, authentication requirements, or what constitutes a 'broken' link. It adds some value but leaves significant gaps.

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?

The description is perfectly concise with two sentences that each earn their place: the first states the core functionality, and the second describes the return format. There's no wasted language, and the information is front-loaded with the primary purpose.

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

Completeness3/5

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

Given no annotations and no output schema, the description provides basic operational context but lacks important details about the tool's behavior, error handling, and return format specifics. For a tool that performs network operations and returns complex results, more information about limitations, performance characteristics, and output structure would be beneficial.

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?

The schema description coverage is 100%, so all parameters are well-documented in the schema itself. The description doesn't add any parameter-specific information beyond what's already in the schema descriptions, so it meets the baseline for high schema coverage without providing additional semantic context.

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?

The description clearly states the specific action ('check all links on a single HTML page for broken links') and distinguishes it from the sibling tool 'check_site' by specifying it's for a single page rather than an entire site. It includes both the verb ('check') and resource ('links on a single HTML page') with precise scope.

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

Usage Guidelines4/5

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

The description provides clear context about what the tool does (single page link checking), which implicitly differentiates it from the sibling 'check_site' tool that presumably checks an entire site. However, it doesn't explicitly state when to use this tool versus 'check_site' or provide any exclusion criteria.

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/davinoishi/broken-link-checker-mcp'

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