Skip to main content
Glama

Generate Documentation

generate_docs
Read-only

Generate accurate documentation for existing code by choosing docstring, README, or API reference style. Provide code and language to receive structured docs ready for review.

Instructions

Generate documentation for existing code.

Produces documentation in the requested style — inline docstrings, README content, or structured API reference.

IMPORTANT: Always review the returned documentation for accuracy.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesThe code to generate documentation for.
styleNoDocumentation style: 'docstring' for inline docs, 'readme' for a README section, 'api_reference' for structured API docs.docstring
languageYesProgramming language of the code.
max_tokensNoMax tokens override.
temperatureNoTemperature override.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeNoThe generated artefact (code, tests, documentation). None on failure.
errorNoHuman-readable error message. None on success.
successYesWhether the generation completed successfully.
metadataNoAuxiliary data: token usage, elapsed time, quality warnings, etc.
Behavior4/5

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

Annotations already mark the tool as readOnly, and the description adds a genuinely useful behavioral warning: 'Always review the returned documentation for accuracy.' This warns the agent that generated docs may be imperfect, which is valuable beyond the structured annotation.

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

Conciseness5/5

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

Three short, front-loaded sentences with no filler. The purpose comes first, the style options follow, and the important accuracy warning is isolated for emphasis.

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

Completeness5/5

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

Given the output schema, full schema coverage, and readOnly annotation, the description is complete. It establishes the input (existing code), the style choices, and the need for output review, leaving no critical gap for an agent to call it correctly.

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 carries the full parameter documentation. The description summarizes the style enum values, but this largely duplicates the schema rather than adding new semantic detail.

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

Purpose5/5

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

States a specific verb and resource: 'Generate documentation for existing code.' It names the distinct deliverables (docstrings, README, API reference), which clearly separates it from sibling tools like generate_tests, implement_code, or refactor_code.

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

Usage Guidelines3/5

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

The description gives clear context—use it for existing code and choose a documentation style—but it never explicitly states when to prefer this tool over siblings like generate_tests or refactor_code. There are no exclusions or alternative tool mentions.

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/shreyashp77/Llama-Bridge'

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