Skip to main content
Glama

transaction_apply

Apply coordinated multi-file edits atomically with full validation and rollback, ensuring changes land as one unit or none at all.

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. Writes are crash-durable: each temp file is fsynced before its rename and every touched parent directory is fsynced before the call returns. Per-path locks prevent interleaving with other write tools. Use for refactors that must land as one unit (cross-file rename of a string, coordinated config + caller updates, etc.). Up to 50 operations per call. The response lists each file with a per-file unified diff (unless show_write_diff is disabled).

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.
Behavior5/5

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

With no annotations, the description fully carries the burden and does so excellently: atomicity, pre-validation against on-disk content, rollback of already-written files on partial failure, crash-durable fsync, per-path locking, and response format with diffs are all disclosed.

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?

Every sentence earns its place. The description front-loads the core purpose, then packs behavioral guarantees, usage guidance, limits, and response format into a dense, well-structured block with no filler.

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 of a multi-file transactional write tool and no output schema, the description is remarkably complete: it covers validation, failure modes, durability, concurrency, operation limits, and response contents. An agent can predict exact behavior before invoking.

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 coverage is 100%, so baseline is 3. The description adds meaningful operational context beyond the schema: it explains that all operations are validated first and no writes occur if any old_string is missing or ambiguous, and clarifies the rollback behavior. This goes beyond simply restating parameter names.

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?

Opens with a specific verb+resource+scope: 'Apply str_replace edits across multiple files atomically.' Clearly distinguishes from single-file edit tools like edit_file and whole-file write_file, and mentions concrete use cases like cross-file rename.

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 states when to use: 'Use for refactors that must land as one unit (cross-file rename of a string, coordinated config + caller updates, etc.)'. It implies single-file edits are better served by simpler tools but does not explicitly name them as alternatives; the sibling list and schema reference to edit_file provide context.

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

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