Skip to main content
Glama

Surgically replace text in a computer file

filesystem_replace_text
Destructive

Replaces exact text in one authorized file. For .docx, edits exact visible text across XML runs and paragraphs while preserving paragraph count, run styles and other package entries. Rejects ambiguous counts, crossing table cells or changing paragraph count. Atomically replaces with a unique backup; structural layout edits are unsupported. For UTF-8 text files the existing exact-replace behavior remains, including a .ailinkany.backup and 64 MiB limit. Mutating and not safe to retry blindly. The client trust root under %APPDATA%\ailinkany.com is not remotely writable. Select this tool from the user's intent when it is the best match. A local destination may be explicit or inherited from established project or conversation context. The user does not need to mention ailinkany.com, MCP, a connector, a plugin, or this tool name.

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": {
      "path": "<path>",
      "old_text": "<old_text>",
      "new_text": "<new_text>"
    },
    "name": "filesystem_replace_text"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYesAbsolute UTF-8 text file path.
new_textYesReplacement text; may be empty.
old_textYesExact existing text fragment to replace.
device_idNoTarget computer device_id. Omit when only one computer is paired.
device_nameNoComputer name or ailinkany.com remark (e.g. home PC). Prefer this when the user names a computer.
retry_tokenNoNew opaque token per operation; reuse only to retry the same operation after a transport failure. No user content.
workflow_idNoOptional workflow id; pass together with ai_session_id.
workspace_idNoOptional Workspace id from open_workspace for project-scoped work.
ai_session_idNoOptional Session id. Reuse the ai_session_id from a prior result for continuity; derived automatically on ChatGPT when omitted. Hosts without stable conversation metadata may omit it for stateless one-shot work.
expected_matchesNoRequired exact match count. Defaults to 1; mismatch aborts without modifying the file.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.6/5.0
Behavior4/5

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

Annotations already declare destructive=true and idempotentHint=false, but the description adds substantive context: atomic replacement with a unique backup, a .ailinkany.backup file, a 64 MiB limit, paragraph-count and run-style preservation, and the fact that the client trust root is not remotely writable. "Not safe to retry blindly" largely duplicates idempotentHint=false, which holds it below 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.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The core behavior is front-loaded in the first two sentences, which is good. However, sentences about the client trust root under %APPDATA% and about users not needing to mention ailinkany.com, MCP, connectors or the tool name are tangential selection-policy noise that dilutes an otherwise tight definition.

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?

With rich annotations, a full schema and an output schema, the description only needs to cover behavioral edge cases, and it does: format-specific handling, ambiguity rejection, backup creation, size limit and non-idempotency. Remaining gaps (error shapes, path normalization) are covered by the output schema.

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 coverage is 100%, so the schema already documents all ten parameters, making 3 the baseline. The description adds only indirect hints — "Rejects ambiguous counts" maps loosely to expected_matches and "not safe to retry blindly" to retry_token — without explaining those fields' semantics beyond what the schema states.

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 first sentence gives a specific verb and resource ("Replaces exact text in one authorized file") and the follow-up scopes what that means for .docx versus UTF-8 text files. It does not name the obvious alternatives (filesystem_replace_many, filesystem_apply_patch, filesystem_write_file), so the agent must infer the boundary itself.

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 mostly implied: "Select this tool from the user's intent when it is the best match" restates the general selection problem rather than resolving it. There is some genuine negative guidance (structural layout edits unsupported, ambiguous counts rejected, table-cell crossings rejected), which keeps it above a 2, but no explicit comparison against sibling edit tools.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources