Skip to main content
Glama
mcp-sjis-server

mcp-sjis-server

by fukumen

sjis_patch

Replace text or apply V4A update patches in Shift JIS/CP932 files, returning diffs for verification. Use it for precise string edits where sed/awk is less suited.

Instructions

Shift JIS/CP932 ファイル内のテキストを置換します。terminal の sed/awk の代わりに使用してください。長い文字列や複雑な置換に適しています。変更結果の diff を返します。

REPLACE MODE (mode='replace', デフォルト): ファイル内の一意の文字列を検索し、置換します。REQUIRED PARAMETERS: path, oldText, newText.

注意: oldText はファイル内の文字列をそのまま指定してください。oldText / newText 内の行末コード(CR/LF/CRLF)は文字として扱われ、行としての制御は行いません(正規化・変換なし)。複数箇所で一致した場合はエラーになります。すべて置き換える場合は replaceAll: true、一部のみ置き換える場合は oldText に前後の文脈を含めてファイル内で一意にしてください。

PATCH MODE (mode='patch'): V4A マルチファイルパッチを適用します。REQUIRED PARAMETERS: mode, patch.

hunk 内の行末コード(CR/LF/CRLF)は行の区切りとして機能し、自由に混在できます。書いたとおりに old/new に反映されます(変換・正規化はしません)。@@ 行は hunk の開始を示すマーカーです(省略可能。内容はマッチに使用されません)。

注意: PATCH MODE は 'Update File' 操作のみをサポートします。'Add File', 'Delete File', 'Move File' は未対応です。

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "sjis_patch"
  }
}

Input Schema

NameRequiredDescriptionDefault
modeNo編集モード。'replace' (デフォルト): 文字列置換。'patch': V4Aマルチファイルパッチ
pathNoファイルの絶対パス (replace mode用)
patchNoV4Aフォーマットパッチコンテンツ(patch mode用)。フォーマット: *** Begin Patch *** Update File: /absolute/path/to/file @@ context hint @@ context line -removed line +added line *** End Patch
newTextNo置換後の文字列 (UTF-8) (replace mode用)
oldTextNo置換前の文字列 (UTF-8) (replace mode用)
replaceAllNotrueの場合、すべての一致箇所を置換 (replace mode用, デフォルト: false)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.1.0

TDQS

A4.1/5.0
Behavior4/5

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

With no annotations at all, the description carries the full burden and does well: it discloses that the tool mutates the file and returns a diff of the changes, that a non-unique match is an error, that CR/LF/CRLF are treated as literal characters in replace mode but as line separators in patch mode, and that patch mode cannot add/delete/move files. It stops short of stating whether backups are made, whether the write is atomic, or what happens if the target file is not actually Shift JIS encoded.

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?

Structure is strong: a one-line summary, then clearly headed REPLACE MODE and PATCH MODE sections with the required parameters called out in each. It is somewhat long and repeats the 'no normalization/conversion' rule in both mode sections, which is defensible per-mode but adds bulk; otherwise every sentence carries operational information.

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 six-parameter, dual-mode mutation tool with no annotations and no output schema, the description covers modes, required parameters, matching/error semantics, and explicitly states the return value (a diff). What is missing is the safety/operational envelope — encoding validation of the target file, backup or rollback behavior, and permission requirements — which matters for a tool that rewrites files in place.

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 baseline is 3 and the schema already documents every parameter including the mode enum. The description adds real meaning on top — per-mode REQUIRED PARAMETERS lists, the uniqueness contract for oldText, and the non-normalization rule for line endings — but it does not fully specify how path/patch interact across modes or what an invalid combination returns.

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

Purpose5/5

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

The first line names a specific verb (置換) and resource (Shift JIS/CP932 ファイル内のテキスト) and immediately frames it as a replacement for terminal sed/awk, which separates it from read-only siblings like sjis_read or sjis_grep. The two-mode breakdown (replace vs patch) further pins down what the tool actually does, so an agent does not have to open the schema to understand its function.

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

Usage Guidelines4/5

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

It gives explicit selection guidance: use it instead of terminal sed/awk, use replace mode by default, use replaceAll:true to replace every match, and include surrounding context in oldText when only one occurrence should change. It also states patch mode supports only 'Update File'. The remaining gap is that it never explicitly contrasts choosing patch mode over replace mode, nor does it name siblings such as sjis_write as the alternative for whole-file rewrites.

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

Deploy Server

Other Tools