get-documentation
Retrieve full documentation content for Macroforge sections by title, ID, or partial matches. Supports single sections or arrays of sections for comprehensive documentation access.
Instructions
Retrieves full documentation content for Macroforge sections.
Supports flexible search by:
Title (e.g., "Debug", "Vite Plugin")
ID (e.g., "debug", "vite-plugin")
Partial matches
Can accept a single section name or an array of sections. After calling list-sections, analyze the use_cases and fetch ALL relevant sections at once.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| section | Yes | Section name(s) to retrieve. Supports single string or array of strings. |
Implementation Reference
- src/tools/index.ts:286-366 (handler)The main handler function that executes the 'get-documentation' tool. It resolves one or more section names using getSection (exact/partial match) or searchSections (fuzzy), handles chunked sections by returning the first chunk and listing additional ones, and formats the output as markdown text blocks.function handleGetDocumentation(args: { section: string | string[] }) { const sectionNames = Array.isArray(args.section) ? args.section : [args.section]; const results: string[] = []; for (const name of sectionNames) { const section = getSection(sections, name); if (section) { // Check if this is a chunked section if (section.is_chunked && section.chunk_ids && section.chunk_ids.length > 0) { // Get the first chunk const firstChunkId = section.chunk_ids[0]; const firstChunk = sections.find((s) => s.id === firstChunkId); if (firstChunk) { let result = `# ${section.title}\n\n${firstChunk.content}`; // Add list of other available chunks if (section.chunk_ids.length > 1) { const otherChunks = section.chunk_ids.slice(1); const chunkList = otherChunks .map((id) => { const chunk = sections.find((s) => s.id === id); return chunk ? `- \`${id}\`: ${chunk.title.replace(`${section.title}: `, '')}` : null; }) .filter(Boolean) .join('\n'); result += `\n\n---\n\n**This section has additional chunks available:**\n${chunkList}\n\nRequest specific chunks with \`get-documentation\` for more details.`; } results.push(result); } else { results.push(`# ${section.title}\n\nChunked content not found.`); } } else { // Regular section - return content directly results.push(`# ${section.title}\n\n${section.content}`); } } else { // Try fuzzy search const matches = searchSections(sections, name); if (matches.length > 0) { const match = matches[0]; // Handle chunked sections in fuzzy match too if (match.is_chunked && match.chunk_ids && match.chunk_ids.length > 0) { const firstChunk = sections.find((s) => s.id === match.chunk_ids![0]); if (firstChunk) { let result = `# ${match.title}\n\n${firstChunk.content}`; if (match.chunk_ids.length > 1) { const otherChunks = match.chunk_ids.slice(1); const chunkList = otherChunks .map((id) => { const chunk = sections.find((s) => s.id === id); return chunk ? `- \`${id}\`: ${chunk.title.replace(`${match.title}: `, '')}` : null; }) .filter(Boolean) .join('\n'); result += `\n\n---\n\n**This section has additional chunks available:**\n${chunkList}\n\nRequest specific chunks with \`get-documentation\` for more details.`; } results.push(result); } else { results.push(`# ${match.title}\n\n${match.content}`); } } else { results.push(`# ${match.title}\n\n${match.content}`); } } else { results.push(`Documentation for "${name}" not found.`); } } } return { content: [ { type: 'text' as const, text: results.join('\n\n---\n\n'), }, ], }; }
- src/tools/index.ts:104-117 (schema)Input schema definition for the 'get-documentation' tool, specifying that 'section' parameter can be a string or array of strings.inputSchema: { type: 'object', properties: { section: { anyOf: [ { type: 'string' }, { type: 'array', items: { type: 'string' } }, ], description: 'Section name(s) to retrieve. Supports single string or array of strings.', }, }, required: ['section'], },
- src/tools/index.ts:93-118 (registration)Tool metadata registration in the 'tools/list' response, including name, description, and input schema.{ name: 'get-documentation', description: `Retrieves full documentation content for Macroforge sections. Supports flexible search by: - Title (e.g., "Debug", "Vite Plugin") - ID (e.g., "debug", "vite-plugin") - Partial matches Can accept a single section name or an array of sections. After calling list-sections, analyze the use_cases and fetch ALL relevant sections at once.`, inputSchema: { type: 'object', properties: { section: { anyOf: [ { type: 'string' }, { type: 'array', items: { type: 'string' } }, ], description: 'Section name(s) to retrieve. Supports single string or array of strings.', }, }, required: ['section'], }, },
- src/tools/index.ts:216-217 (registration)Dispatch registration in the 'tools/call' handler switch statement, routing calls to the handleGetDocumentation function.case 'get-documentation': return handleGetDocumentation(args as { section: string | string[] });
- src/tools/docs-loader.ts:134-154 (helper)Helper function used by the handler for primary section lookup by exact or partial matching on ID or title.export function getSection(sections: Section[], query: string): Section | undefined { const normalizedQuery = query.toLowerCase().trim(); // Priority 1: Exact ID match (most specific) let match = sections.find((s) => s.id.toLowerCase() === normalizedQuery); if (match) return match; // Priority 2: Exact title match match = sections.find((s) => s.title.toLowerCase() === normalizedQuery); if (match) return match; // Priority 3: Partial ID match (query is substring of ID) match = sections.find((s) => s.id.toLowerCase().includes(normalizedQuery)); if (match) return match; // Priority 4: Partial title match (query is substring of title) match = sections.find((s) => s.title.toLowerCase().includes(normalizedQuery)); if (match) return match; return undefined; }