Skip to main content
Glama

ParCAD

Edit a part in place

edit_part
Destructive

Change part of a script without sending the whole thing: each edit replaces old with new, once, and the part is rebuilt and measured exactly as evaluate_part does — same reply, same views — then saved. project names the part to edit, or "@session" for the script on the user's screen. An old that appears twice, or not at all, is refused naming how many times it was found and where, or the nearest line, and nothing is written: give more surrounding lines. An old found nowhere exactly but once with its spacing and quotes read loosely is applied, and the reply's matched_loosely names it. The edited text is built before anything is written, so a change that does not build is refused and the part is left as it was. The previous text is kept as a snapshot (list_snapshots, restore_snapshot), so an edit is undoable, and an edit to the open part lands in the window's own undo history: the reply then carries on_screen with the revision and viewers, as set_script's does. A saved part that is also open on screen is put on screen too. It changes a saved part after the first build — a fillet radius, a dimension, one function — without 10 KB of unchanged script being sent to change two lines, the most common way a session runs out of room. evaluate_part with the same project and edits tries a change without saving it. The reply adds edits_applied, the new script_sha256, and for a saved part the path written and the snapshot kept; a reply's script_sha256 passed back as expect_sha256 refuses the edit if the text has changed since. An edit that writes part.js is refused when the edited text fails its print_check (material under 0.3 mm) or one of the part's own checks, naming the finding or the check and its measurement, unless allow_failing carries the user's words accepting that it fails; an edit to "@session" changes only the screen and is never refused for a verdict — the window shows it red.

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": {
      "project": "<project>",
      "edits": "<edits>"
    },
    "name": "edit_part"
  }
}

Input Schema

NameRequiredDescriptionDefault
tagsNoList only these tags, as evaluate_part's.
editsYesEach { old, new }, applied in order to the text as the previous edit left it. `old` must appear exactly once.
viewsNoAlso draw the edited part, as evaluate_part's `views`: `iso`, `front`, `back`, `left`, `right`, `top`, `bottom`. Omit to measure only.
bodiesNoList only these bodies, and the pairs with them, as evaluate_part's.
wait_sNoHow long to wait for a window to show the edit, when the part is on screen, as in `set_script`. 0 to 60; defaults to 20.
projectYesThe part to edit, as list_projects spells it — 'Mounts/bracket' — or "@session" for the script on the user's screen.
regionsNoColour each view by the tag that owns the surface, as evaluate_part's.
sectionNoCut the part open on a plane for the views, as evaluate_part's.
materialsNoDraw each face in its `.material()`, as evaluate_part's.
timeout_sNoSeconds the kernel may take, 1 to 600, as evaluate_part's.
image_sizeNoPixels per side, 128 to 1024, as evaluate_part's. Defaults to 512.
allow_failingNoThe user's words accepting that the edited part fails a check or the print check, such as "save it, I'll fix the clearance later". Fixed dimensions in a brief, or the request for the edit, accept no failure. Without it a failing verdict refuses an edit that writes part.js, naming it and what was measured; an edit to "@session" changes the screen only and is never refused for it.
expect_sha256NoRefuse unless the part's current text still hashes to this — the `script_sha256` a previous reply reported — so an edit written against text the user has since changed is refused rather than applied. Leave it out to edit whatever is there now.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already flag destructiveHint=true and idempotentHint=false, but the description adds real context beyond them: edits are built and checked before writing so a failing build leaves the part untouched, a snapshot is kept making the edit undoable, and edits to a saved part are refused on print_check/checks failures unless allow_failing is supplied. It also explains the on-screen viewer behavior and the expect_sha256 staleness guard, which 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?

Front-loaded with the core replacement-and-rebuild behavior, and nearly every sentence carries distinct information. It is dense and long, and the allow_failing refusal rule is stated in both the prose and the schema, so a little trimming is possible.

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 13-parameter mutating tool with no output schema, the description covers the reply fields (edits_applied, script_sha256, path, snapshot, matched_loosely, on_screen/viewers), the atomicity guarantee, and every refusal path. Nothing an agent needs to call it correctly or interpret the result 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 semantics the schema does not: an `old` appearing twice or never is refused with a count/location hint, and a loosely matching `old` is applied with `matched_loosely` reported. It also explains the expect_sha256 round-trip and the allow_failing acceptance rule in operational terms.

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 ('each edit replaces `old` with `new`... the part is rebuilt and measured... then saved') and explicitly contrasts with evaluate_part, which tries the same change without saving. An agent can distinguish this from set_script and evaluate_part without opening any 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 the motivating case (changing a fillet radius or dimension 'without 10 KB of unchanged script being sent'), names the alternative evaluate_part for a non-saving trial, and points at list_snapshots/restore_snapshot for undo. When-to-use and when-to-use-something-else are both explicit.

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.