Skip to main content
Glama

SourceSync.ai MCP Server

by scmdr

fetchUrlContent

Retrieves and parses content from a specified URL to extract text data, enabling integration with AI models for knowledge management and analysis.

Instructions

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

Input Schema

NameRequiredDescriptionDefault
apiKeyNo
tenantIdNo
urlYes

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "apiKey": { "type": "string" }, "tenantId": { "type": "string" }, "url": { "format": "uri", "type": "string" } }, "required": [ "url" ], "type": "object" }

Implementation Reference

  • The core handler function for the fetchUrlContent tool. It extracts url, optional apiKey, and tenantId from params, creates a wretch HTTP client, adds authentication headers if provided, fetches the text content from the URL, and returns it wrapped in safeApiCall for error handling.
    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 the input parameters for the fetchUrlContent tool: required 'url' (validated as URL string), optional 'apiKey' and 'tenantId' (referencing predefined schemas).
    export const FetchUrlContentSchema = z.object({ url: z.string().url(), // Authentication might be needed for some SourceSync URLs apiKey: apiKeySchema, tenantId: tenantIdSchema, })
  • src/index.ts:735-765 (registration)
    Registers the fetchUrlContent tool on the MCP server using server.tool(), providing the name, description, input schema shape, 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}`) } }) }, )

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

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