upsert_view
Add or update a Saved View · write tool
Adds a Saved View to a Project’s YAML, or replaces an existing one’s definition; comments on keys left unchanged are kept. definition has the YAML structure. A structural or Deployment View (under views: structural:): title, level (c1|c2|c3|deployment), include/exclude selectors (an id; {element, with, upstream, downstream}; {team}; {tag}; {from, to, paths}), expand, collapse, direction, lens, and for a Deployment View environment and targets. A Dynamic View (under views: dynamic:, chosen by steps): title, participants? (fixes their order), and steps [{from, to, relationship?, description?, note?, return?}]. Each Step must resolve to one Relationship: a call from → to, an event written publisher → subscriber (resolving to the subscriber’s via subscription), or with return: true the reply to a sync Relationship to → from; name relationship (its id) when several match. Ids are bare in this Project, or project:id. A new View goes into file (relative to the Project’s folder), else model.yaml.
| Field | Type | Required | Notes |
|---|---|---|---|
project |
string | yes | The Project to edit, by id. |
id |
string | yes | The View’s id, unique among this Project’s Views. |
definition |
map of id → any | yes | The View as written in YAML. |
file |
string | For a new View: a .yaml file relative to the Project’s folder. | |
dry_run |
boolean | Check the write and return its diff without changing any file. Default: false. |
Output
Section titled “Output”| Field | Type | Required | Notes |
|---|---|---|---|
action |
"created" or "updated" or "removed" or "unchanged" |
yes | |
id |
string or null | yes | The qualified id written (bare for a Team, Environment or Project); null for a Deployment, or a Relationship without one. |
from |
string | ||
to |
string | ||
service |
string | ||
environment |
string | ||
target |
string | ||
files |
list of string | yes | |
diff |
string | yes | |
dryRun |
boolean | yes |
Example
Section titled “Example”Called over the Kitchen sink example Workspace.
Arguments:
{ "project": "sink", "id": "data-services", "definition": { "title": "Data services", "level": "c2", "include": [ "orders-db", "events", "search" ] }, "dry_run": true}Result:
{ "action": "created", "id": "sink:data-services", "files": [ "examples/kitchen-sink/archidocs/sink/model.yaml" ], "dryRun": true, "diff": "(the patch below)"}The diff, as a patch:
--- a/examples/kitchen-sink/archidocs/sink/model.yaml+++ b/examples/kitchen-sink/archidocs/sink/model.yaml@@ -101,4 +101,14 @@ external: true technology: Stripe API owner: edge+views:+ structural:+ data-services:+ title: Data services+ level: c2+ include:+ - orders-db+ - events+ - search+ #endregionErrors
Section titled “Errors”A call that fails returns isError: true, with {code, message, suggestions?} as structuredContent. This tool returns:
invalid_inputwhen the arguments don’t fit the input above.not_foundwhen the Project, or an id it names, matches nothing.validation_failedwhen the write would add a check error. Nothing is written.read_onlywhen the server reads a published Workspace Bundle, or serves HTTP without--allow-writes.source_unavailablewhen the server can’t read the Workspace.
Error codes says what to do about each.
See also
Section titled “See also”Documents the beta branch at cd98671, ahead of the latest release, v1.4.0.