Skip to main content
Glama

apply_refactoring

Apply a refactoring pattern directly to a code target, modifying files. Use preview_refactoring beforehand to review changes.

Instructions

Apply a refactoring to the codebase.

This actually modifies files. Use preview_refactoring first to see what changes will be made. Changes can be reverted with git.

Args: refactoring: Name of the refactoring (e.g., 'extract-method') target: Target in language-native format (e.g., 'src/order.py::Order::calculate#L10-L15') params: Refactoring-specific parameters

Returns: TOON-formatted string with results of the applied refactoring.

Example: apply_refactoring( refactoring="rename-method", target="src/order.py::Order::calc_total", params={"new_name": "calculate_total"} )

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
refactoringYes
targetYes
paramsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

Annotations declare readOnlyHint=false and destructiveHint=false. The description adds that it 'actually modifies files' and that changes are revertible, clarifying the mutation behavior without contradiction.

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 concise with a clear structure: purpose, usage hint, parameter docs, return info, and a practical example. Every sentence adds value without redundancy.

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

Completeness5/5

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

Given the complexity and presence of an output schema, the description covers all essential aspects: what the tool does, when to use it, parameter details, and return format. It is self-contained and sufficient for correct invocations.

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

Parameters4/5

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

With 0% schema description coverage, the description provides meaningful examples and purpose for each parameter (e.g., 'Name of the refactoring (e.g., extract-method)' and target format). This compensates well for the schema's lack of documentation.

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 it applies a refactoring that modifies files, distinguishing it from 'preview_refactoring' which is for previewing. The verb 'Apply' and resource 'refactoring' are specific and unambiguous.

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

Usage Guidelines4/5

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

The description recommends using 'preview_refactoring first' and notes that changes can be reverted with git, providing clear context. It lacks explicit when-not-to-use scenarios but offers actionable guidance.

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/marshally/mcp-refactoring'

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