Skip to main content
Glama
atengk
by atengk

sftp_patch_file

Atomically replaces a target text block in a remote file via SFTP using anchor-based matching, preventing full-file overwrites and line number drift.

Instructions

对远程大文本文件实施精准锚点文本块原子化替换,杜绝整文件覆写与行号漂移风险

Input Schema

NameRequiredDescriptionDefault
remotePathYes远程文件绝对路径(必须以 '/' 开头)
connectionIdNo目标连接标识符,缺省时使用当前默认连接
allowMultipleNo当目标文本块在文件中存在多处匹配时是否全部替换,默认 false(要求唯一匹配以防误伤)
targetContentYes待在远程文件中寻找并替换的精确目标文本块
replacementContentYes替换后的新文本内容

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.4.1

TDQS

A3.6/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 disclosure burden. It usefully discloses atomicity and the avoidance of line-number drift and full rewrites, but says nothing about permissions, failure behavior when the target is not found, or whether changes are reversible.

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?

A single dense sentence that front-loads the core operation (atomic anchor-based replacement) followed by the risk it avoids. No filler, nothing redundant.

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

Completeness4/5

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

Given complete schema coverage and no output schema, the description covers the tool's nature and its key differentiator (no line-number drift). It remains thin on mutation-side behavior such as error handling, but for a patch tool with a fully documented schema it is largely sufficient.

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 the schema already documents all five parameters including allowMultiple's unique-match default. The description's phrase '锚点文本块' loosely maps to targetContent but adds no format or matching semantics beyond the schema, so 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?

The description states a specific verb and resource: atomic, anchor-based replacement of text blocks in remote large text files. It implicitly differentiates from the whole-file-overwrite sibling (sftp_write_file) via '杜绝整文件覆写', but does not name an alternative tool explicitly.

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?

Usage is only implied: target edits to large files without rewriting the whole file. There is no explicit when-to-use versus sftp_write_file/sftp_read_file, and no mention of prerequisites such as needing an existing connection.

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