Skip to main content
Glama

patch_apply

Overwrite bytes in a loaded image, cache the original bytes for rollback, and invalidate cached function indexes so analysis views show changes immediately.

Instructions

Overwrite bytes in a loaded image, remembering the original for rollback.

The static twin of write: patch the image (which is where the code you disassembled actually lives), then save_image to demap it into a working file. The cached function index is invalidated, so disassemble and decompile show the patched bytes immediately rather than the old ones.

bytes takes hex: "EB", "EB 1C" or "EB1C". A conditional branch is usually the target — 74/75 (jz/jnz) to EB (jmp) skips the failure path without changing instruction length.

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": {
      "key": "<key>",
      "va": "<va>",
      "bytes": "<bytes>"
    },
    "name": "patch_apply"
  }
}

Input Schema

NameRequiredDescriptionDefault
vaYes
keyYes
noteNo
bytesYes
sessionNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.9/5.0
Behavior4/5

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

With no annotations, the description does real work: it discloses that the image (not the file) is mutated, that originals are cached for rollback, that the function index is invalidated so ``disassemble``/``decompile`` reflect new bytes, and that persistence requires ``save_image``. It omits how rollback is actually invoked (likely ``patch_restore``) and any session/permission requirements.

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

Conciseness4/5

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

Front-loaded with the mutation and its consequence, then the toolchain relationship, then the input format with examples. Slightly wordy in the parenthetical about where disassembled code lives, but every paragraph contributes actionable information.

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?

An output schema exists, so return values need not be explained, and the mutation/rollback/cache-invalidation behavior is covered well. However, for a 5-parameter tool with zero schema coverage and no annotations, the unexplained ``key``, ``session``, and ``note`` fields leave the definition short of what an agent needs to call it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0% across five parameters, so the description must compensate and largely does not. The ``bytes`` format is well covered with concrete hex examples, but ``va``, ``key``, ``note``, and ``session`` are never mentioned, leaving three of the required/session-critical fields unexplained.

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?

States a specific verb+resource ("Overwrite bytes in a loaded image") plus a key modifier ("remembering the original for rollback"). It also explicitly positions itself against two siblings: it is "the static twin of ``write``" and must be followed by ``save_image`` to persist.

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?

Clear workflow guidance: patch the image, then call ``save_image`` to demap into a working file, and a concrete use case (conditional branch 74/75 -> EB to skip a failure path). It implies but never states explicitly when to prefer ``write`` over this tool, so it stops short of full when/when-not guidance.

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