Skip to main content
Glama

get-docs

Retrieve complete documentation content for specific routes, including code examples, detailed explanations, and API references to support development with pdfdancer.

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

  • The handler function for the 'get-docs' tool. It fetches the documentation content for the specified route using the callApi helper and returns both a formatted JSON block and the raw markdown content, along with structured data.
    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 }; }
  • src/index.ts:266-296 (registration)
    Registers the 'get-docs' tool on the MCP server, providing title, description, input schema validation, and the 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 }; } );
  • Input schema for the 'get-docs' tool using Zod validation to ensure the route starts with '/'.
    inputSchema: { route: z.string().regex(/^\/.*/, 'route must start with /') }
  • TypeScript interface defining the structure of the API response used by the get-docs handler.
    interface ContentResponse extends JsonObject { route: string; content: string; metadata?: Record<string, unknown>; }
  • Helper function used by the get-docs handler to make API requests to the documentation backend, handling URL construction, query params, fetch, error handling, and JSON parsing.
    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}`); } }

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