Skip to main content
Glama

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').

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesAbsolute path to the target file on the router
patchYesUnified diff patch content with @@ hunk headers. Context lines must match the file.
dry_runNoIf true, only check if the patch applies cleanly without modifying the file
Behavior3/5

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

With no annotations provided, the description carries the full burden for behavioral disclosure. It does add useful context about server-side parsing and format support, but it does not mention that the file is modified in place, how errors are handled, or any prerequisites like file existence. For a mutation tool, this is a moderate transparency gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

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

The description is two sentences, front-loaded with the verb and resource, and every sentence adds value. No redundant or wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool is relatively simple with 3 parameters, but there is no output schema, so the description should hint at return values or error behavior. It doesn't mention whether the tool returns success/failure or any result, nor does it mention the dry_run option. The core operation is clear, but some completeness is missing.

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% with descriptive parameter descriptions. The description mentions 'standard unified diff format (output of diff -u)', which reinforces the patch parameter's schema but does not add significant new meaning. This follows the baseline for high schema coverage.

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 description uses a specific verb 'Apply' with a clear resource 'a file' and method 'unified diff patch'. It distinguishes this tool from siblings like file_write and sed by focusing on patch application. The note about server-side parsing further clarifies its unique 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?

The description clearly implies when to use the tool: when you have a standard unified diff (from 'diff -u'). It doesn't explicitly mention alternative tools or exclusions, but the diff-specific nature makes the use case evident. The context is clear, even without explicit alternatives.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/haode01/openwrt-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server