Skip to main content
Glama
ckanthony

Chisel

patch_apply

Apply unified diff patches to files with support for markdown-fenced diffs and new file creation through /dev/null.

Instructions

Apply a unified diff patch to a file. Accepts markdown-fenced diffs. Use --- /dev/null to create new files. Returns error in read-only mode.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
patchYesUnified diff to apply (may be wrapped in a markdown code fence)
pathYesAbsolute path to the file to patch

Implementation Reference

  • The `chisel_patch_apply` function is the direct handler that calls the chisel backend's 'patch_apply' tool via `_chisel_call`. However, the actual business logic is delegated to the remote chisel instance.
    async def chisel_patch_apply(path: str, patch: str) -> str:
        return await _chisel_call("patch_apply", path=path, patch=patch)
  • The `apply_patch` FastMCP tool (registered via @mcp.tool()) exposes 'patch_apply' functionality to MCP clients. It calls `chisel_patch_apply` internally.
    @mcp.tool()
    async def apply_patch(path: str, patch: str) -> str:
        """
        Apply a unified diff to a file via chisel (atomic write, hunk-safe).
    
        Args:
            path:  Absolute path to the target file
            patch: Unified diff string (markdown code fence optional)
        """
        return await chisel_patch_apply(path, patch)
  • The `_chisel_call` helper function opens a session to the chisel MCP server, calls the named tool with provided kwargs, and returns the text result.
    async def _chisel_call(tool: str, **kwargs) -> str:
        """Open a session to chisel, call one tool, return the text result."""
        async with streamablehttp_client(CHISEL_URL, headers=_HEADERS) as (read, write, _):
            async with ClientSession(read, write) as session:
                await session.initialize()
                result = await session.call_tool(tool, kwargs)
                return result.content[0].text
Behavior4/5

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

With no annotations, the description carries the full burden. It discloses that the tool modifies files, accepts markdown-fenced diffs, can create new files, and returns an error in read-only mode. This provides meaningful behavioral context beyond the schema.

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 consists of three concise sentences, each adding essential information. No redundant or vague language; every sentence earns its place.

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?

Given the tool has two parameters, no output schema, and no annotations, the description adequately covers the purpose, input format, special usage, and error condition. It is missing details on return value on success, but overall is sufficiently complete for an AI agent to use correctly.

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?

Input schema descriptions cover both parameters (100% coverage). The tool description adds additional semantics for the 'patch' parameter by specifying that diffs may be wrapped in a markdown code fence, which goes beyond the schema description. Thus, it adds value.

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?

Description clearly states it applies a unified diff patch to a file, specifying input format and special case for creating new files. This distinguishes it from sibling tools (append, create_directory, move_file, shell_exec, write_file) which perform different operations.

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 provides clear context on when to use the tool (applying patches) and includes a specific usage hint for creating new files. It does not explicitly mention alternatives or exclusions, but sibling tools are distinct enough that no further guidance is necessary.

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/ckanthony/chisel'

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