replace_docstring
Add or update Python docstrings for functions and classes without modifying the code body. This tool works exclusively with Python files by using AST-based editing to replace or insert documentation strings.
Instructions
Replace or insert a Python docstring on a function or class. Python-only. The new_docstring should be a valid Python string literal including its surrounding triple quotes.
Use this when: You want to add or update a Python docstring without touching
the function body.
Don't use this when: You're editing a # comment above the symbol -> use
replace_leading_comment. You're in a non-Python file -> no equivalent tool.
Example: target="LRUCache.get" new_docstring=(triple-quoted string, e.g. with three double-quotes before and after the summary text)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | ||
| target | Yes | ||
| new_docstring | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |