patch_page
Edit a live WebCake page or cached draft by element id using targeted operations; validate merged changes and preview or save them without resending the full source.
Instructions
Edits a page by element id without sending the whole source. The target is either a live page (page_id) or a cached draft (draft_id) returned by a failed or dry-run create_page, add_section or update_page call. Ops: {op:'update', id, type?, specials?, styles?:{desktop?,mobile?}, config?:{desktop?,mobile?}, events?, properties?} shallow-merges fields (op defaults to 'update'; it cannot delete existing keys), {op:'replace', id, element} swaps the node, {op:'remove', id} deletes it (events elsewhere that targeted it are reported in dangling_events), {op:'add', parent_id, element} appends a child to a container; element may be sparse. {op:'move', id, parent_id?, index?, desktop?:{left?,top?}, mobile?:{left?,top?}} reparents and/or reorders (z-order = child order), keeping the element visually in place unless left/top are given. {op:'duplicate', id, parent_id?, offset?:{desktop?:{x,y},mobile?:{x,y}}, count?} deep-copies with fresh unique ids (internal event targets remapped); copy i is shifted by offset×i. {op:'style', id|match, desktop?:{…}, mobile?:{…}} merges styles. update/style/remove accept match:{type?, text?, section_id?, within?} instead of id (text = case-insensitive substring, tags stripped; within = a container id) and apply to every match, refused above limit (default 50); matched_ids are reported. The server loads the source, applies the ops, validates the whole merged tree (errors block the save) and saves: a live page is updated in place, a create draft becomes a new page, a section draft is appended, and an update draft is re-saved. With a draft_id and no patches, the cached draft is committed as-is (the retry after a timeout). dry_run defaults to true (load, merge, validate, preview; no write); dry_run:false saves. Requires Webcake credentials; a page_id patch reads the live page, so it needs them even on a dry run.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "patch_page"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| force | No | Default false. Only meaningful when committing an 'update' draft: true saves the cached snapshot even though the page changed outside this session, discarding those changes. A page_id patch never needs it — it merges into the tree it just read. | |
| dry_run | No | Default TRUE — load, merge, validate and preview the resulting save WITHOUT writing. Set false to actually save. | |
| page_id | No | A live page id to edit (must be owned by the account). Provide page_id OR draft_id; with a sections or update draft_id, page_id overrides the stored target page. | |
| patches | No | One op object or an array of them (object/array or JSON string). Each targets an element by id: {op:'update',id,type?,specials?,styles?:{desktop?,mobile?},config?:{desktop?,mobile?},events?,properties?} merges fields into the element (op may be omitted; `type` changes the element type; a merge cannot delete an existing key, so schema 'must NOT have additional properties' errors are fixed with op:'replace' and a clean node); {op:'replace',id,element} swaps the node; {op:'remove',id} deletes it; {op:'add',parent_id,element} appends a child to a container; {op:'move',id,parent_id?,index?,desktop?:{left,top},mobile?:{left,top}}; {op:'duplicate',id,parent_id?,offset?:{desktop?:{x,y},mobile?:{x,y}},count?}; {op:'style',id|match,desktop?,mobile?}. update/style/remove take match:{type?,text?,section_id?,within?} + limit? (default 50) instead of id. `element` may be a sparse node (id/type/styles/specials/events); omitted boilerplate is filled from factory defaults. Empty or omitted with a draft_id: the cached draft is committed as-is. | |
| draft_id | No | Commit or fix a CACHED source: from create_page (failed/timed-out → new page created once valid), add_section (dry_run or failure → sections appended), or update_page/live-page patch (timed-out/failed → updatePageSource retried). The originating tool's error/dry_run response returns draft_id. Provide page_id OR draft_id. Empty/omitted patches = commit the cached draft as-is (the RETRY PATH after a timeout). | |
| organization_id | No | Organization the page(s) belong to: an organization id, or 'personal' (= no organization). Settle it first (list_organizations; ask the user when the account has 2+). When omitted: the org remembered for this page_id (from get_page), else WEBCAKE_ORG_ID / x-webcake-org-id, else the account's only organization, else ok:false reason:'organization_required' with the list. |