Skip to main content
Glama

apply_transactional_patch

Apply a candidate patch in a snapshot-backed workspace transaction, verify anti-reward-hacking rules, run an optional test command, and roll back byte-exact via SHA-256 if validation fails.

Instructions

Apply a candidate patch inside a snapshot-backed workspace transaction, verifying RH001–RH008 and running an optional test command with automatic byte-exact SHA-256 rollback on failure.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "workspace_root": "<workspace_root>"
    },
    "name": "apply_transactional_patch"
  }
}

Input Schema

NameRequiredDescriptionDefault
test_commandNoOptional command list (e.g. ['pytest', '-q']) to verify the patch.
unified_diffNoOptional unified diff string.
patched_filesNoMapping of {rel_path: new_source_code}.
workspace_rootYesWorkspace directory path.
suspects_consideredNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.1.0

TDQS

B3.2/5.0
Behavior3/5

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

With no annotations, the description carries the full behavioral burden, and it does disclose meaningful traits: snapshot-backed transactionality, RH001–RH008 checks, and byte-exact SHA-256 rollback on failure. That rollback guarantee is genuinely valuable. However, it omits key operational behavior: what the tool returns, whether the transaction is atomic across multiple files, how a rule violation surfaces to the caller, and any permissions or rate considerations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single dense sentence, front-loaded with the core action and followed by the transactional and rollback guarantees. No wasted words, though the density of jargon (RH001–RH008, byte-exact SHA-256) could be unpacked slightly for readability.

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

Completeness3/5

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

For a mutating, transaction-scoped tool with five parameters, no annotations, and no output schema, this leaves real gaps: return behavior, how rule-check failures are reported, and the diff-vs-files input choice are all unaddressed. The rollback disclosure is a strong start but insufficient on its own for a write-path tool.

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?

Schema coverage is 80%, so the baseline is 3; the description only restates the optional test command already documented in the schema. Critically, it does not clarify the relationship between the two mutually exclusive patch-input paths (unified_diff vs patched_files) or explain the undocumented suspects_considered parameter, which are the semantics an agent most needs.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description gives a specific verb and resource ('Apply a candidate patch') plus a scoped execution context ('snapshot-backed workspace transaction'), which is concrete enough to distinguish an apply operation from read-only siblings like verify_patch_integrity or audit_unified_diff. However, it does not explicitly name or route against those siblings, and its mention of verifying RH001–RH008 partially overlaps with what a verification tool might do, leaving a small ambiguity.

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

Usage Guidelines2/5

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

There is no explicit when-to-use or when-not-to-use guidance, and no alternative is named. The word 'optional' on the test command hints at a usage mode but does not tell an agent when to choose this tool over verify_patch_integrity or audit_unified_diff, nor what preconditions must hold.

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