Skip to main content
Glama

node_patch_file

Atomically replace a target block in a remote UTF-8 file with new content, optionally enforcing a SHA-256 precondition to prevent concurrent overwrite.

Instructions

Atomically replace a target block inside a remote UTF-8 file on '@appliance', '@bastion', or a TargetNode with optional SHA-256 precondition check.

Input Schema

NameRequiredDescriptionDefault
nodeYesTarget node identifier ('@appliance', '@bastion', or TargetNode name).
tx_idNoOptional stable transaction id. Reuse retrieves the original operation and never replays ambiguous work.
targetYesExact substring/block to replace.
as_rootNoWrite with elevated sudo privileges on a Linux TargetNode.
remote_pathYesPath to the file on the remote node.
replacementYesReplacement content.
expected_sha256NoOptional SHA-256 precondition from node_read_file to prevent concurrent overwrite.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

B3.2/5.0
Behavior3/5

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

With no annotations at all, the description carries the full behavioral burden. It does valuable work by disclosing atomicity, the UTF-8 constraint, and the optional SHA-256 precondition that guards against concurrent overwrite. However, it omits critical failure semantics for a mutation: what happens if 'target' is not found, whether multiple matches are an error, and whether partial writes are possible on failure.

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 front-loaded sentence with no filler; the atomicity and precondition qualifiers are the most decision-relevant facts and appear early. Slight redundancy in re-listing the three node target strings, which the schema already enumerates.

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 seven-parameter mutating tool with no annotations and no output schema, the description covers the safety-relevant headline (atomic, precondition-checked) but leaves the agent guessing about match failure, permission requirements, and result reporting. It is adequate but short of what this operation's risk profile warrants.

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 description coverage is 100%, so all seven parameters, including tx_id idempotency and as_root sudo behavior, are already documented in the schema. The description only echoes the node-target values and the SHA-256 precondition, adding essentially no meaning beyond the structured fields. Baseline 3 applies.

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?

States a specific verb and resource ('Atomically replace a target block inside a remote UTF-8 file') and names the valid targets ('@appliance', '@bastion', or a TargetNode). It is clearly distinguishable from read-oriented siblings like node_read_file, though it never explicitly contrasts itself with node_exec or node_transfer, which could also mutate a remote file.

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 when-to-use or when-not-to-use guidance. The description never says to prefer this over node_transfer or node_exec (e.g. sed), nor does it state prerequisites such as the file already existing or the caller needing write access. The only usage signal is the implied 'replace a block atomically', which the agent must infer.

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