replace_signature
Replaces a function signature or class header while preserving the body, enabling parameter, return type, or name changes without rewriting the implementation.
Instructions
Replace the signature of a function, or the header of a class, keeping
its body. Existing decorators, Java annotations and a C++ template <...> header stay unless new_signature has its own. Code that
read_symbol's signature starts with (a JS/TS const f =, a closure's
key, a TS declare, a Ruby private) is replaced when new_signature
starts with it, else kept. A method without a body keeps its ;.
Refused for a symbol with no signature, such as a variable.
Use this when: changing a function's parameters, return type or name. Don't use this when: the body changes too (replace_function), or one parameter is added or removed (add_parameter, remove_parameter).
Example: target="LRUCache.get" new_signature="def get(self, key, default=None):"
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"file_path": "<file_path>",
"target": "<target>",
"new_signature": "<new_signature>"
},
"name": "replace_signature"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| target | Yes | Function or method name as list_symbols lists it, dotted for nesting ('LRUCache.get'); overloads take parameter types ('A.m(int)'). | |
| file_path | Yes | Absolute path to the source or config file. | |
| new_signature | Yes | Everything from the start of the definition up to its body, as read_symbol(depth='signature') returns it (e.g. 'def get(self, key):', JS 'get(key, d)' without the '{'); indentation on its first line is ignored. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |