Skip to main content
Glama
TTTTTakumi

rea_patch_server

by TTTTTakumi

rea_patch_text_apply

Apply multi-language text and config patches with replace, regex, line, JSON, or INI operations, using dry-run previews, backups, and rollback for safe edits.

Instructions

对文本/代码文件打补丁(多语言通用)。

ops 按顺序执行,每一项: {"op": "replace", "old": "...", "new": "...", "count": n|None, "occurrence": n|None} 字符串精确替换;count=只替换前 n 次;occurrence=只替换第 n 次出现 {"op": "regex", "pattern": "...", "replace": "...", "flags": re 数值} 正则替换(全部命中) {"op": "line", "action": "replace|insert_before|insert_after|delete", "line": 行号(1-based), "content": "...", "expected": "可选行内容校验"} 行级操作 {"op": "json", "path": "a.b[0].c", "new_value": ..., "old_value": 可选预期校验} JSON 配置键值修改(保留缩进与编码) {"op": "ini", "section": "...", "key": "...", "new_value": "...", "expected_value": 可选预期校验} INI/CFG 配置键值修改(保留注释与格式)

安全网:自动备份 .reapat_txt_bak;全部 ops 先内存模拟,任一失败整批拒绝; 写盘后回读校验,失败自动从备份回滚;dry_run=true 只预览不写盘。

Input Schema

NameRequiredDescriptionDefault
opsYes
forceNo
dry_runNo
encodingNo
file_pathYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.1.0

TDQS

A3.8/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does so well: it discloses automatic backup to <file>.reapat_txt_bak, in-memory simulation of all ops with whole-batch rejection on any failure, post-write readback verification with rollback from backup, and dry_run preview semantics. It omits what `force` overrides and any permission/encoding caveats, which keeps it from a 5.

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?

The description is front-loaded with the one-line purpose, then the op table, then the safety-net paragraph, with no filler. The op table is long but every line corresponds to a genuine schema gap, so the length is earned.

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?

For a mutation tool with no annotations and no output schema, the description covers the essentials an agent needs: atomicity, backup, rollback, verification, and preview. The remaining gaps (`force`, `encoding`, and what a successful call reports back) are minor but real.

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 description coverage is 0%, so the description must compensate, and it does for the hardest part: the `ops` array items are untyped in the schema, and the description supplies the full op vocabulary (replace/regex/line/json/ini) with field meanings including count and occurrence. Two of five parameters, `force` and `encoding`, get no explanation at all, so it falls short of complete.

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 opening line names a specific verb and resource: patch text/code files, and adds scope ('多语言通用'). It implicitly separates this tool from the binary-oriented sibling rea_patch_apply by specifying text/code files, but it never names a sibling explicitly, so an agent must infer the split.

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 description explains how each op type behaves and that dry_run only previews, which implies usage for the common cases. However, it never states when to choose this tool over rea_patch_text_search, rea_patch_text_verify, or rea_patch_apply, nor when not to use it (e.g., binary files).

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