Skip to main content
Glama

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
NameRequiredDescriptionDefault
sectionYesSection name(s) to retrieve. Supports single string or array of strings.

Implementation Reference

  • 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'),
          },
        ],
      };
    }
  • 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'],
    },
  • 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'],
              },
            },
  • 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[] });
  • 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;
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It adds useful context about search flexibility (title, ID, partial matches) and batch processing capabilities (single or array inputs). However, it doesn't cover important aspects like response format, error handling, or performance considerations (e.g., rate limits), leaving gaps for a retrieval tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured and appropriately sized. It front-loads the core purpose, then details search methods, and ends with usage guidance. Each sentence adds value, though the search methods section could be slightly more concise. No wasted text, but minor room for tightening.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description is moderately complete for a retrieval tool. It covers purpose, search methods, and usage workflow adequately. However, it lacks details on return values (format, structure), error cases, or limitations, which are important for a tool with flexible input options and no structured output documentation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents the 'section' parameter thoroughly. The description adds marginal value by reiterating support for 'single string or array of strings' and mentioning search methods (title, ID, partial matches), but doesn't provide additional syntax, format details, or examples beyond what the schema specifies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Retrieves full documentation content for Macroforge sections.' It specifies the verb ('retrieves'), resource ('documentation content'), and scope ('Macroforge sections'). However, it doesn't explicitly differentiate from sibling tools like 'list-sections' or 'get-macro-info' beyond mentioning 'list-sections' in usage context.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use this tool: 'After calling list-sections, analyze the use_cases and fetch ALL relevant sections at once.' It suggests a workflow with 'list-sections' as a precursor and recommends batching fetches. However, it doesn't explicitly state when NOT to use it or name specific alternatives among siblings like 'get-macro-info'.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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/macroforge-ts/mcp-server'

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