Skip to main content
Glama

Generate Code Comments Tool

generate-code-comments

Use this when the user supplies source code and asks to add inline comments, docblocks, docstrings, or code annotations. State-changing generation action: consumes AI credits, creates a generation, and returns commented code after authorization. Use browser guidance for file uploads.

Input Schema

NameRequiredDescriptionDefault
nameNoOptional custom name used to identify the commented code in generation history
filenameYesThe full file path of the file being commented (e.g., src/utils/helper.ts)
source_codeYesThe source code to add comments to

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.9/5.0
Behavior4/5

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

With readOnlyHint=false already signaling mutation, the description adds real value beyond annotations: it states the action consumes AI credits, creates a generation, and requires authorization before returning commented code. It also flags the file-upload path via browser guidance. It stops short of explaining where the output lands (response vs. generation history).

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?

Three sentences, front-loaded with the usage trigger and followed by the behavioral note. Every sentence carries information; no padding or restatement of the name.

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

Completeness4/5

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

For a three-parameter generation tool with full schema coverage and no output schema, the description covers the trigger, the cost/auth implications, and the return. The only gap is not specifying how the commented code is surfaced, but that is minor.

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 all three parameters (name, filename, source_code) are already documented in the schema. The description adds no parameter-level meaning, making the baseline 3 correct.

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

Purpose4/5

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

The description states a specific verb and resource ('add inline comments, docblocks, docstrings, or code annotations'), which clearly separates it from the code-tests, code-optimization, and documentation generators. It does not explicitly name or contrast with the nearest sibling (generate-code-documentation), so it falls short of a 5.

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

Usage Guidelines4/5

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

It gives a clear trigger condition: 'Use this when the user supplies source code and asks to add inline comments...'. There are no exclusions or named alternatives, but the context for invocation is unambiguous.

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.