Skip to main content
Glama

get-docs

Retrieve complete documentation content for specific routes, including code examples, detailed explanations, and API references, after identifying relevant documentation through search.

Instructions

Retrieve the full documentation content for a specific route. After finding relevant documentation with search-docs, use this tool to get the complete markdown content including code examples, detailed explanations, and API references.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
routeYes

Implementation Reference

  • Handler function for the 'get-docs' tool. Takes a route parameter, calls the /content API endpoint, and returns markdown-formatted content blocks with the JSON data and full documentation text, plus structured content.
    async ({route}) => { const data = await callApi<ContentResponse>('/content', { searchParams: { route } }); return { content: [ { type: 'text' as const, text: formatJsonBlock(`Content for ${route}`, data) }, { type: 'text' as const, text: data.content } ], structuredContent: data }; }
  • Zod input schema for 'get-docs' tool, validating the 'route' parameter as a string starting with '/'.
    inputSchema: { route: z.string().regex(/^\/.*/, 'route must start with /') }
  • src/index.ts:266-296 (registration)
    Registration of the 'get-docs' tool with McpServer, including title, description, input schema, and inline handler function.
    server.registerTool( 'get-docs', { title: 'Get PDFDancer documentation', description: 'Retrieve the full documentation content for a specific route. After finding relevant documentation with search-docs, use this tool to get the complete markdown content including code examples, detailed explanations, and API references.', inputSchema: { route: z.string().regex(/^\/.*/, 'route must start with /') } }, async ({route}) => { const data = await callApi<ContentResponse>('/content', { searchParams: { route } }); return { content: [ { type: 'text' as const, text: formatJsonBlock(`Content for ${route}`, data) }, { type: 'text' as const, text: data.content } ], structuredContent: data }; } );
  • Helper function 'callApi' used by 'get-docs' handler to make HTTP GET requests to the documentation API endpoints, construct URLs, handle parameters, fetch, parse JSON, and throw errors on failure.
    async function callApi<T>(path: string, options: ApiRequestOptions = {}): Promise<T> { const url = new URL(path, apiBase); if (options.searchParams) { Object.entries(options.searchParams).forEach(([key, value]) => { if (value !== undefined && value !== null && value !== '') { url.searchParams.set(key, String(value)); } }); } const method = options.method ?? 'GET'; const init: RequestInit = { method, headers: { Accept: 'application/json', ...(options.body ? {'Content-Type': 'application/json'} : {}) } }; if (options.body && method === 'POST') { init.body = JSON.stringify(options.body); } const response = await fetch(url, init); const text = await response.text(); if (!response.ok) { throw new Error( `Request to ${url.toString()} failed with status ${response.status}: ${ text || response.statusText }` ); } if (!text) { return undefined as T; } try { return JSON.parse(text) as T; } catch (error) { throw new Error(`Failed to parse JSON response from ${url.toString()}: ${error}`); } }
  • Helper function 'formatJsonBlock' formats JSON payloads as markdown code blocks, used in the response content of 'get-docs'.
    function formatJsonBlock(title: string, payload: unknown): string { return `${title}\n\`\`\`json\n${JSON.stringify(payload, null, 2)}\n\`\`\``; }
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/MenschMachine/pdfdancer-mcp'

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