Skip to main content
Glama

Serena

by oraios

replace_symbol_body

Modify the body of a specified symbol in code files automatically. Ensures correct indentation by aligning with the original symbol's structure, simplifying updates in large codebases.

Instructions

Replaces the body of the symbol with the given name_path.

Important: You don't need to provide an adjusted indentation, as the tool will automatically add the indentation of the original symbol to each line. For example, for replacing a method in python, you can just write (using the standard python indentation): body="def my_method_replacement(self, ...):\n first_line\n second_line...". So each line after the first line only has an indentation of 4 (the indentation relative to the first characted), since the additional indentation will be added by the tool. Same for more deeply nested cases. You always only need to write the relative indentation to the first character of the first line, and that in turn should not have any indentation. ALWAYS REMEMBER TO USE THE CORRECT INDENTATION IN THE BODY!.

Input Schema

NameRequiredDescriptionDefault
bodyYesThe new symbol body.
name_pathYesFor finding the symbol to replace, same logic as in the `find_symbol` tool.
relative_pathYesThe relative path to the file containing the symbol.

Input Schema (JSON Schema)

{ "properties": { "body": { "description": "The new symbol body.", "title": "Body", "type": "string" }, "name_path": { "description": "For finding the symbol to replace, same logic as in the `find_symbol` tool.", "title": "Name Path", "type": "string" }, "relative_path": { "description": "The relative path to the file containing the symbol.", "title": "Relative Path", "type": "string" } }, "required": [ "name_path", "relative_path", "body" ], "title": "applyArguments", "type": "object" }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/oraios/serena'

If you have feedback or need assistance with the MCP directory API, please join our Discord server