Skip to main content
Glama

transaction_apply

Apply multi-file edits atomically: every replacement is validated before any write, and partial failures roll back to keep refactors consistent.

Instructions

Apply str_replace edits across multiple files atomically. Every operation is validated against the on-disk content first; if any old_string is missing or ambiguous, NO files are written. If writes start succeeding but one fails partway, the already-written files are rolled back to their pre-transaction content. Per-path locks prevent interleaving with other write tools. Use for refactors that must land as one unit. Up to 50 operations per call; the response lists each file with a unified diff unless show_write_diff is off.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dirty_okNoAllow editing files that have uncommitted changes in their git repository. Default false — the transaction is refused if any target file is dirty. Pass true to proceed anyway.
operationsNoOrdered list of per-file edit groups. Every file is validated first; only if all validate do any writes happen.
await_diagnosticsNoWhen true, wait for the language server to re-analyse each written file and append a labelled per-file diagnostics block with a machine-readable 'diagnostics delta' line. Default false.
fail_on_new_errorsNoWhen true (implies await_diagnostics), roll the WHOLE transaction back if any written file is CONFIRMED to have gained new errors — all-or-nothing. An unconfirmed check never rolls back; nor do warnings or pre-existing errors. Default false.

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. Changed2 schema fields changedv0.17.0
    • addedInput schema / properties / await_diagnostics
      Added value: +{
      +  "description": "When true, wait for the language server to re-analyse each written file and append a labelled per-file diagnostics block with a machine-readable 'diagnostics delta' line. Default false.",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / fail_on_new_errors
      Added value: +{
      +  "description": "When true (implies await_diagnostics), roll the WHOLE transaction back if any written file is CONFIRMED to have gained new errors — all-or-nothing. An unconfirmed check never rolls back; nor do warnings or pre-existing errors. Default false.",
      +  "type": "boolean"
      +}
  2. First observedv0.16.6

TDQS

A4.7/5.0
Behavior5/5

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

The description thoroughly explains the behavior: validation against on-disk content, all-or-nothing write semantics, rollback on partial failure, and locking. Since no annotations are provided, the description carries full responsibility for transparency, and it does so completely without contradictions.

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, using three sentences to convey purpose, behavior, and usage context. It is well-structured and free of redundancy, with each sentence contributing essential information.

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?

The description covers the core aspects: what the tool does, how it ensures atomicity, the locking mechanism, and the intended use case. It also mentions the 50-operation limit. Since no output schema is present, explaining return values is not required, and the description is complete for an agent to decide and invoke correctly.

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?

The schema already provides 100% coverage of parameter descriptions, so the baseline is 3. The description does not add further semantic meaning to the parameters; it mentions atomicity and locking but does not elaborate on await_diagnostics or fail_on_new_errors beyond what the schema states. Thus no extra value is added.

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 action (apply str_replace edits), the resource (multiple files), and the key property (atomically). It also distinguishes this tool from others by mentioning per-path locks and the use case for refactors that must land as one unit, making it easy to tell apart from sibling tools like edit_file or write_file.

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 explicitly states when to use this tool: 'Use for refactors that must land as one unit.' It also contrasts with other write tools by noting per-path locks prevent interleaving, implying it is preferred for multi-file atomic operations. This gives clear guidance on selection.

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

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/plumbkit/plumb'

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