Skip to main content
Glama

Apply a multi-file patch on a computer

filesystem_apply_patch
Destructive

Applies several add, update, delete and move operations to UTF-8 text files in one call. All operations are validated first and applied all-or-nothing; any failure rolls everything back. update takes edits[] of exact old_text/new_text pairs with an exact expected_matches count (default 1). Existing files are backed up as .ailinkany.backup. 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": {
      "operations": "<operations>"
    },
    "name": "filesystem_apply_patch"
  }
}

Input Schema

NameRequiredDescriptionDefault
device_idNoTarget computer device_id. Omit when only one computer is paired.
operationsYes
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.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.9/5.0
Behavior5/5

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

Beyond the annotations (destructiveHint=true, idempotentHint=false), the description discloses the validation-then-commit order, full rollback on any failure, and the .ailinkany.backup naming for existing files - exactly the mutation semantics an agent needs before writing. It also states the matching contract (exact old_text/new_text pairs with an expected_matches count defaulting to 1), which flags that sloppy matches will fail rather than silently mis-edit.

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 behavioral core is front-loaded and dense with useful facts, which is good. But the trailing three sentences about selecting on intent, inherited destinations, and the user not needing to mention ailinkany.com/MCP add little decision value and dilute 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?

An output schema exists so return values need no explanation, and the description covers the destructive-write contract, backup behavior, rollback, and batch limits implicitly. Minor gaps: no mention of permission prerequisites or path constraints for an openWorldHint=false but cross-device tool, and device targeting is left entirely to the schema.

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 coverage is 86% so the baseline is 3, and the description adds real meaning on top: the edits[] structure for update, the exact-match requirement, and the default of 1 for expected_matches, which the schema does not state. It says nothing about device_id/device_name selection or retry_token reuse, so not fully additive.

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 names a specific verb ('Applies') and resource ('add, update, delete and move operations to UTF-8 text files') plus the key scope 'in one call'. That implicitly separates it from single-file siblings like filesystem_write_file and filesystem_replace_text, but it never names or contrasts with those siblings 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?

The atomicity statement ('validated first ... applied all-or-nothing; any failure rolls everything back') is a genuine usage signal for when a multi-op batch is preferable to individual calls. However, 'Select this tool ... when it is the best match' is circular and the sentences about inherited destination paths and not needing to mention ailinkany.com are prompt boilerplate, not when-to-use guidance against alternatives such as filesystem_replace_many or filesystem_move.

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