replace_docstring
Add or replace Python module, class, function, or method docstrings at a named symbol target, using a quoted string literal for precise source edits.
Instructions
Replace or add the docstring of a Python function, method or class, or
of the module with target "". new_docstring must be one string literal
with its quotes; anything else (bare text, an f-string, bytes, an empty
value) is refused. A new docstring goes first in the body; the module's
goes below a #! line and encoding or header comments. A new docstring
for a body on its signature's line is refused (use
replace_function_body); so is any non-Python file.
Use this when: adding or updating a Python docstring.
Don't use this when: editing a # comment above the symbol
(edit_leading_comment).
Example: target="LRUCache.get" new_docstring='"""Return the cached value, or None."""'
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| target | Yes | Python function, method or class name, dotted for nesting (e.g. 'LRUCache.get'), or '' for the module. | |
| file_path | Yes | Absolute path to the source or config file. | |
| new_docstring | Yes | One Python string literal with its quotes, usually triple-quoted. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |