Skip to main content
Glama

fetch_docs

Retrieve documentation content from Tambo's technical documentation site by specifying the path to access specific technical resources and information.

Instructions

Fetch documentation content from docs.tambo.co

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesThe documentation path to fetch (e.g., /concepts/components)

Implementation Reference

  • The core handler function that fetches documentation from docs.tambo.co for the given path, parses HTML with cheerio, extracts title and content, caches the result, and returns it as CallToolResult.
    async fetchDocs(path: string): Promise<CallToolResult> { if (!path) { throw new Error('Path is required'); } const url = `https://docs.tambo.co${path}`; const cacheKey = `docs:${path}`; const cached = this.cache.get(cacheKey); if (cached && Date.now() - cached.timestamp < 10 * 60 * 1000) { return cached.content; } try { const response = await fetch(url); if (!response.ok) { throw new Error(`Failed to fetch ${url}: ${response.status}`); } const html = await response.text(); const $ = cheerio.load(html); const title = $('h1').first().text().trim() || $('[data-title]').first().text().trim() || $('title').text().trim(); let contentElement = $('main').first(); if (contentElement.length === 0) { contentElement = $('article').first(); } if (contentElement.length === 0) { contentElement = $('.content, [data-content], .markdown-body').first(); } const content = contentElement.length > 0 ? contentElement.html() : ''; const cleanContent = content ? cheerio.load(content).text().replace(/\s+/g, ' ').trim() : 'No content found'; const result: CallToolResult = { content: [ { type: 'text', text: `# ${title}\n\nPath: ${path}\nURL: ${url}\n\n${cleanContent}`, }, ], }; this.cache.set(cacheKey, { content: result, timestamp: Date.now() }); return result; } catch (error) { throw new Error(`Failed to fetch documentation: ${error instanceof Error ? error.message : String(error)}`); } }
  • Defines the input schema for the fetch_docs tool: an object requiring a 'path' string.
    type: 'object', properties: { path: { type: 'string', description: 'The documentation path to fetch (e.g., /concepts/components)', }, }, required: ['path'], },
  • src/server.ts:35-48 (registration)
    Registers the fetch_docs tool in the ListTools response with name, description, and input schema.
    { name: 'fetch_docs', description: 'Fetch documentation content from docs.tambo.co', inputSchema: { type: 'object', properties: { path: { type: 'string', description: 'The documentation path to fetch (e.g., /concepts/components)', }, }, required: ['path'], }, },
  • src/server.ts:88-89 (registration)
    Dispatches calls to fetch_docs by invoking the docHandler.fetchDocs method in the CallTool request handler.
    case 'fetch_docs': return await this.docHandler.fetchDocs(args?.path as string);

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/kylegrahammatzen/tambo-mcp-server'

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