Skip to main content
Glama
bsmi021

Node Omnibus MCP Server

by bsmi021

create_documentation

Generate project documentation for Node.js applications, including README files, API documentation, and component documentation based on specified paths and types.

Instructions

Generate project documentation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesProject directory path
typeYesDocumentation type
nameNoComponent or API name for specific documentation

Implementation Reference

  • The main handler function implementing the create_documentation tool. It validates the path, generates documentation content based on the specified type (readme, api, or component), writes it to a file, stores it in memory, and returns a success message.
    private async handleCreateDocumentation(args: CreateDocumentationArgs) { await this.validatePath(args.path); try { let content = ''; let fileName = ''; switch (args.type) { case 'readme': content = await this.generateProjectDocumentation(args.path); fileName = 'README.md'; break; case 'api': content = await this.generateApiDocumentation(args.path); fileName = 'API.md'; break; case 'component': if (!args.name) { throw new McpError(ErrorCode.InvalidParams, 'Component name is required for component documentation'); } content = await this.generateComponentDoc(args.path, args.name); fileName = `${args.name}.md`; break; } const docPath = path.join(args.path, fileName); await fs.writeFile(docPath, content); // Store in memory for resource access this.projectDocs.set(path.basename(args.path), content); return { content: [ { type: 'text', text: `Documentation created successfully at ${docPath}`, }, ], }; } catch (error) { throw new McpError( ErrorCode.InternalError, `Failed to create documentation: ${error instanceof Error ? error.message : String(error)}` ); } }
  • src/index.ts:365-387 (registration)
    Tool registration in the ListToolsRequestSchema response, defining the name, description, and JSON input schema for the create_documentation tool.
    { name: 'create_documentation', description: 'Generate project documentation', inputSchema: { type: 'object', properties: { path: { type: 'string', description: 'Project directory path', }, type: { type: 'string', enum: ['readme', 'api', 'component'], description: 'Documentation type', }, name: { type: 'string', description: 'Component or API name for specific documentation', }, }, required: ['path', 'type'], }, },
  • TypeScript interface defining the shape of arguments for the create_documentation handler.
    interface CreateDocumentationArgs extends Record<string, unknown> { path: string; type: 'readme' | 'api' | 'component'; name?: string; }
  • src/index.ts:407-408 (registration)
    Dispatch case in the CallToolRequestSchema handler that routes calls to the create_documentation handler function.
    case 'create_documentation': return await this.handleCreateDocumentation(args as CreateDocumentationArgs);
  • Helper function that generates README-style project documentation by reading and formatting the package.json file.
    private async generateProjectDocumentation(projectPath: string): Promise<string> { const packageJson = JSON.parse( await fs.readFile(path.join(projectPath, 'package.json'), 'utf-8') ); return `# ${packageJson.name} ## Description ${packageJson.description || 'A Node.js project'} ## Installation \`\`\`bash npm install \`\`\` ## Scripts ${Object.entries(packageJson.scripts || {}) .map(([name, command]) => `- \`npm run ${name}\`: ${command}`) .join('\n')} ## Dependencies ${Object.entries(packageJson.dependencies || {}) .map(([name, version]) => `- \`${name}\`: ${version}`) .join('\n')} ## Dev Dependencies ${Object.entries(packageJson.devDependencies || {}) .map(([name, version]) => `- \`${name}\`: ${version}`) .join('\n')} `; }

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/bsmi021/mcp-node-omnibus-server'

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