Skip to main content
Glama

file_patch

DestructiveIdempotent

Edit a single exact file fragment, check it against expected SHA-256, and return the diff and derived hash; create new files with a null hash and empty old text.

Instructions

Edit a single exact fragment; new files use null expected_sha256 and empty old. Returns diff and derived hash.

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": {
      "task_id": "<task_id>",
      "revision": "<revision>",
      "path": "<path>",
      "expected_sha256": "<expected_sha256>",
      "old": "<old>",
      "new": "<new>",
      "op_id": "<op_id>"
    },
    "name": "file_patch"
  }
}

Input Schema

NameRequiredDescriptionDefault
newYes
oldYes
pathYes
op_idYes
tokenNo
task_idYes
revisionYes
expected_sha256Yes

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

B3.2/5.0
Behavior3/5

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

Annotations already declare destructiveHint=true, idempotentHint=true and readOnlyHint=false, so the safety profile is covered. The description adds the return payload (diff and derived hash) and the new-file convention, but never states that a sha256 mismatch aborts the write or how concurrent edits are handled — important for a destructive mutation.

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?

Two short sentences with no filler; the core edit semantics come first and the new-file edge case follows. It is efficient, though the terseness is part of why required parameter detail is missing.

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?

An output schema exists, so explaining the diff and derived hash in prose is largely redundant and the description need not cover return values. However, for a destructive 8-parameter mutation with zero schema descriptions, the definition is too thin on concurrency, idempotency keys and failure modes to be fully self-sufficient.

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

Parameters2/5

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

Schema description coverage is 0% across 8 parameters, so the description carries the full burden and only clarifies expected_sha256 and old for the new-file case. task_id, revision, path, new, op_id and token receive no meaning at all, and the difference between revision and expected_sha256 is left ambiguous.

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?

"Edit a single exact fragment" names a specific verb (edit) and scope (a single exact fragment, implicitly in a file), which is more precise than a generic update. It does not explicitly contrast with siblings such as file_read, but the patch/fragment framing is distinctive enough to select on.

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

Usage Guidelines3/5

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

The clause "new files use null expected_sha256 and empty old" gives one concrete when-to-use condition and a prerequisite setup. Beyond that there is no guidance on when to prefer full-file writes, how to handle a stale hash, or what to do on revision conflicts.

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