Skip to main content
Glama

Replace Symbol Body

replace_symbol_body
Destructive

Replace symbol bodies in code by specifying name path, relative path, and new body content to update function definitions and other symbol implementations.

Instructions

Replaces the body of the symbol with the given name_path.

The tool shall be used to replace symbol bodies that have been previously retrieved (e.g. via find_symbol). IMPORTANT: Do not use this tool if you do not know what exactly constitutes the body of the symbol.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
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.
bodyYesThe new symbol body. The symbol body is the definition of a symbol in the programming language, including e.g. the signature line for functions. IMPORTANT: The body does NOT include any preceding docstrings/comments or imports, in particular.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

Annotations provide readOnlyHint=false and destructiveHint=true, indicating this is a destructive mutation. The description adds valuable context beyond annotations: it clarifies the tool's intended workflow (use after retrieval via find_symbol) and provides a critical warning about understanding symbol body composition. However, it doesn't mention potential side effects, error conditions, or authentication requirements.

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

Conciseness5/5

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

The description is perfectly structured: a clear purpose statement followed by two focused guidance sentences. Every sentence earns its place - the first defines the action, the second provides usage context, and the third gives a critical warning. No wasted words or redundancy.

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

Completeness4/5

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

Given the destructive nature (destructiveHint=true), 3 required parameters, and presence of an output schema, the description provides good contextual coverage. It explains the tool's purpose, usage prerequisites, and includes an important warning. However, for a destructive mutation tool, it could benefit from more explicit information about what 'replaces' entails (overwrites vs merges) and potential consequences.

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?

With 100% schema description coverage, the schema already documents all three parameters thoroughly. The description adds minimal parameter-specific information beyond what's in the schema - it only references 'name_path' in the first sentence. No additional syntax, format, or constraint details are provided for the parameters.

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

Purpose5/5

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

The description clearly states the specific action ('Replaces the body of the symbol') and identifies the target resource ('symbol with the given name_path'). It distinguishes from sibling tools like 'rename_symbol' or 'replace_content' by focusing specifically on symbol body replacement rather than other modifications.

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

Usage Guidelines5/5

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

The description provides explicit guidance: 'The tool shall be used to replace symbol bodies that have been previously retrieved (e.g. via find_symbol)' and 'IMPORTANT: Do not use this tool if you do not know what exactly constitutes the body of the symbol.' This gives clear when-to-use context and prerequisites, though it doesn't explicitly mention alternatives.

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/chrisgreenx-ctrl/serena'

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