edit_leading_comment
Add, replace, or remove a symbol's leading comment block, re-indented above decorators, annotations, exports, and template headers. Use it for doc comments, not Python docstrings or in-body comments.
Instructions
Add, replace or remove the comment block directly above a symbol, its
doc comment. The block sits above the symbol's decorators, annotations,
export and C++ template <...> header, and a new comment goes there,
re-indented to the symbol. A comment indented deeper than the symbol
ends the code above and is not part of the block. A symbol that other
code comes before on its line is refused. In YAML and TOML the target
is a key path or a TOML [table]; JSON has no comments and is refused.
Use this when: adding, rewriting or deleting a symbol's doc comment. Don't use this when: writing a Python docstring (replace_docstring) or a comment inside a body (insert_in_body, replace_in_body).
Example: target="LRUCache.get", op="add", comment="# Return the cached value."
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| op | Yes | 'add' inserts a comment, refused when the symbol has one (the error quotes it: use 'replace' with a block that repeats lines to keep, such as lint directives); 'replace' replaces the block, or adds one; 'remove' deletes it. Other values are refused. | |
| target | Yes | Symbol name as list_symbols lists it, dotted for nesting ('LRUCache.get'), or a YAML/TOML key path from the top level or TOML [table] name ('tool.uv'). | |
| comment | No | Comment text with its markers ('# note', '// note', '/** ... */'); required for 'add' and 'replace', ignored for 'remove'. | |
| file_path | Yes | Absolute path to the source or config file. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |