Skip to main content
Glama
Raheem-19

Serena MCP Server

by Raheem-19

replace_symbol_body

Update a symbol's implementation by providing its name path, file path, and new body. Locates the symbol and substitutes its body with the given code.

Instructions

Replaces the body of the symbol with the given name_path.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bodyYesThe new symbol body. Important: Begin directly with the symbol definition and provide no leading indentation for the first line (but do indent the rest of the body according to the context).
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.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

There are no annotations, so the description carries the full burden. It states 'replaces' (a mutation), but provides no disclosure about irreversibility, whether the symbol must exist, or any side effects. It does not mention that the body must be indented correctly (though the schema covers that). This is a significant gap for a destructive operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence and relatively concise. However, the phrasing is awkward and could be clearer (e.g., 'Replaces the body of the symbol identified by `name_path` with the provided `body`'). It earns its place but not exemplary.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

This is a mutation tool with no annotations and only a terse description. It lacks essential context about how name_path relates to find_symbol (though schema mentions it), what happens if the symbol is not found, and whether the operation is reversible. The output schema exists but does not compensate for these gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the parameters are already well-documented. The description adds nothing beyond what the schema provides, including the meaning of name_path and body. Baseline of 3 is appropriate because the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb ('Replaces') and identifies the resource ('body of the symbol') with a lookup mechanism ('name_path'). It distinguishes from sibling tools like insert_before_symbol/insert_after_symbol (which insert) and replace_regex (which replaces via regex). The phrase 'with the given `name_path`' is slightly ambiguous but contextually implies the symbol identified by name_path.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use this tool versus alternatives. It does not mention cases where replace_regex or insert_* would be more appropriate, nor any prerequisites like needing to find_symbol first. The intended usage is only implied by the tool's name.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

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/Raheem-19/serena-optimized'

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