Skip to main content
Glama

edit_leading_comment

Add, replace, or remove the leading comment block above a named symbol in source code. Use this to document or clean up function or class comments.

Instructions

Edit the contiguous leading-comment block above a named symbol. One tool covering three operations on the same comment block.

Supported values for op:

  • "add": Insert a new comment block above the symbol. Requires comment. Raises if a leading comment already exists and would be pushed down as a separate block.

  • "replace": Replace the existing leading comment block with comment; if no leading comment exists, inserts one. Requires comment.

  • "remove": Delete the existing leading comment block. comment is ignored.

The comment must include the language's comment marker (# for Python/Ruby/YAML/TOML, // or /* ... */ for JS/TS/C/C++/Go/Java, /** ... */ Javadoc for Java). Supports multi-line C-style block comments as a single contiguous run.

Use this when: You want to document, update, or delete a leading comment on a function/class/method. Don't use this when: You want a Python docstring (which lives inside the function body) -> use replace_docstring. You want to edit text inside the function body itself -> use replace_in_body.

Example: target="LRUCache.get", op="add", comment=" # Retrieve an item by key, returning None if absent"

target="LRUCache.get", op="replace",
comment="    # Retrieve an item from the cache"

target="LRUCache.get", op="remove"

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYes
targetYes
opYes
commentNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

No annotations provided, but the description fully explains the three operations, including error conditions (raises on 'add' if existing) and comment syntax requirements. Does not mention file system effects but that is implied.

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?

Well-structured with sections for operations, usage, and examples. Front-loaded with purpose. A bit lengthy but each sentence adds value.

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 tool's complexity (three operations, multiple parameters, error conditions), the description is thorough. Provides examples and covers all key aspects. Output schema likely covers return details.

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

Parameters4/5

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

The input schema has 0% description coverage, but the description compensates by detailing the 'op' enum values, the 'comment' parameter behavior per operation, and provides examples. Does not explicitly describe 'file_path' or 'target' but they are understandable from context.

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?

The description clearly states it edits the contiguous leading-comment block above a named symbol, and distinguishes itself from siblings like replace_docstring and replace_in_body by specifying different use cases.

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

Usage Guidelines5/5

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

Explicitly states when to use ('when you want to document, update, or delete a leading comment') and when not to use ('Don't use this when: ...') with named alternatives, providing clear guidance.

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/kambleakash0/agent-skills'

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