Skip to main content
Glama
documentation.ts2.67 kB
import { z } from "zod"; /** * Documentation Generator Tool * Generates comprehensive project documentation */ export const generateDocumentationSchema = { name: "generate_documentation", description: "Analyzes the codebase and generates a structured documentation folder with Architecture, API, and Guide sections.", inputSchema: z.object({ projectPath: z.string().describe("Root path of the project"), outputDir: z .string() .optional() .default("docs") .describe("Output directory for documentation"), focus: z .enum(["all", "api", "architecture", "guides"]) .optional() .default("all"), }), }; export function generateDocumentationHandler(args: any) { const { projectPath, outputDir = "docs", focus = "all" } = args; // In a real implementation, this would read files. // For the prompt-based tool, we generate the structure and templates. const docs = []; if (focus === "all" || focus === "architecture") { const archDoc = `# System Architecture ## Overview High-level overview of the system design. ## Components - **Core**: Main logic and processing - **Tools**: MCP tool implementations - **Utils**: Helper functions ## Data Flow [User Input] -> [MCP Server] -> [Tool Execution] -> [Response] `; docs.push({ name: `${outputDir}/architecture.md`, content: archDoc }); } if (focus === "all" || focus === "api") { const apiDoc = `# API Reference ## Tools List of available MCP tools in this project. ### Cognitive Tools - \`plan_task\`: Task planning - \`sequential_thinking\`: Step-by-step reasoning ### File Tools - \`list_files\`: Directory listing - \`read_file_snippet\`: File reading *(This section would be auto-generated by scanning exports in a real runtime)* `; docs.push({ name: `${outputDir}/api.md`, content: apiDoc }); } if (focus === "all" || focus === "guides") { const guideDoc = `# meaningful Developer Guides ## Getting Started 1. Clone repository 2. Run \`npm install\` 3. Start server: \`npm start\` ## Contribution - Fork repo - Create branch - Submit PR `; docs.push({ name: `${outputDir}/guides.md`, content: guideDoc }); } const fileList = docs.map((d) => `- Created \`${d.name}\``).join("\n"); return { content: [ { type: "text", text: `# Documentation Generated\n\nGenerated ${docs.length} documentation files in \`${outputDir}\`.\n\n${fileList}\n\n*Note: In a full agentic loop, these files would be written to disk. Here is the preview.*`, // In a real tool, we might actually write the files or return them as artifacts artifacts: docs, }, ], }; }

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/millsydotdev/Code-MCP'

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