Write tools
These 15 tools need a Workspace checkout (archidocs mcp --workspace <dir>), not a published Bundle; over HTTP they also need --allow-writes. The ones that edit the YAML keep its comments and formatting, and return a unified diff.
A write that would add a check error is refused with validation_failed and the issues, each with a link to its rule’s page.
Check the Workspace
Validate the Workspace as it is on disk, as archidocs check does, and return its issues. Use it after editing YAML with your own file tools.
Input
No arguments.
Output
| Field | Type | Required | Notes |
|---|---|---|---|
issues |
list of object | yes | |
summary |
object | yes | |
summary.errors |
number | yes | |
summary.warnings |
number | yes |
upsert_element
Section titled “upsert_element”Add or update an Element
Adds an Element, or updates the fields of an existing one, in its Project’s YAML; comments and formatting are kept. A new Element goes into its parent’s file; with file as well, it goes top-level there and attaches with in:. A new top-level Element goes into file (relative to the Project’s folder), else model.yaml.
Input
| Field | Type | Required | Notes |
|---|---|---|---|
project |
string | yes | The Project to edit, by id. |
kind |
"person" or "system" or "service" or "component" |
yes | |
id |
string | yes | An id in this Project (bare), or project:id. |
fields |
map of id → any | Fields to set, as in YAML; null removes a field. Fields not given are left as they are. Default: {}. |
|
parent |
string | The parent Element, for a new Service or Component. | |
file |
string | For a new Element: 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
| 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 |
upsert_relationship
Section titled “upsert_relationship”Add or update a Relationship
Adds a Relationship from a consumer Element in this Project to its provider, or updates one, under the consumer’s relationships; comments and formatting are kept. A Relationship is named by (from, to) plus id if given. With no id and several on the pair, returns ambiguous with each candidate’s file:line.
Input
| Field | Type | Required | Notes |
|---|---|---|---|
project |
string | yes | The Project to edit, by id. |
from |
string | yes | The consumer Element, in this Project. |
to |
string | yes | The provider Element: an id in this Project, or project:id. |
fields |
map of id → any | Fields to set, as in YAML; null removes a field. Fields not given are left as they are. Default: {}. |
|
id |
string | The Relationship’s id, to pick one of several on a pair or to give a new one an id. | |
dry_run |
boolean | Check the write and return its diff without changing any file. Default: false. |
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 |
remove_element
Section titled “remove_element”Remove an Element · destructive
Removes an Element and the Relationships declared under it. Refused while anything still references it (an Element in it, a Relationship to or via it, a Deployment of it, an ADR linking it), with each reference’s file:line; nothing cascades.
Input
| Field | Type | Required | Notes |
|---|---|---|---|
project |
string | yes | The Project to edit, by id. |
id |
string | yes | An id in this Project (bare), or project:id. |
dry_run |
boolean | Check the write and return its diff without changing any file. Default: false. |
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 |
remove_relationship
Section titled “remove_relationship”Remove a Relationship · destructive
Removes one Relationship, named by (from, to) plus id if given. With no id and several on the pair, returns ambiguous with each candidate’s file:line.
Input
| Field | Type | Required | Notes |
|---|---|---|---|
project |
string | yes | The Project to edit, by id. |
from |
string | yes | An id in this Project (bare), or project:id. |
to |
string | yes | An id in this Project (bare), or project:id. |
id |
string | An id in this Project (bare), or project:id. | |
dry_run |
boolean | Check the write and return its diff without changing any file. Default: false. |
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 |
upsert_target
Section titled “upsert_target”Add or update a Deployment Target
Adds a Deployment Target, or updates the fields of an existing one (name, kind, description, owner, tags, links); comments and formatting are kept. A new Target nests under parent in the parent’s file. A new top-level one goes into file (relative to the Project’s folder), else model.yaml.
Input
| Field | Type | Required | Notes |
|---|---|---|---|
project |
string | yes | The Project to edit, by id. |
id |
string | yes | An id in this Project (bare), or project:id. |
fields |
map of id → any | Fields to set, as in YAML; null removes a field. Fields not given are left as they are. Default: {}. |
|
parent |
string | The Target to nest a new one under. | |
file |
string | For a new top-level Target: 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
| 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 |
remove_target
Section titled “remove_target”Remove a Deployment Target · destructive
Removes a Deployment Target. Refused while a Target is nested in it, a Deployment uses it or an ADR links it, with each reference’s file:line; nothing cascades.
Input
| Field | Type | Required | Notes |
|---|---|---|---|
project |
string | yes | The Project to edit, by id. |
id |
string | yes | An id in this Project (bare), or project:id. |
dry_run |
boolean | Check the write and return its diff without changing any file. Default: false. |
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 |
upsert_deployment
Section titled “upsert_deployment”Add or update a Deployment
Adds a Deployment, or updates the fields (url, endpoints) of the one its (service, environment, target) triple names, in this Project’s YAML; comments and formatting are kept. A new one goes into file (relative to the Project’s folder), else beside the Project’s other Deployments, else into model.yaml.
Input
| Field | Type | Required | Notes |
|---|---|---|---|
project |
string | yes | The Project to edit, by id. |
service |
string | yes | The Service deployed: an id in this Project, or project:id. |
environment |
string | yes | The Environment, by bare id. |
target |
string | yes | The Deployment Target: an id in this Project, or project:id. |
fields |
map of id → any | Fields to set, as in YAML; null removes a field. Fields not given are left as they are. Default: {}. |
|
file |
string | For a new Deployment: 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
| 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 |
remove_deployment
Section titled “remove_deployment”Remove a Deployment · destructive
Removes the Deployment its (service, environment, target) triple names from this Project’s YAML.
Input
| Field | Type | Required | Notes |
|---|---|---|---|
project |
string | yes | The Project to edit, by id. |
service |
string | yes | The Service deployed: an id in this Project, or project:id. |
environment |
string | yes | The Environment, by bare id. |
target |
string | yes | The Deployment Target: an id in this Project, or project:id. |
dry_run |
boolean | Check the write and return its diff without changing any file. Default: false. |
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 |
upsert_team
Section titled “upsert_team”Add or update a Team
Adds a Team to workspace.yaml, or updates the fields (name, description, links) of an existing one; comments and formatting are kept.
Input
| Field | Type | Required | Notes |
|---|---|---|---|
id |
string | yes | The Team’s bare id. |
fields |
map of id → any | Fields to set, as in YAML; null removes a field. Fields not given are left as they are. Default: {}. |
|
dry_run |
boolean | Check the write and return its diff without changing any file. Default: false. |
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 |
upsert_environment
Section titled “upsert_environment”Add or update an Environment
Adds an Environment to workspace.yaml, or updates the fields (name, description) of an existing one; comments and formatting are kept.
Input
| Field | Type | Required | Notes |
|---|---|---|---|
id |
string | yes | The Environment’s bare id. |
fields |
map of id → any | Fields to set, as in YAML; null removes a field. Fields not given are left as they are. Default: {}. |
|
dry_run |
boolean | Check the write and return its diff without changing any file. Default: false. |
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 |
upsert_view
Section titled “upsert_view”Add or update a Saved View
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.
Input
| 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
| 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 |
remove_view
Section titled “remove_view”Remove a Saved View · destructive
Removes a Saved View from its Project’s YAML. Refused while an ADR links it, with each reference’s file:line.
Input
| Field | Type | Required | Notes |
|---|---|---|---|
project |
string | yes | The Project to edit, by id. |
id |
string | yes | An id in this Project (bare), or project:id. |
dry_run |
boolean | Check the write and return its diff without changing any file. Default: false. |
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 |
propose_adr
Section titled “propose_adr”Propose an ADR
Writes a Proposed ADR to <project>/adr/NNNN-slug.md, taking the next free number in the Project, with status: proposed and today’s date. With no body, fills the Project’s adr/template.md, else the Workspace’s adr-template.md, else MADR minimal ({{title}}, {{date}}, {{elements}}, {{views}}). With body, writes it under a # title. elements (Elements and Deployment Targets), views (Saved Views) and supersedes (ADRs, NNNN or project:NNNN) are checked against the Workspace. Accepting it is a status and date edit in the pull request.
Input
| Field | Type | Required | Notes |
|---|---|---|---|
project |
string | yes | The Project that owns the decision, by id. |
title |
string | yes | The decision, as the ADR’s # title. |
elements |
list of string | Elements and Deployment Targets the decision affects. | |
views |
list of string | Saved Views the decision affects. | |
supersedes |
list of string | ADRs this one replaces once accepted: NNNN in this Project, or project:NNNN. | |
body |
string | The markdown body; the template is filled when left out. | |
dry_run |
boolean | Check the write and return its diff without changing any file. Default: false. |
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 |
create_project
Section titled “create_project”Create a Project
Writes a new Project’s project.yaml into folder (relative to the Workspace root; <id>/ by default). Refused for an id already in use, and for a folder inside another Project or holding one.
Input
| Field | Type | Required | Notes |
|---|---|---|---|
id |
string | yes | The new Project’s id. |
name |
string | yes | |
owner |
string | yes | The owning Team, by bare id. |
folder |
string | The Project’s folder, relative to the Workspace root. | |
dry_run |
boolean | Check the write and return its diff without changing any file. Default: false. |
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 |