Skip to main content
Glama

apply_patch

Destructive

Apply a Codex patch to add, update, move, or delete files in a configured workspace. Use dry-run to validate changes without writing, and verify source files with SHA-256.

Instructions

Add, update, move, or delete files inside the configured workspace using Codex patch format. Run with "dry_run" first when the context lines are uncertain.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
patchYesPatch beginning with *** Begin Patch and ending with *** End Patch.
dry_runNoValidate and report changes without writing files.
expected_sha256NoWhen supplied, must cover every updated/deleted source path with its read-time SHA-256.

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. Changed1 schema field changedv1.2.1
    • addedInput schema / properties / expected_sha256
      Added value: +{
      +  "additionalProperties": {
      +    "pattern": "^[a-fA-F0-9]{64}$",
      +    "type": "string"
      +  },
      +  "description": "When supplied, must cover every updated/deleted source path with its read-time SHA-256.",
      +  "type": "object"
      +}
  2. First observedv1.0.0

TDQS

A4.5/5.0
Behavior4/5

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

The description openly discloses the file-system mutation types, including delete and move, and suggests a dry-run safety check. This complements the destructiveHint annotation with concrete operations, though it does not detail failure or atomicity behavior.

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?

Two sentences, each earning its place: the first defines scope and operations, the second provides a practical safety instruction. No fluff or redundancy.

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

Completeness5/5

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

For a mutation tool with destructiveHint, 100% schema coverage, and no output schema, the description plus structured fields provide everything needed to invoke properly: patch format, scope, supported operations, and a dry-run guardrail.

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 100%, so the baseline is 3, but the description adds value by naming the Codex patch format and giving a conditional usage rule for dry_run that is not in the schema. It does not add detail beyond schema for expected_sha256, but that is already well-documented.

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 specifies the exact action—applying a Codex patch—and the affected resources: files in the configured workspace, with explicit capabilities (add, update, move, delete). This clearly distinguishes it from sibling file tools like write_file/edit_file by patch format.

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?

It provides direct operational guidance to run with dry_run first when context lines are uncertain. It does not explicitly name alternatives or state when to prefer apply_patch over write_file/edit_file, but the patch-format reference supplies a reasonable context cue.

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

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/JonusNattapong/chatgpt-pilot'

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