add_asset
ChatGPTRegister an SVG icon or raster image in the diagram's asset store, returning the reference to use in <icon asset="…"> (insert / set_diagram) or set_background. content is the artwork itself, never a URL: SVG text (sanitized server-side: scripts and external references are stripped; max 1MB) or a base64 data URI for PNG/JPEG/GIF/WebP (max 5MB). Icons should be square. The asset is stored content-addressed, so re-adding the same content is idempotent and returns the same reference. search_icons covers most product icons with official AWS, Azure, Google Cloud and Iconoir artwork; add_asset is for artwork no library covers. Give provenance for artwork that came from elsewhere. An asset no block references is discarded the next time the diagram is loaded, so reference it soon after adding it.
align
ChatGPTAlign blocks to a shared edge or centre line. The named blocks are grouped into bands across the alignment axis — rows for left/centre/right, columns for top/middle/bottom — and each band moves as a unit to the extreme edge (or centre) of the group as it stands, so blocks sharing a band keep their relative positions instead of converging onto the same edge. Blocks not named are left alone but may be pushed aside. The result says which blocks actually moved. To spread blocks out evenly rather than line them up, use arrange with distributeHorizontally / distributeVertically.
arrange
ChatGPTRearrange blocks as a group. "distributeHorizontally" / "distributeVertically" give the blocks equal gaps along that axis, leaving the two outermost where they are and keeping their current order — the way to even out a row or column of stages. "flipHorizontal" / "flipVertical" mirror their positions about the group's centre line (and swap which side connectors leave from); "transpose" swaps the two axes. The result says which blocks actually moved.
connect
ChatGPTAdd connectors, each named end to end: connections is a list of {from, to} pairs and every pair becomes one routed connector pointing from→to, so the direction and the pairing are exactly what you wrote — a fan-out is several pairs sharing a from. Each end joins a block, which lets routing choose the side, or one side of it (attach), the same distinction as a <path>'s <from attach="right"/> in get_diagram. A pair is always added, even between blocks that are already joined, so two connectors can run between the same blocks; the summary says when one did. STYLE — a connector you do not style takes the look the diagram's connectors share (its path {} rule, which set_style path { … } sets for every connector, including later ones). style styles every connector this call creates; a connection's own style styles that one and wins over style where both set a property. Both take set_style's path declarations and are kept on the connectors they name, so they never become the diagram's shared connector look. The result's pathIds lines up with connections, one id per pair, or null for a pair that could not be routed (the summary names it). Label a connector with set_text on its path id, or author the label inline in XML as a <text> child of the <path>: <path><from block="#a" attach="right"/><to block="#b" attach="left"/><text>Transformed data</text></path>
copy_style
ChatGPTCopy style attributes from one block onto others, with reflow physics. By default copies all applicable style; pass categories to copy only those (same category names as set_style). Attributes that don't apply to a target's type are skipped and reported. Text content is not style — use set_text for that.
create_diagram
ChatGPTCreate a new diagram and return its id — the diagramId every other tool takes. The id is opaque and lasts until the diagram is deleted. Keep the id: there is no current diagram, and a call that names none is rejected. list_diagrams finds it again.
delete
ChatGPTDelete blocks and connectors, re-routing the survivors. ids takes both kinds, mixed freely in one list — a connector's id (from connect or get_diagram) deletes that connector, a block's id deletes that block, and the '#' prefix is optional on either. Deleting a block takes its contents, its attached labels and every connector wired to it with it; keepContents keeps a container's children and removes only the container itself. The result names everything that went, the cascade included, so it does not cost a get_diagram to find out. An id nothing in the diagram has is skipped and reported (deleting what is already gone is not an error); a call where no id names anything fails.
duplicate
ChatGPTDuplicate blocks, offset along a dimension/direction
editor_url
ChatGPTReturn the URL of the diagram in the live browser editor, as bare text. The editor is collaborative — a user opening this URL sees the diagram live and can edit it, and their edits reach you. This tool opens nothing; the URL is how a person sees the diagram. To look at it yourself, call render_diagram, which returns the picture directly and needs no browser.
get_diagram
ChatGPTRead the diagram as nifdi XML — the complete, authoritative model, and the canonical shape to mimic when writing XML back with set_diagram or insert. Accepted set_diagram shorthands are normalized here, so use this output as the source of truth; do not add a version attribute when authoring MCP XML. Blocks carry pos="x y" and size="w h" (space-separated numbers, both optional on input — omitted geometry is completed by the server; this output always shows the resolved values) plus named style classes defined in a <style> block; that style block uses semicolon-separated nifdi semantic declarations (fill-colour: #fff; border-colour: #000;), not CSS fill/stroke/color. Comma-separated declarations are accepted only for legacy XML compatibility. Attached labels are nested elements carrying place (and gap) instead of pos, for example <icon asset="aws:amazon-ec2"><text>Amazon EC2</text></icon> for the default caption below the icon, or <text place="on top-edge"> under a container for a title astride its border; a container child without place is contained as usual. Containers nest their children directly (a <container> holds its <container>/<text>/<icon> children — there is no nested <canvas>). A <path> wires two blocks through <from> and <to> child elements (each with a block id and a side), plus an optional space-separated numeric segments attribute — not SVG path syntax. A connector's label is a <text> (or <container>) child of that <path>. The diagram's source (e.g. Mermaid) is included when present. Pass format "svg" for a self-contained augmented SVG with rendered shapes and embedded asset content, suitable for saving as a .nifdi.svg file. Neither format is a picture — to look at the diagram, call render_diagram.
get_history
ChatGPTRead the diagram's change history — one entry per change: everything one tool call or one editor gesture did, so a set_style of many properties is one entry, with ops counting its parts. Each entry has seq (the change's first seq), timestamp, actor (who did it: you, another agent, or a human editing live), a human-readable summary, and flags: undone (currently undone) and undoable (a valid target for the undo tool). Use it to see what a collaborator changed, or to pick the seq for undo/redo. Entries at or before baseSeq are baked into the canonical base and can no longer be undone. Returns the most recent limit entries after afterSeq.
get_source
ChatGPTRead the diagram's source (e.g. Mermaid). Empty if the diagram has no source.
insert
ChatGPTInsert a fragment of nifdi XML — one or more blocks, optionally nested, with style classes. Use connect for paths and set_style for styling afterwards, and reserve set_diagram for full replacement. Everything about the fragment itself — its shape, geometry attributes, <style> block and class names — is on the `xml` parameter; the placement vocabulary is on `where`. GEOMETRY — may be omitted or approximate; the server completes and repairs it: containers grow to fit their contents, declared left/right/above/below arrangement is kept, overlaps are separated, and gaps are normalised to margins. Omitting all geometry yields a vertical stack. IDS — name blocks with id="…" and those ids are kept, so the next connect/set_style/set_text call can use them without reading the diagram back. insert only ever adds: naming an id some block already has does NOT replace or update it — the new block is inserted under a generated id instead, and the substitution is reported. To change a block you already have, use set_text/set_style/move/resize on its id, or delete it first. <container>, <text> and <icon> are placed; <path> and other elements are skipped (the blocks still insert; wire paths up afterwards with connect, then label a connector with set_text on the new path's id). Omit where (or pass {}) to append below existing canvas content — the only option on an empty diagram, where an unstyled container gets a visible default outline. Style attributes the fragment leaves unspecified inherit the most common unscoped value among existing elements of the same type, never one scoped to a class, an id or a selector. The resolved XML is returned wearing the class names get_diagram will show, inside the existing="true" containers it landed in.
list_diagrams
ChatGPTList the diagrams this server can open, with their ids and titles. Use it to find the diagramId of a diagram you did not create in this conversation, or to recover one you have lost track of: nothing is remembered between calls, so an id from here or from create_diagram is the only way to name a diagram.
move
ChatGPTMove blocks, either by a delta or to a named destination — give dx/dy or where, never both. dx/dy nudges: either one on its own is enough, the omitted axis is zero, so dy: 40 moves straight down. Neighbours are pushed aside, and the blocks stay in whatever container they are already in however far you push them — that container grows to keep hold of them rather than letting them escape. A nudge never changes what a block belongs to. Physics can absorb part of a delta; when what landed differs from what was asked for, the result says so per block. where relocates: it names where the blocks should end up, in the same drop-target vocabulary insert uses — {block, anchor, relation?, end?} (e.g. {block: "#zone", relation: "inside"} to put them in a container, {block: "#db", anchor: "right-edge"} to put them beside one), {between: [id1, id2]}, or omit where's fields and pass {} to append below existing canvas content. Room is made at the destination for the blocks' combined footprint and they are re-nested there, so this is the way to restructure. where may not name a block being moved, or one inside it.
normalize_diagram
ChatGPTPreflight nifdi XML before set_diagram: parse tolerant nifdi XML, report diagnostics, and return canonical normalized XML (with any omitted pos/size filled in) without editing the diagram. Asset references (asset="#asset-…") are resolved against the named diagram's store. Useful before set_diagram to check accepted shorthands such as root title attributes, implicit canvas content, endpoint side attributes, bare ids, omitted pos/size on any block, nested below-icon captions with no pos/size (<icon asset="aws:amazon-ec2"><text>Label</text></icon>), and legacy comma style declarations.
redo
ChatGPTReinstate an undone change by seq (from get_history entries flagged undone), or the most recently undone change if seq is omitted.
render_diagram
ChatGPTSee the diagram: renders it to a PNG and returns the picture, so you can look at what you have built instead of inferring it from XML. This is a screenshot of the real thing — nifdi's own renderer draws it, the same way the live editor and the saved .nifdi.svg file do — so drop-shadows, rounded borders, markers and icon artwork are all as they will be. Use it to check what only a picture can tell you: overall layout, what overlaps or collides, whether a label landed on the host you meant, where a connector routed, how the colours read. Cheap and read-only — render after building the first blocks, after each batch of edits, and once before you call a diagram finished, then fix what you see. Reports the pixel size, the diagram's own size and the scale used, plus a note for any artwork shown as a placeholder.
resize
ChatGPTResize blocks to an explicit size, with reflow physics: contents keep their padding, neighbours are pushed aside, and paths re-route. width/height set the size absolutely; dWidth/dHeight adjust relatively. Omitted axes keep their current size; blocks grow/shrink toward the bottom-right. Icons are square — one axis is enough. Text blocks are not resizable here: set the wrap-width style instead. A block cannot go smaller than its own contents plus their margins: an axis asked below that floor lands on it, and the result says what landed. To go smaller, shrink the contents first — a label's margin or font-size, an icon's size.
reverse
ChatGPTReverse the direction of paths
search_icons
ChatGPTSearch the installed icon libraries (aws, azure, generic, google-cloud, iconoir) for official product and concept artwork. Returns matches with a ref like "aws:amazon-ec2" to use directly as the asset attribute of an <icon> in insert or set_diagram; the artwork and its licence provenance are copied into the diagram on use, so the saved file stays self-contained. Try product names ("EC2", "Cloud SQL"), concepts ("database", "user", "queue") or category words. Terms are matched loosely and ranked by how much of the query an icon covers, so an extra or unofficial word narrows the ranking rather than emptying the result — note names any term nothing matched at all. library is a preference, not a filter: the search always runs across every library, in-library matches come back in results and the rest in otherLibraries, so a scoped query never comes back empty without telling you the answer was elsewhere. add_asset is for artwork no library covers.
set_background
ChatGPTSet a container's background: an image, a solid colour, or cleared. This paints one block. The page behind the diagram is not a container and is not reachable here — style it with set_style canvas { fill-colour: #ffffff; pattern-type: none }, where pattern-type none clears the dot grid a new diagram starts with. For an image, pass the asset reference from add_asset (or get_diagram); the image cover-scales to fill the container, clipped to its shape (including corner radius), and moves with it. crop [x0 y0 x1 y1] in image pixels selects the visible viewport of the image; it defaults to the whole image. The image is not a separate block — it is part of the container, and clears when the container is deleted.
set_diagram
ChatGPTReplace the diagram with nifdi XML — the complete, authoritative model. For partial construction prefer insert + connect + set_style; use set_diagram when replacing the whole diagram. This is a clean replace: blocks, paths, title and source are taken verbatim from the XML. Blocks carry pos="x y" and size="w h", both optional — geometry may be omitted or approximate and the server completes and repairs it, the same as insert; a version attribute is not required. Standard shape is <diagram><title/><canvas/><style/></diagram>, but tolerant input also accepts direct diagram children as implicit canvas content, root title="...", endpoint side="...", and bare or block ids. get_diagram returns the canonical normalized result. Label a connector by nesting the label inside its <path> — with no pos/size, so nifdi places it on the line and keeps it there when the path re-routes: <path><from block="#a" attach="right"/><to block="#b" attach="left"/><text>Transformed data</text></path> Plain nifdi XML cannot carry new asset content: an <assets> block in XML is ignored, and icons must reference assets already in the store by id (unknown asset ids render as placeholders). To upload icons or background images, pass a full augmented .nifdi.svg document instead — its embedded asset content is uploaded to the diagram's asset store. To adjust a diagram to match a source language while preserving styling and manual layout, use set_source instead. Parse diagnostics are reported in the result.
set_source
ChatGPTUpdate the diagram to match this source (e.g. Mermaid). Adds, removes and relabels nodes to agree with the source, but preserves styling, manual layout, icons, and elements the source language can't represent. This is a merge, not a replace — to replace the whole model use set_diagram. On a diagram with no source yet, a box whose label matches exactly one node is adopted as that node, keeping its style and position; nodes with no matching box are added below the existing content.
set_style
ChatGPTApply a nifdi style sheet to the diagram, with reflow physics. style is CSS-like: one or more selector { property: value; ... } rules, the same canonical semicolon grammar as the <style> block in get_diagram/insert (commas are accepted only for legacy XML compatibility). Every property name, per element type, is on the `style` parameter below. ONE VOCABULARY — this grammar and a <style> block accept the same property names and the same values, so a declaration that works in one works in the other. Canonical longhands are globally unique: use icon-colour, text-alignment, shadow-std-deviation, marker-end-width. A property or value the element cannot take is named and skipped by both, never silently dropped — and the skip names the property that would have worked, so guessing costs one call rather than a read-back. SELECTORS — target anything: #id (a specific block or path), a type (container, text, icon, path), .class (every element get_diagram shows carrying that class), or canvas. Comma-group them to style a mixed selection at once, and descendant/child selectors work as in CSS — both spelled out on the style parameter. A rule narrower than a bare type rule keeps its values on the elements it named: they are not folded into the type rule on the next read, and a block inserted afterwards does not inherit them. Later rules win. Colours are hex like #aabbcc. TEXT INSIDE — a text property written on a container, an icon or a path styles the text inside it, as CSS does for inheritable properties: .titleText { font-weight: 700 } is applied as .titleText text { font-weight: 700 }, and the result says so. Direct application always wins, so icon-colour on an icon is still its tint. canvas does not cascade — every text on the canvas is text { ... }. Returns the resolved attributes applied (with the ids each landed on) and any skipped declarations.
set_text
ChatGPTSet text content with reflow physics. WITHOUT place this is what typing on the target does: a text block sets its content; a container or intersection sets its immediate child text, creating that text inside it when it has none; an icon sets its caption, creating one below it when it has none. WITH place it addresses an attachment site on the named host instead, and touches nothing else there — so place: "top-left-corner" on a captioned icon adds a badge rather than moving the caption. A corner or <edge> site holds one attachment: text already there has its content set where it stands, an empty site gets a new label, and a site held by something carrying no text is refused, naming the occupant. An on <edge>/outside <edge> site is unlimited, so it always creates. To MOVE an existing label, name that text's own id (get_diagram carries it) with the place to move it to and no content — it keeps its words. A container's contained text sits at no site, so place on a container titles its border beside whatever it already holds. The result names what each id took — set, created, refused or skipped — and a create that lands beside an existing label names that label, so a second attachment is never mistaken for a move. A path id sets that connector's label, creating it if the connector has none and updating it if it has one. The label rides the connector and re-places itself when the path re-routes. This is also the repair for a label authored the wrong way round: if a free text block is already sitting beside, above or below an icon, delete it and set_text the icon with place naming that side, so the label becomes the icon's and moves with it. Content is markdown (see content): one block holds a whole note or caption, so never spread its lines across several text blocks.
set_title
ChatGPTSet the diagram title
undo
ChatGPTUndo a change by seq (from get_history), or the most recent change if seq is omitted — the history is unified, so this undoes the last change regardless of who made it (you, another agent, or a human in the live editor). The authority replays the history without that change, so work layered on top of it is preserved. A change is undone whole, however many ops it took. Fails if the change is already undone or has been baked into the canonical base by a reconciliation.