Skip to main content
Glama

apply_edit

Apply edits to files using two modes: workspace edits for positional changes from rename/format, or text-match for find-and-replace without line positions. Use text-match when AI positions are imprecise.

Instructions

Apply an edit to a file. Two modes: (1) WorkspaceEdit mode — pass workspace_edit with positional changes returned by rename_symbol or format_document; (2) Text-match mode — pass file_path + old_text + new_text to find and replace text without needing line/column positions. Text-match tries exact match first, then whitespace-normalised line match (handles indentation differences). Use text-match when AI-generated positions would be imprecise.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workspace_editNo
file_pathNo
old_textNo
new_textNo
Behavior3/5

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

No annotations provided, so description carries full burden. Discloses matching strategy (exact then whitespace-normalised line match) and that it handles indentation differences. Lacks details on side effects, permissions, error handling, or what happens if both modes are used simultaneously.

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?

Five sentences, front-loaded with purpose. No redundant information. Every sentence contributes to understanding modes, parameters, or usage guidance. Efficient and well-structured.

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 no output schema and multiple modes, the description covers key aspects: mode selection, matching behavior, and parameter roles. Lacks mutual exclusivity clarification and error/return information, but is largely sufficient for an edit tool.

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?

Schema has 0% description coverage, so description must compensate. It explains workspace_edit is for positional changes from specific tools and that file_path, old_text, new_text are for text-match. However, the workspace_edit object structure remains unexplained (just 'additionalProperties: true'). Adds value beyond schema but could be richer.

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?

Clearly states 'Apply an edit to a file' and distinguishes two distinct modes (WorkspaceEdit, Text-match), naming specific use cases (rename_symbol, format_document). This differentiates it from sibling tools like simulate_edit.

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?

Explicitly recommends text-match mode 'when AI-generated positions would be imprecise' and implies WorkspaceEdit for positional changes from specific tools. Could be more explicit about avoiding mixed parameters, but guidance is clear.

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/blackwell-systems/agent-lsp'

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