Skip to main content
Glama

Edit a draft

patch_version

Change a DRAFT version's stored model with an RFC 6902 JSON Patch, merged on the server. Use it for targeted edits; any change to a clipped collection (__context.patchable: false) goes through download and upload instead (see next_steps in get_project).

BEFORE CALLING

  1. The version must be a draft: use get_project's latest_draft. If it is null, ask the user to click New Version on the project page (it copies the live model), then call get_project again.

  2. Call get_project with the draft's version_reference and build every path from that response. Pass its updated_at as base_updated_at.

  3. Tell the user what you will change (old → new) and get their go-ahead.

PATHS (JSON Pointer)

  • Name steps, tests and other id'd array elements by id (else key) instead of index: /steps//... and /tests//... Ids survive other steps being inserted or removed in the same patch.

  • Model layout: /meta/..., /input/format//... (format is an object keyed by input key), /steps//..., /output/format//..., /tests//...

  • Collection rows by index. Compressed collection ([[col1, col2, ...], [v1, v2, ...], ...]): index 0 is the header row, so the first data row is /collection/1, and a cell is /collection//. Uncompressed collection (array of row objects): the first row is /collection/0, and a cell is /collection//. Check __context.shape and __context.columns.

  • Append with "-" (/steps/-, /steps//collection/-). Insert at a numeric index; step order is execution order, so a new step goes after the steps whose outputs it reads.

  • Escape "~" as ~0 and "/" as ~1 inside a segment.

EXAMPLES

  • Change a rate cell: {"op":"replace","path":"/steps/region_rates/collection/1/1","value":4.5}

  • Guard then change: [{"op":"test","path":"/steps/base_premium/formula","value":""},{"op":"replace","path":"/steps/base_premium/formula","value":""}]

  • Add a table row: {"op":"add","path":"/steps/type_factors/collection/-","value":["gravel",1.1]}

  • Change an input default: {"op":"replace","path":"/input/format/bike_value/def","value":2000}

  • Insert a step as the 5th: {"op":"add","path":"/steps/4","value":{ ...full step object... }}

  • Update a test's expected result: {"op":"replace","path":"/tests/t01/output/result","value":46.1}

  • Add a test: {"op":"add","path":"/tests/-","value":{"id":"young_rider","name":"Young rider","key":"young_rider","input":{ ...every input key... },"output":{"result":52.5,"valid":true}}}. Expectations go in output { result, valid }, even if older tests on the model keep them under result.

RULES

  • Smallest change: replace a field, not a whole step; never the whole model (path "" is refused).

  • New or replaced steps follow the config constraints in the server instructions (retain: true on transforms, unique id = key, {{}} references, ...).

  • Don't send __context (it's stripped anyway). A clipped collection must stay exactly as stored — no edits, no removal, no replacement with the sample you saw. A patched collection may hold at most 100 rows.

  • All operations apply or none do. At most 200 per call.

RESULT { saved, updated_at, validation, tests: { total, passed, failed, unchecked, failures: [{ test, problems }] }, version_url, next_steps }. saved: false = schema validation failed, nothing stored — fix from validation.errors and retry. A conflict error = the draft changed since you read it — call get_project again and rebuild. Tests are run after saving and don't block it: report failures and ask whether their expected outputs should change. For every test's actual vs expected values, call run_version_tests. For another patch, use the returned updated_at. Never approves or publishes — the user does that in the UI.

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": {
      "version_reference": "<version_reference>",
      "base_updated_at": "<base_updated_at>",
      "operations": "<operations>"
    },
    "name": "patch_version"
  }
}

Input Schema

NameRequiredDescriptionDefault
operationsYesRFC 6902 JSON Patch operations, applied in order to the full stored model, all or nothing. At most 200.
base_updated_atYesThe draft's updated_at exactly as get_project (called with this version_reference) or the previous patch returned it. A mismatch means someone changed the draft since — the patch is refused.
version_referenceYesUUID of the draft version to patch: get_project's latest_draft.version_reference. Never a published or approved version.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Annotations only declare the generic non-read-only, non-destructive profile; the description adds the traits that actually matter: all-or-nothing application, 200-op cap, 100-row cap on patched collections, immutability of clipped collections, __context stripping, empty-path refusal, and that validation failures store nothing. It also spells out the conflict protocol (base_updated_at mismatch) and that the tool never approves or publishes — behavior no annotation conveys.

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?

Despite its length, it is front-loaded and sectioned (BEFORE CALLING / PATHS / EXAMPLES / RULES / RESULT), so an agent can scan to what it needs. There is modest duplication — the collection-index convention is explained in PATHS and again implied in the rate-cell example — but the density is justified by the target format's complexity.

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 complex, atomic, non-idempotent mutation tool with no output schema, the definition still covers the return shape inline ({ saved, updated_at, validation, tests: {...}, version_url, next_steps }), how to recover from saved:false and from conflicts, and where to go next. Nothing an agent needs to call it correctly or recover from failure is missing.

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 would be 3, but the description adds real semantic depth beyond the schema: how to build JSON Pointers from get_project output, id-vs-index addressing for steps/tests, compressed vs uncompressed collection row indexing, '-' append, and ~0/~1 escaping, all reinforced with worked examples. The meaning of base_updated_at and version_reference largely echoes the schema, keeping this short of a 5.

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?

Opens with a specific verb, resource and mechanism: 'Change a DRAFT version's stored model with an RFC 6902 JSON Patch, merged on the server.' It immediately distinguishes this tool's scope (drafts only) from the download/upload route used for clipped collections, so an agent can tell it apart from get_project, run_version_tests and the read siblings 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 Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives explicit prerequisites (get_project's latest_draft, what to do if it is null), an explicit alternative path for non-patchable collections, and a confirmation step with the user. It also states the follow-up tool (run_version_tests) for actual-vs-expected values, leaving nothing for inference.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources