Skip to main content
Glama

replace_leading_comment

Updates or inserts the comment block above a function or class in code files, replacing existing leading comments with new text while maintaining proper syntax structure.

Instructions

Replace the contiguous leading comment block above a named symbol with new_comment. If no leading comment exists, inserts new_comment.

Use this when: You want to update the comment text above a function/class. Don't use this when: You only want to add a comment where none exists -> use add_comment_before.

Example: target="LRUCache.get" new_comment=" # Retrieve an item from the cache"

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYes
targetYes
new_commentYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

With no annotations provided, the description carries full burden and does well by explaining key behavioral traits: it handles both replacement of existing comments and insertion when none exists, clarifies what constitutes a 'contiguous leading comment block,' and implies file modification behavior. However, it doesn't mention error conditions, permissions, or whether changes are reversible.

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?

Perfectly structured with purpose statement, usage guidelines, and concrete example in three distinct parts. Every sentence adds value with zero redundancy. The information is front-loaded with the core functionality stated first.

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 mutation tool with 3 parameters, 0% schema coverage, and no annotations, the description does well by explaining purpose, usage, and providing an example. However, it doesn't explain what the output schema contains (though one exists), and behavioral aspects like error handling are omitted. The presence of an output schema reduces but doesn't eliminate the need for some return value context.

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?

Schema description coverage is 0%, so the description must compensate. It provides meaningful context for 'target' (named symbol like 'LRUCache.get') and 'new_comment' (the comment text to use), and the example illustrates both. However, 'file_path' parameter semantics are not explained beyond what the title suggests.

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 the specific action ('Replace the contiguous leading comment block') and resource ('above a named symbol'), and explicitly distinguishes it from sibling 'add_comment_before' by noting when not to use it. It provides a concrete example that reinforces the purpose.

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 'Use this when: You want to update the comment text above a function/class' and 'Don't use this when: You only want to add a comment where none exists -> use `add_comment_before`.' This provides clear when-to-use guidance and names the specific alternative tool.

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