Skip to main content
Glama

fetchUrlContent

Retrieve and parse content from web URLs to organize information in knowledge bases. This tool extracts text from specified URLs for content management and search purposes.

Instructions

Fetches the content of a URL. Particularly useful for fetching parsed text file URLs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYes
apiKeyNo
tenantIdNo

Implementation Reference

  • Handler function that fetches the content from the given URL using wretch HTTP client, supports optional API key authentication and tenant ID header.
    async (params: FetchUrlContentParams) => {
      return safeApiCall(async () => {
        const { url, apiKey, tenantId } = params
    
        try {
          // Create a wretch client with authentication if provided
          let client = wretch(url)
    
          if (apiKey) {
            client = client.auth(`Bearer ${apiKey}`)
          }
    
          if (tenantId) {
            client = client.headers({
              'X-Tenant-ID': tenantId,
            })
          }
    
          // Fetch the content from the URL
          const content = await client.get().text()
          return { content }
        } catch (error: any) {
          throw new Error(`Error fetching URL content: ${error.message}`)
        }
      })
    },
  • Zod schema defining input parameters: url (required), optional apiKey and tenantId.
    export const FetchUrlContentSchema = z.object({
      url: z.string().url(),
      // Authentication might be needed for some SourceSync URLs
      apiKey: apiKeySchema,
      tenantId: tenantIdSchema,
    })
    
    export type FetchUrlContentParams = z.infer<typeof FetchUrlContentSchema>
  • src/index.ts:735-765 (registration)
    Registers the fetchUrlContent tool on the MCP server with description, input schema, and inline handler function.
    server.tool(
      'fetchUrlContent',
      'Fetches the content of a URL. Particularly useful for fetching parsed text file URLs.',
      FetchUrlContentSchema.shape,
      async (params: FetchUrlContentParams) => {
        return safeApiCall(async () => {
          const { url, apiKey, tenantId } = params
    
          try {
            // Create a wretch client with authentication if provided
            let client = wretch(url)
    
            if (apiKey) {
              client = client.auth(`Bearer ${apiKey}`)
            }
    
            if (tenantId) {
              client = client.headers({
                'X-Tenant-ID': tenantId,
              })
            }
    
            // Fetch the content from the URL
            const content = await client.get().text()
            return { content }
          } catch (error: any) {
            throw new Error(`Error fetching URL content: ${error.message}`)
          }
        })
      },
    )
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. It mentions fetching content, which implies a read operation, but lacks details on permissions (e.g., whether 'apiKey' or 'tenantId' are required for access), rate limits, error handling, or what the returned content includes (e.g., raw HTML, parsed text). This leaves significant gaps for a tool with three parameters.

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 highly concise with two sentences that are front-loaded and waste no words. Every phrase adds value, such as specifying the tool's focus on parsed text files, making it efficient and well-structured.

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

Completeness2/5

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

Given the complexity of a tool with three parameters, no annotations, and no output schema, the description is incomplete. It doesn't cover key aspects like authentication needs, return format, error cases, or how it differs from sibling tools, leaving the agent with insufficient information for reliable use.

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

Parameters2/5

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

The schema description coverage is 0%, so the description must compensate for three undocumented parameters. It only mentions 'URL' implicitly and adds context for 'parsed text file URLs,' but doesn't explain the purpose of 'apiKey' or 'tenantId,' their relationships, or any constraints. This fails to adequately clarify parameter meanings beyond the basic schema.

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 clearly states the tool's purpose with a specific verb ('fetches') and resource ('content of a URL'), and adds a helpful detail about parsed text files. However, it doesn't explicitly differentiate from sibling tools like 'fetchDocuments' or 'ingestUrls', which appear related but have different functions.

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 minimal guidance with 'Particularly useful for fetching parsed text file URLs,' which implies a preferred context but doesn't specify when to use this tool versus alternatives like 'fetchDocuments' or 'ingestUrls' from the sibling list. No explicit when-not-to-use or prerequisite information is given.

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/sitegpt/sourcesyncai-mcp'

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