Skip to main content
Glama

Ptally

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 price: {"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 priced 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.

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 mark it non-readonly, non-destructive, non-idempotent; the description adds the real behavior: all-or-nothing application, the 200-op cap, refusal of path "", immutability of clipped collections, the 100-row collection limit, and the base_updated_at conflict-refusal. It also states tests are priced after saving and don't block, and that the tool never approves or publishes.

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?

Long but front-loaded and sectioned (BEFORE CALLING, PATHS, EXAMPLES, RULES, RESULT), so an agent can skim to the part it needs. The volume is justified by the addressing complexity, though a few examples and rules could be trimmed without loss.

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?

There is no output schema, and the RESULT section fully describes the return shape including saved, updated_at, validation, test counts and failures, plus how to interpret saved: false and conflict errors. For a multi-step mutation tool with intricate path rules, nothing material 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 is 3, but the description adds genuine meaning: paths must be built from the get_project response for that version_reference, base_updated_at must come from that same read or the prior patch's returned value, and version_reference must be latest_draft rather than a published version. Path addressing semantics (id vs index, "-" append, ~0/~1 escaping) are also elaborated beyond the schema.

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: change a DRAFT version's stored model via RFC 6902 JSON Patch merged server-side. It distinguishes scope (draft only, never published) and names the sibling tools used around it (get_project, run_version_tests) plus the upload/download path for clipped collections.

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?

The BEFORE CALLING block gives explicit preconditions and sequencing: resolve latest_draft via get_project, ask the user for approval, then build paths. It also names the alternative (download/upload for __context.patchable: false) and routes test inspection to run_version_tests.

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