Skip to main content
Glama

web_fetch

Fetch web content from URLs to retrieve HTML, JSON, or text data for processing and analysis within LLM applications.

Instructions

Alias of web.fetch

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYes
timeoutNo
max_bytesNo
headersNo

Implementation Reference

  • Core implementation of the webFetch function that executes the HTTP fetch logic with limits, content type detection, and response formatting for text or binary data.
    export async function webFetch(url: string) {
      const res = await fetchWithLimits(url, CONFIG.fetchTimeoutMs, CONFIG.maxFetchBytes);
      if (!res || !res.body) {
        return {
          finalUrl: url, status: res?.status || 0,
          contentType: res?.contentType || 'application/octet-stream',
          bodyText: null, bytesB64: null, fetchedAt: new Date().toISOString()
        };
      }
      const ct = (res.contentType || '').toLowerCase();
      const isText = ct.startsWith('text/') || ct.includes('html') || ct.includes('xml') || ct.includes('json');
      return {
        finalUrl: res.finalUrl || url, status: res.status,
        contentType: res.contentType,
        bodyText: isText ? res.body.toString('utf-8') : null,
        bytesB64: isText ? null : res.body.toString('base64'),
        fetchedAt: new Date().toISOString()
      };
    }
  • Zod schema defining the input parameters (url, optional timeout, max_bytes, headers) for the web_fetch tool.
    const webFetchShape = {
      url: z.string().url(),
      timeout: z.number().int().optional(),
      max_bytes: z.number().int().optional(),
      headers: z.record(z.string()).optional()
    };
  • src/server.ts:78-84 (registration)
    Registration of the 'web_fetch' MCP tool, providing a handler that calls the core webFetch function and formats the response.
    server.tool('web_fetch', 'Alias of web.fetch',
      webFetchShape, OPEN,
      async ({ url, timeout, max_bytes }) => {
        const res = await webFetch(url);
        return { content: [{ type: 'text', text: JSON.stringify(res) }] };
      }
    );
Behavior2/5

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

The description provides no behavioral information beyond what the single annotation (openWorldHint: true) already indicates. While annotations cover the open-world aspect, the description doesn't add any context about what this tool actually does (HTTP fetching), potential side effects, authentication needs, rate limits, or response behavior. For a tool with minimal annotations, the description carries almost no burden of behavioral disclosure.

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 extremely concise at just three words, with no wasted language or unnecessary elaboration. It's front-loaded with the essential information (that it's an alias), though that information is insufficient. From a pure conciseness perspective, it's maximally efficient.

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

Completeness1/5

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

Given a 4-parameter tool with 0% schema description coverage, no output schema, and minimal annotations, the description is completely inadequate. It doesn't explain what the tool does, how to use it, what parameters mean, or what to expect in return. The description fails to provide the minimal context needed for an AI agent to understand and use this tool effectively.

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

Parameters1/5

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

With 0% schema description coverage for 4 parameters, the description provides absolutely no information about parameter meanings or usage. It doesn't explain what 'url', 'timeout', 'max_bytes', or 'headers' do, nor does it provide context about format requirements, constraints, or typical values. The description fails completely to compensate for the schema's lack of parameter documentation.

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

Purpose2/5

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

The description 'Alias of web.fetch' is a tautology that restates the tool name without explaining what the tool actually does. It doesn't specify the verb (fetching/retrieving web content) or the resource (web resources via HTTP), nor does it distinguish this tool from its sibling 'web.fetch' which appears to be the same functionality. The description fails to communicate the tool's purpose beyond its naming.

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

Usage Guidelines1/5

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

The description provides absolutely no guidance on when to use this tool versus alternatives. It doesn't mention the sibling tool 'web.fetch' (which appears identical), nor does it differentiate from other web-related tools like 'web.read', 'web.search', or other server tools. There's no context about appropriate use cases, prerequisites, or exclusions.

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/khanhs-234/tool4lm'

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