Skip to main content
Glama

web_extract_links

Extract all links from a webpage to analyze content structure, gather references, or compile resource lists for web development and research purposes.

Instructions

Extract all links from a webpage

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesURL to extract links from

Implementation Reference

  • The handler for the 'web_extract_links' tool, which fetches a URL's HTML, uses a regex to find all 'href' attributes starting with 'http', de-duplicates them, and returns up to 30 unique links.
    server.tool("web_extract_links", "Extract all links from a webpage", {
      url: z.string().url().describe("URL to extract links from")
    }, async ({ url }) => {
      const html = await safeFetchText(url);
      const links: string[] = [];
      const regex = /href=["']([^"']+)["']/gi;
      let match;
      while ((match = regex.exec(html)) !== null) {
        const href = match[1];
        if (href.startsWith("http")) links.push(href);
      }
      const unique = [...new Set(links)].slice(0, 30);
      return { content: [{ type: "text", text: `**Links from** ${url}\n\n${unique.map((l, i) => `${i + 1}. ${l}`).join("\n")}\n\nTotal: ${unique.length} unique links` }] };
    });
Behavior2/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 but fails to specify what constitutes a 'link' (anchor tags, images, scripts?), whether relative URLs are resolved to absolute, or what the output format/structure looks like.

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 a single, efficient sentence ('Extract all links from a webpage') that is appropriately front-loaded and sized for a tool with only one parameter. No extraneous information is present.

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 the low complexity (1 parameter, simple concept) and 100% schema coverage, the description is minimally adequate, though it lacks disclosure of return value structure which would be helpful given the absence of an output schema.

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?

Schema coverage is 100%, with the 'url' parameter fully documented in the schema as 'URL to extract links from'. The description adds no additional parameter semantics beyond what the schema provides, warranting the baseline score.

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

Purpose4/5

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

The description uses a specific verb ('Extract') and resource ('links' from 'webpage'), clearly stating what the tool does. However, it does not explicitly distinguish from sibling tool 'web_fetch' (which likely retrieves raw content), though the specificity of 'extract links' provides implicit differentiation.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'web_fetch' (for full content) or 'web_seo_check' (for SEO analysis), nor does it mention prerequisites or rate limit considerations.

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/ElromEvedElElyon/claw-mcp-toolkit'

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