Skip to main content
Glama

llm_edit

Reduce code editing costs by routing reasoning to efficient models. Returns structured JSON instructions with exact old_string→new_string pairs for mechanical application during refactoring and bug fixes.

Instructions

Route code-edit reasoning to a cheap model and return exact edit instructions.

Instead of Opus reasoning about what to change (expensive), a cheap model
reads the files, figures out the edits, and returns JSON ``{file, old_string,
new_string}`` pairs that Claude can apply mechanically via the Edit tool.

**How to use the result**: After calling this tool, apply each edit instruction
using the Edit tool with the exact old_string → new_string pairs provided.

Best for: refactoring, bug fixes, adding small features to existing files.

Args:
    task: Natural-language description of what to change (e.g.
        "Add type hints to all public functions in router.py").
    files: List of file paths to read and include in the prompt.
        Relative paths are resolved from the current working directory.
        Files larger than 32 KB are truncated with a note.
    context: Optional conversation context to help the model understand the task.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
taskYes
filesYes
contextNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

With no annotations provided, the description carries full behavioral disclosure burden and excels: it notes the 32 KB file truncation limit, specifies relative path resolution from CWD, discloses the cheap model cost optimization, details the JSON output structure ({file, old_string, new_string}), and explains the required downstream integration with the Edit tool.

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?

Information is perfectly front-loaded and hierarchically organized: purpose statement → cost/mechanism explanation → integration instructions ('How to use the result') → applicability guidelines → parameter details. No sentences are redundant; every line addresses specific agent decision-making needs.

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 tool's complexity (multi-step workflow involving external model routing, file I/O, and required downstream Edit tool usage), the description is complete. It appropriately leverages the existence of an output schema by summarizing the key output structure without redundancy, and covers operational constraints (32KB limit, path resolution) that the schema and annotations fail to document.

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

Parameters5/5

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

The schema has 0% description coverage (only titles), but the description fully compensates by documenting all three parameters: 'task' includes an example ('Add type hints...'), 'files' explains path resolution and size constraints, and 'context' clarifies its conversational purpose. This is maximum value-add for the parameter schema.

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 opens with a specific action (route code-edit reasoning) and output (exact edit instructions), immediately clarifying the tool's role. It distinguishes from siblings by specifying this uses a 'cheap model' for cost efficiency rather than expensive reasoning, and targets code editing specifically versus general generation tasks like llm_generate.

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?

Provides explicit positive guidance ('Best for: refactoring, bug fixes, adding small features') and contrasts with an alternative approach ('Instead of Opus reasoning...'). However, it lacks explicit negative constraints or direct comparison to specific sibling tools like llm_code or llm_generate that might also handle code tasks.

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/ypollak2/llm-router'

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