edit_leading_comment
Add, replace, or remove the leading comment block above a named function or class in your code.
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. Requirescomment."remove": Delete the existing leading comment block.
commentis 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
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | ||
| target | Yes | ||
| op | Yes | ||
| comment | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |