Skip to main content
Glama

ai_docstring

Read-only

Add docstrings / doc comments to code — Add documentation comments to every function, method and class in a code snippet (purpose, params with types, returns, raised errors) in the right style for the language: Google/NumPy docstrings (Python), JSDoc/TSDoc, Javadoc, C# XML doc, GoDoc, rustdoc, PHPDoc, YARD. Returns the full documented code plus an offline check that every original code line is preserved in order (codeUnchanged=false lists altered lines). Params: code (required, max 8000 chars), language=auto|python|javascript|typescript|java|csharp|go|rust|php|ruby, style=auto|google|numpy|jsdoc|javadoc|... . Price: $0.008 USDC (Base, via x402).

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "code": "<code>"
    },
    "name": "ai_docstring"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYesSource code to document, e.g. function add(a, b) { return a + b }

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A3.7/5.0
Behavior4/5

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

Goes well beyond the annotations by disclosing the return payload, an offline verification step (codeUnchanged=false lists altered lines), a hard input limit of 8000 chars, and the $0.008 USDC x402 payment. It does not cover failure modes (unsupported language, oversized input, verification failure) or latency, so it is strong but not exhaustive.

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?

Front-loaded with the action and benefit in the first clause, and the rest is dense and mostly earns its place. The long enum enumerations and the trailing "javadoc|..." ellipsis add noise and make the style list look incomplete.

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?

With no output schema, describing the return value and the codeUnchanged check is exactly the right compensation, and the pricing and size limit are relevant context. The phantom language/style parameters, however, leave the agent with an inaccurate picture of how to invoke the tool.

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

Parameters2/5

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

The description adds real meaning for the one real parameter (code max 8000 chars), but it also advertises language=auto|python|... and style=auto|google|... parameters that do not exist in the input schema, which will lead an agent to attempt invalid calls. Despite 100% schema coverage, this schema/description mismatch lowers the score below the baseline.

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 ("Add docstrings / doc comments to code") plus the scope (every function, method and class) and the per-language comment conventions, which cleanly separates it from siblings like ai_explain_code, ai_code_review or ai_commit_message.

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?

Usage is strongly implied by the wording — you give it a snippet and get the same snippet documented — and the language/style list conveys what inputs are appropriate. However, it never states when to prefer this over ai_explain_code or ai_code_review, nor any exclusions, so the agent must infer routing.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources