API Reference

Complete reference for the Metapad MCP API tools.

mutation

add_allowed_connectionv1.0

Define an allowed connection pattern between node types for a relationship type. All three (relationship type, source node type, target node type) must already exist in the metamodel. Use getmetamodel to check existing types.

→
add_node_typev1.0

Add a new node type (entity type) to the metamodel. Do this before creating nodes of that type. You can define custom properties with data types. For simulation, a property can be marked computed (its defaultvalue is then a Rhai formula evaluated each timestep), and the node type can carry an actscript — a Rhai script run per agent per timestep that drives behaviour.

→
add_relationship_typev1.0

Add a new relationship type to the metamodel. After creating it, use addallowedconnection to specify which node types can be connected with it.

→
add_relationships_to_diagramv1.0

Auto-show all relationships between elements already placed on a diagram. For model diagrams shows M1 relationships; for metamodel diagrams shows allowed connections. Applied immediately.

→
add_to_diagramv1.0

Add nodes or node types to a diagram with auto-grid layout. For model diagrams use node IDs or auto-IDs (e.g. REQ-1); for metamodel diagrams use node type IDs. Applied immediately.

→
clear_parameter_valuev1.0

Clear a single baseline overlay value for an agent property in a parameter set (reverts to inheriting the default set). Applied immediately and broadcast to connected users in real-time.

→
clear_time_series_valuev1.0

Clear one time-series cell (an agent's property value at a timestep). Applied immediately and broadcast to connected users in real-time.

→
create_agentv1.0

Create an agent instance in a scenario. nodetypeid (the agent's type) is required and defines its property and behavior schema. Baseline properties may be keyed by name or ID and target the given (or twin-default) parameter set. Applied immediately and broadcast to connected users in real-time.

→
create_assetv1.0

Create an asset element — a place in the model for an image, document or other file. This creates the element only; no file is attached yet. Call uploadassetfile afterwards to attach the content. The response gives you the new asset's id.

3 parameter(s)

→
create_diagramv1.0

Create a new diagram for visualizing model elements. Use diagramtype 'metamodel' for M2 type diagrams, 'model' for M1 instance diagrams. Applied immediately.

→
create_filterv1.0

Create a stored filter with a composable expression. Expressions: {"OfType":{"typeid":"<id"}}, {"HasTag":{"tag":"foo"}}, {"NameMatches":{"operator":"Contains","value":"foo"}}, {"And":...}, {"Or":...}, {"Not":expr}, {"InFolder":{"folderid":"<id","recursive":true}}, or "All". Applied immediately.

→
create_folderv1.0

Create a new folder for organizing model elements. Use layer 'metamodel' for node/relationship type folders, 'model' for node/relationship/diagram folders. Applied immediately.

→
create_linkv1.0

Create a link between two agents in a scenario — the simulation counterpart of a relationship. The relationship type and both agents must already exist. Applied immediately and broadcast to connected users in real-time.

→
create_nodesv1.0

Create new node instances. Node type must already exist in the metamodel (use getmetamodel to check, or addnodetype to create). Changes are applied immediately and broadcast to all connected browser users in real-time.

3 parameter(s)

→
create_parameter_setv1.0

Create a parameter set within a twin — a named bundle of input-value overrides on an axis orthogonal to scenarios. Use a stable lowercase name (e.g. "highdemand"). Applied immediately and broadcast to connected users in real-time.

→
create_publicationv1.0

Create a publication — the thing that turns your model into a readable site or a PDF report. A publication decides three things: which navigation trees form the site map, which rendering presents each type of element, and what the homepage says.

9 parameter(s)

→
create_relationshipsv1.0

Create relationships between existing nodes. Both source and target must exist. The relationship type must exist in the metamodel and have an allowed connection defined for the given source/target node types.

→
create_renderingv1.0

Create a rendering — the page template for one node or relationship type. Every element of that type is presented through it, so you write the shape of the page once rather than writing each page.

5 parameter(s)

→
create_scenariov1.0

Create a scenario (what-if projection) within a twin, with its own timeline. The step size dt must be 1/N for a positive integer N (e.g. 1, 0.5, 0.25). Applied immediately and broadcast to connected users in real-time.

→
create_simulation_diagramv1.0

Create a simulation diagram — a visual canvas for a scenario or twin. Provide exactly one of scenarioid (scenario-scoped) or twinid (twin-level, spans all scenarios). Agent/link placement and widgets are added in-app. Applied immediately and broadcast to connected users in real-time.

→
create_treev1.0

Create a navigation tree (ModelTree): a named, ordered tree structure over the graph, used as a reading-oriented browse structure (Reader Workspace, publishing site nav, report chapter order). A tree is an ordered list of branches; each branch may have a label, description, a seed (a filter expression selecting its node(s) — e.g. {"OfType":{"typeid":"<id"}}, {"HasId":{"ids":"<node-id"}}, {"FilterRef":{"filterid":"<id"}}), an expansion (follow a relationship from the seed), an ordering, and nested children. Use listtrees to discover existing trees. Applied immediately.

→
create_twinv1.0

Create a simulation twin — a Live Twin container scoped to a subset of node types, optionally attached to a model node. Scenarios, parameter sets, and agents are created inside it. Applied immediately and broadcast to connected users in real-time.

→
delete_agentv1.0

Delete an agent instance along with its links, time series, and diagram placements. Applied immediately and broadcast to connected users in real-time.

→
delete_assetv1.0

Delete an asset. This also removes the stored file and takes the asset off any diagrams it was placed on. It can be undone from version history. Applied immediately.

1 parameter(s)

→
delete_diagramv1.0

Delete a diagram and all its element placements. Does NOT delete the underlying nodes or relationships — only the visual representation. Applied immediately.

→
delete_filterv1.0

Delete a stored filter. Does not delete any model data. Applied immediately. Accepts filter ID or name.

→
delete_linkv1.0

Delete a link and its diagram placements. Applied immediately and broadcast to connected users in real-time.

→
delete_nodesv1.0

Delete one or more nodes. By default, all connected relationships are also deleted (cascade). Set cascaderelationships to false to fail if the node has any relationships.

2 parameter(s)

→
delete_parameter_setv1.0

Delete a parameter set along with its overlay values and time series. A twin's default parameter set cannot be deleted. Applied immediately and broadcast to connected users in real-time.

→
delete_publicationv1.0

Delete a publication. Nothing in the model itself is affected — the trees, renderings and elements it drew on all stay. Only the assembly goes. Applied immediately.

1 parameter(s)

→
delete_relationshipsv1.0

Delete one or more relationships by their IDs. Use getrelationships to find the relationship IDs first.

→
delete_renderingv1.0

Delete a rendering. Nothing in the model itself is affected — only the page template goes. Any publication that had selected it will report an unresolved selection until you pick another one. Applied immediately.

1 parameter(s)

→
delete_scenariov1.0

Delete a scenario along with its agents, links, and time series. Applied immediately and broadcast to connected users in real-time.

→
delete_simulation_diagramv1.0

Delete a simulation diagram and its placements and widgets. Applied immediately and broadcast to connected users in real-time.

→
delete_treev1.0

Delete a navigation tree. Terminal — does not cascade to any model data (only the tree's reading structure is removed). Accepts tree ID or name. Applied immediately.

→
delete_twinv1.0

Delete a twin and everything inside it — its scenarios, parameter sets, agents, links, and time series. Applied immediately and broadcast to connected users in real-time.

→
edit_textv1.0

Replace one passage inside a long text, in place. You send the exact wording to remove and what should stand in its place; every other character stays as it was — so a long description or a published document can't quietly lose a paragraph to a rewrite. Prefer it over updatenodes for anything longer than a couple of sentences.

7 parameter(s)

→
enable_languagev1.0

Add a language to the model so it can be translated into. The language then appears in the model's language settings and becomes a valid target for translateelements.

1 parameter(s)

→
merge_nodesv1.0

Merge duplicate nodes into a single node. All relationships from merged nodes are redirected to the kept node. The merged nodes are then deleted. Use findsimilarnodes to identify candidates.

1 parameter(s)

→
move_to_folderv1.0

Move model elements into a folder (or to root by omitting folderid). Supports nodes, relationships, node types, relationship types, diagrams, and folders. Applied immediately.

→
publish_publicationv1.0

Publish a publication by fixing it to a particular version of the model. Readers then see that version as a stable snapshot, so they aren't reading a half-finished edit while you work on the model.

4 parameter(s)

→
remove_allowed_connectionv1.0

Remove an allowed connection constraint, revoking permission for a relationship type to connect specific node type pairs. Applied immediately.

→
remove_from_diagramv1.0

Remove nodes or node types from a diagram. Also removes connected relationship visualizations on that diagram. Does NOT delete the underlying elements. Applied immediately.

→
remove_node_typev1.0

Remove a node type from the metamodel. Also cascades to remove all M1 instances of that type and their relationships. Applied immediately. Use with caution — cannot be undone via MCP.

→
remove_relationship_typev1.0

Remove a relationship type from the metamodel. Also removes all relationships of that type from M1. Applied immediately. Use with caution.

→
rename_folderv1.0

Rename an existing folder and optionally update its description. Applied immediately.

→
set_parameter_valuev1.0

Set a single baseline value for an agent property in a specific parameter set — the field a slider or checkbox would write. For per-timestep values use settimeseriesvalue. Applied immediately and broadcast to connected users in real-time.

→
set_time_series_valuev1.0

Set one cell of the simulation spreadsheet: an agent's property value at a given timestep, in a scenario and parameter set. propertyid may be a property name or ID; omit parametersetid for the twin default. Applied immediately and broadcast to connected users in real-time.

→
translate_elementsv1.0

Write translations into the model. Each call merges with what's already there rather than replacing it, so you can work through a large model in batches without losing earlier work.

2 parameter(s)

→
update_agentv1.0

Update an agent's label, description, or baseline property overlay. setproperties replaces the entire overlay for the target parameter set — to change a single value use setparametervalue instead. Applied immediately and broadcast to connected users in real-time.

→
update_assetv1.0

Rename an asset, change its description, or move it to another folder. This does not touch the attached file — use uploadassetfile to replace the content, or deleteasset to remove the asset altogether. Applied immediately.

5 parameter(s)

→
update_diagramv1.0

Update an existing diagram's name or description. Applied immediately. Accepts diagram ID or name.

→
update_filterv1.0

Change a stored filter's name, description, or the expression that decides what it matches. The new expression replaces the old one outright rather than being added to it. Applied immediately.

5 parameter(s)

→
update_linkv1.0

Update a link's description and/or property values (setproperties replaces the link's properties). Applied immediately and broadcast to connected users in real-time.

→
update_modelv1.0

Update the model's top-level name or description. Applied immediately.

→
update_node_typev1.0

Update an existing node type: rename, recolor, change description, or add new properties. For simulation, setactscript sets or clears the node type's Rhai act script, and updateproperties edits existing properties in place — including making a property computed or changing its Rhai formula. Applied immediately and broadcast to all connected users.

→
update_nodesv1.0

Update labels, descriptions, or properties on existing nodes. Use setlabel/setdescription to update core fields, setproperties for key-value pairs, and removeproperties to clear values. Node IDs accept both UUIDs and auto-IDs (e.g. REQ-42).

1 parameter(s)

→
update_parameter_setv1.0

Update a parameter set's name and/or description. Applied immediately and broadcast to connected users in real-time.

→
update_publicationv1.0

Change a publication's name, slug, description, homepage, site map, per-type rendering selection, connected report services, or whether readers see auto-IDs.

9 parameter(s)

→
update_relationship_typev1.0

Update an existing relationship type: rename, recolor, change description, or add new properties. Applied immediately and broadcast to all connected users.

→
update_relationshipsv1.0

Update labels, descriptions, or properties on existing relationships. Applied immediately and broadcast to all connected users. Relationship IDs accept both UUIDs and auto-IDs (e.g., "CON-5").

→
update_renderingv1.0

Change a rendering's name, description, or document. The new document replaces the old one entirely rather than being merged into it — send the whole template, not just the part you changed. Applied immediately.

5 parameter(s)

→
update_scenariov1.0

Update a scenario's name, description, or timeline (start time, end time, dt). A changed dt must still be 1/N for a positive integer N. Applied immediately and broadcast to connected users in real-time.

→
update_simulation_diagramv1.0

Update a simulation diagram's name and/or description. Applied immediately and broadcast to connected users in real-time.

→
update_tagsv1.0

Set the tags on a model element. This REPLACES every tag already on the element, so read its current tags first and send them back alongside the new ones — otherwise you silently drop the tags that were there. Tags come back from searchnodes, getnodedetails, getrelationships, getmetamodel and the list tools; listtags shows the vocabulary already in use.

→
update_treev1.0

Update a navigation tree's name, description, or branch structure. setbranches replaces the whole branch forest (same JSON shape as createtree's branches). Accepts tree ID or name. Pass a locale to write name/description into a non-default language's translation layer. Applied immediately.

→
update_twinv1.0

Update a twin's name and/or description. Applied immediately and broadcast to connected users in real-time.

→
upload_asset_filev1.0

Attach a file to an existing asset by pointing Metapad at a public URL. The server downloads the file, stores it, and everyone with the model open sees it appear. Note this fetches from a URL — it does not take raw file bytes. To upload a file directly from your machine, use the REST API instead — Upload Asset for a new asset, or Attach Asset File to put a file on one that already exists.

4 parameter(s)

→

read

find_similar_nodesv1.0

Find nodes with similar names that might be duplicates. Uses string similarity matching. Useful before creating new nodes to avoid duplication.

3 parameter(s)

→
get_agent_detailsv1.0

Get full details for agents by ID, including baseline property values grouped by parameter set (property names resolved from the agent's node type).

→
get_asset_contentv1.0

Read what's inside an asset's file. PDFs come back as extracted text; text, JSON, CSV, XML and Markdown come back as-is; PNG, JPEG, GIF and WEBP come back as an image the AI can look at. This is how an AI assistant reads a requirements document, a datasheet or a spec you've attached to the model. Use listassets first to find the asset's id.

3 parameter(s)

→
get_metamodelv1.0

Get the model's schema (metamodel). Returns all node types, relationship types, their properties, allowed connections, and instance counts. Always call this first to understand what the model contains. For simulation models it also reports each property's computed flag and Rhai formula and each node type's actscript, plus a self-describing "scripting" block documenting the available simulation functions (getconnected, sumprop, agent.getprop/setprop, …) so you can author formulas correctly.

1 parameter(s)

→
get_node_detailsv1.0

Get complete details for one or more nodes by their IDs. Returns all properties, description, and metadata. Accepts both UUIDs and auto-IDs (e.g. REQ-42). Each node also includes an updatedat timestamp (ISO 8601 UTC) marking when it last changed, so external tools can skip nodes that haven't changed since they last looked.

2 parameter(s)

→
get_relationshipsv1.0

Find relationships (connections) between nodes. Filter by relationship type, source node, target node, or node types. Source and target IDs accept both UUIDs and auto-IDs (e.g. REQ-42).

7 parameter(s)

→
get_simulation_diagram_contentsv1.0

Get the widgets on a simulation diagram (dashboard) with their IDs and current text — charts (name, axis labels, per-series display names) and slider/checkbox/option/text/parameter-set-chooser controls (label). These widgets live only on the diagram and have no model-tree presence, so this is the only way to discover their IDs. Use it to translate a dashboard: read the contents, then write translations with translateelements using keys like '{chartid}:name', '{chartid}:series:{seriesid}:displayname', and '{widgetid}:label'.

→
get_statisticsv1.0

Get model-wide statistics: node and relationship counts by type, most connected nodes, and property completeness. Useful for a quick model overview.

1 parameter(s)

→
get_time_seriesv1.0

Read time-series values: an agent's property value at each timestep, for a scenario and parameter set. This is the simulation spreadsheet data. scenarioid is required; omit parametersetid to read across all parameter sets.

→
get_tree_detailsv1.0

Read a navigation tree's whole branch structure. Branches aren't nodes, so no other tool reaches them — listtrees only tells you how many there are. For each branch, nested as deep as it goes, you get its id, title, lead text, what seeds it, any elements attached by hand, how it expands along relationships, how it's ordered, its child branches, and the elements it currently holds.

2 parameter(s)

→
list_agentsv1.0

List agent instances in a scenario. Each agent is an instance of a node type living in one scenario. Returns summaries; use getagentdetails for baseline property values. Filter by scenario, twin, node type, or name.

→
list_assetsv1.0

Find assets in a model by label, filename, file type, or folder. Assets live in their own collection rather than alongside nodes, so searchnodes will not find them — use this instead. Each result gives the asset's id, label, original filename, content type, size in bytes, and whether a file is actually attached. Call this first to get an asset id for getassetcontent.

8 parameter(s)

→
list_diagramsv1.0

List the model's diagrams with their IDs, names, and levels. Diagrams aren't returned by searchnodes, so this is how you discover a diagram's ID before calling updatediagram, addtodiagram, addrelationshipstodiagram, removefromdiagram, or deletediagram. Filter by level (metamodel for type diagrams, model for instance diagrams), name, or folder. For simulation dashboards use listsimulationdiagrams instead.

→
list_foldersv1.0

List the model's folders. Each one comes back with its id, name, which layer it belongs to (the metamodel or the model itself), what kind of content it holds, and its parent folder. Use this to look up a folder before calling anything that takes a folderid — createnodes, addnodetype, movetofolder, creatediagram, createfilter, createasset.

3 parameter(s)

→
list_linksv1.0

List links — the connections between agents within a scenario (the simulation counterpart of relationships). Returns endpoints with resolved agent labels and link property values. Filter by scenario, relationship type, or endpoint.

→
list_parameter_setsv1.0

List the parameter sets in a twin. A parameter set is a named bundle of input values on an axis orthogonal to scenarios — a simulation run is keyed by (scenario, parameter set). Shows which set is the twin's default.

→
list_publicationsv1.0

List the model's publications — the assembled sites and PDF reports built from navigation trees, per-type renderings and a homepage. Publications are kept separately from nodes, so searchnodes won't find them; this is how you get a publication's id before updating, rendering, publishing or deleting it. Each result gives id, name, slug, description, which trees form the site map, which rendering presents each type, any connected report services, whether readers see auto-IDs, folder, tags, and whether it has been published.

3 parameter(s)

→
list_renderingsv1.0

List the model's renderings — the page templates that say how elements of a given type are presented on Reader pages, published site pages and PDF chapters. Renderings are kept separately from nodes, so searchnodes won't find them; this is how you get a rendering's id before updating, previewing or deleting it. Each result gives id, name, the type it targets, description, folder, tags, and how long its document is.

4 parameter(s)

→
list_scenariosv1.0

List scenarios within twins. A scenario is a what-if projection with its own timeline (start time, end time, step size dt). Returns timeline parameters, the computed timestep count, and agent/link counts. Filter by twinid.

→
list_simulation_diagramsv1.0

List simulation diagrams — the visual canvases for a scenario or twin that show agents, links, and dashboard widgets. Filter by twin or scenario.

→
list_tagsv1.0

List every tag in use across the model, with how many elements carry each one. Counts cover all taggable element kinds — nodes, relationships, node and relationship types, diagrams, grid views, folders, filters, navigation trees, renderings, publications, assets, and the simulation elements. Capitalisation is ignored, so 'Persistence' and 'persistence' count as one tag. Call this before tagging so you reuse the vocabulary already in the model instead of introducing a near-duplicate spelling.

→
list_translatable_stringsv1.0

Collect every piece of text in the model that can be translated, in one place. That means the model's own name and description, your types and their properties, every node and relationship with its labels, descriptions and property values, diagrams, grid views, folders, filters and assets, the whole publishing layer (navigation trees and each branch's title and lead text, document renderings and their document bodies, publications and their homepages), and the entire simulation layer down to dashboard chart titles, axis labels and slider captions.

4 parameter(s)

→
list_treesv1.0

List the model's navigation trees. Trees live in their own collection (not returned by searchnodes), so this is how you discover a tree's ID before calling updatetree or deletetree. Returns id, name, description, folderid, tags, and branchcount (number of top-level branches). Filter by name or folder.

→
list_twinsv1.0

List simulation twins. A twin is a Live Twin container scoped to a subset of node types, optionally attached to a model node. Returns each twin's scope, default parameter set, and scenario/parameter-set counts.

→
preview_renderingv1.0

Render one rendering against one element and get the resulting page back, together with a report on what worked. You don't need a publication for this — it's the tool to use while writing a rendering, because createrendering and updaterendering write the document blind.

4 parameter(s)

→
render_pagev1.0

Render one page of a publication exactly as it will be published, with a report on what worked.

4 parameter(s)

→
render_publicationv1.0

Render a whole publication — every page, in reading order, in one go. This is the same assembly the PDF and the Markdown download use, so what comes back is the real artifact rather than an approximation.

6 parameter(s)

→
run_simulationv1.0

Run the simulation and read back the COMPUTED time series for a scenario. Unlike gettimeseries (which returns only stored input cells — manual entry or live data), this evaluates the Rhai property formulas and act scripts on demand and returns the resulting per-agent, per-property, per-timestep values, each with its simulated time, plus formula diagnostics. This is the only way to read formula-driven results via the API: they are computed on the fly and never persisted. scenarioid is required; parametersetid defaults to the scenario's twin's default parameter set. Use agentinstanceid, propertyid, mintimestep, and maxtimestep to scope large series. Check the diagnostics field (formula/act-script compile and runtime errors, cycles, unresolved dependencies) when results look wrong or empty.

→
search_nodesv1.0

Search for nodes (instances) in the model. Filter by type, name, description, property values, or folder. Returns summaries — use getnodedetails for full information. Each summary now includes an updatedat timestamp (ISO 8601 UTC) for change detection.

10 parameter(s)

→

This content was written collaboratively with AI.