Skip to main content
Glama

Patch a spec file

apply
Destructive

Edit a spec file in place with a patch to move, reorder, rename, restyle, add, remove, or group items instead of rewriting it; writes SPEC.patch.json so regenerated output keeps the change.

Instructions

Edit a spec file with a patch instead of rewriting it: move or reorder items, rename text, change colors, add or remove things, or move them into a group, so a regenerated spec keeps the change. Changes the spec file in place and writes the patch beside it (SPEC.patch.json). Render the spec to the same out path again; changed in the result says what moved.

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": {
      "spec": "<spec>",
      "patch": "<patch>"
    },
    "name": "apply"
  }
}

Input Schema

NameRequiredDescriptionDefault
specYesPath of the spec file to change. It is edited in place.
patchYesA list of operations (place, order, style, text, add, remove, move-to-group), or the path of a patch file.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.9.1

TDQS

A4.1/5.0
Behavior4/5

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

Annotations already declare the destructive, non-idempotent, non-read-only profile, so the bar is lower and the description clears it. It adds genuinely new behavior: the spec is edited in place, a second artifact (SPEC.patch.json) is written beside it, and the change only persists if the spec is re-rendered. It does not discuss failure modes, whether an existing patch file is overwritten, or partial-application behavior.

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 core distinction ('patch instead of rewriting'), then the side-effect and the verification step. It is dense but nearly every clause carries information; the middle enumeration of operation types is the only slightly redundant part given the schema.

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?

For a two-parameter mutation tool with no output schema, the description covers the important unknowns: in-place edit, the generated patch file, and how to confirm the result via 'changed'. What remains unstated is the failure/overwrite behavior of the patch artifact and any permission or path-validity requirement.

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%, so both parameters are documented structurally, and the description's operation list largely restates the operation names already present in the patch schema. It does add human-intent phrasing (rename text, change colors, move into a group) that helps map a goal to an operation, but adds nothing about path format or in-place semantics beyond the schema's own note.

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 and resource ('Edit a spec file with a patch instead of rewriting it') and immediately clarifies the distinction from regenerating the file, which is what the sibling 'render'/'infer' workflow would otherwise imply. The enumerated edit intents (move, reorder, rename, recolor, add/remove, group) let an agent confirm this is the right tool without opening a schema.

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?

Gives clear situational context: use this when you want a change to survive regeneration, versus rewriting the spec. It also outlines the follow-up step ('Render the spec to the same out path again') and how to verify the effect. It stops short of explicit exclusions (e.g. 'do not use for validating or auditing'), so it is not a full when/when-not/alternatives statement.

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

Deploy Server

Other Tools