Skip to main content
Glama

docs_generate_api

Generate API documentation from code annotations like JSDoc and Docstrings for multiple programming languages, creating structured documentation files for your project.

Instructions

Generate API documentation from code (JSDoc, Docstrings, etc.)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectPathYesPath to the project source code
outputPathYesOutput path for API documentation
languageYesProgramming language

Implementation Reference

  • The main handler function that executes the tool logic by returning language-specific instructions for generating API documentation.
    export async function generateApi(args: any) { const { projectPath, outputPath, language } = args as GenerateApiArgs; const instructions: Record<string, string> = { typescript: `πŸ“– TypeScript API Documentation: 1. Install TypeDoc: npm install --save-dev typedoc 2. Generate API docs: npx typedoc --out ${outputPath} ${projectPath} 3. For integration with Docusaurus: npm install --save-dev docusaurus-plugin-typedoc`, javascript: `πŸ“– JavaScript API Documentation: 1. Install JSDoc: npm install --save-dev jsdoc 2. Generate API docs: npx jsdoc -c jsdoc.json -d ${outputPath} ${projectPath} 3. Use JSDoc comments: /** * Description * @param {string} param - Parameter description * @returns {Promise<void>} */`, python: `πŸ“– Python API Documentation: 1. For Sphinx: pip install sphinx sphinx-autodoc 2. Generate API docs: sphinx-apidoc -o ${outputPath} ${projectPath} 3. For MkDocs: pip install mkdocstrings mkdocstrings-python Add to mkdocs.yml: plugins: - mkdocstrings: handlers: python: options: docstring_style: google`, go: `πŸ“– Go API Documentation: 1. Use godoc: godoc -http=:6060 2. Or generate static docs: go doc -all > ${outputPath}/api.md`, rust: `πŸ“– Rust API Documentation: 1. Generate docs: cargo doc --no-deps 2. Open in browser: cargo doc --no-deps --open 3. Output is in target/doc`, }; const instruction = instructions[language] || "Language not supported for API generation"; return { content: [ { type: "text", text: instruction, }, ], }; }
  • TypeScript interface defining the input arguments for the generateApi function.
    interface GenerateApiArgs { projectPath: string; outputPath: string; language: string; }
  • src/index.ts:110-132 (registration)
    Registration of the 'docs_generate_api' tool in the tools array, including name, description, and input schema.
    { name: "docs_generate_api", description: "Generate API documentation from code (JSDoc, Docstrings, etc.)", inputSchema: { type: "object", properties: { projectPath: { type: "string", description: "Path to the project source code", }, outputPath: { type: "string", description: "Output path for API documentation", }, language: { type: "string", description: "Programming language", enum: ["typescript", "javascript", "python", "go", "rust", "java", "csharp"], }, }, required: ["projectPath", "outputPath", "language"], }, },
  • src/index.ts:306-307 (registration)
    Dispatch in the switch statement that calls the generateApi handler.
    case "docs_generate_api": return await generateApi(args);

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/ThaLoc0one/documentation-mcp-server'

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