file_patch
Apply unified diff patches to OpenWrt router files directly via MCP, eliminating the need for the patch command. Supports standard diff -u format and dry-run checks.
Instructions
Apply a unified diff patch to a file on the OpenWrt router. The patch is parsed and applied on the MCP server side — no 'patch' command needed on the router. Supports standard unified diff format (output of 'diff -u').
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>",
"patch": "<patch>"
},
"name": "file_patch"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Absolute path to the target file on the router | |
| patch | Yes | Unified diff patch content with @@ hunk headers. Context lines must match the file. | |
| dry_run | No | If true, only check if the patch applies cleanly without modifying the file |