Agents & MCP

Tool reference

This is the full list of tools Nox gives an agent: 45, in five groups. Each entry says what the tool does and names the arguments you will use most. Required arguments are in bold. The ten tools an agent uses most have an example of arguments, each one run on a real document. The tools describe themselves to the agent in more detail, so use this page to know what to ask for.

Rules every tool shares#

  • Ids. A node is named by its id, such as 100:5. Replies give ids, and get_tree and find look them up. Wherever an id is asked for, a Nox link (what Edit › Copy Link to Selection, ⌘L, copies) is taken too.
  • The page shown. Tools that measure, draw and export work on the page that is shown.
  • Units and colors. Lengths are the document's units, one pixel at scale 1. x and y are relative to the parent. Colors are #RRGGBB or #RRGGBBAA.
  • Errors. A call that cannot be done changes nothing and says what was wrong and what would be right. An unknown property is refused, with the list of properties, and never ignored.
  • Undo. Every change is a step that can be taken back. See How agents work in Nox.
  • Limits. create_nodes 2,000 nodes a call. update_nodes, move_nodes, delete_nodes 500. get_nodes, duplicate_nodes, export_assets, focus_nodes 100. batch 50 operations.

The tools#

Looking#

ToolWhat it doesMost used arguments
get_contextThe pages, the page shown, the selection and the view. Call it first.none
get_treeThe outline: id, kind and name of each node, nested. Deeper nodes are counted as child_count.root, depth (2), limit (200)
findNodes by name, text or kind; all given must hold. With in: "library" it searches what linked libraries offer.name, text, kind, under, limit (50)
get_nodesEvery property of the nodes named.ids
resolve_linkWhat a nox:// link names: each node's id, kind, name, path, page and box.link
inspectOne node for whoever builds it: its box, its distance to its parent's edges or to another node, what it follows, and the node as CSS and SwiftUI.node, to, shape
import_iconsIcon files or folders (SVG, PDF, PNG, JPEG, WebP) brought in as components, one a file. Nox comes with no icons of its own.paths, size, color, existing
list_assetsThe document's icons, pictures and fonts, and whether this Mac has each font.kind, query
embed_fontsPuts the font files the texts use inside the document, or removes or lists them.action
list_colorsEach color used in some nodes, with how often.ids
check_designWhat a reviewer would raise: contrast, clipped layers, small targets, near colors, unused components and variables, missing fonts, token and flow problems.root, checks, modes, limit
check_iconOne icon checked: edges between pixels, unlike stroke weights, open paths, what reaches into the margin.node, padding
check_prototypeA page's flows, what each screen reaches, and interactions that do nothing. play follows events.page, play
commentsLists the comments of a page, or adds, resolves, reopens or deletes one.add, resolve, node, unresolved
versionsLists the versions kept, keeps one now, restores or deletes one, or says what differs between two.keep, restore, diff

get_tree, one level of a card:

{ "root": "100:1", "depth": 1 }

find, every text that says "trial":

{ "kind": "text", "text": "trial" }

get_nodes, all properties of one node:

{ "ids": ["100:5"] }

check_design, one frame and what is in it:

{ "root": "100:1" }

A finding names the node, the problem in numbers and the fix: #B8BCC6 on #FFFFFF: a contrast of 1.90 to 1, where 4.5 to 1 is asked for ordinary text.

Changing#

Each change these make is one step that can be undone. A few sit in this group and change nothing: list_variables, play_flow, export_strings, export_tokens and get_document_text.

ToolWhat it doesMost used arguments
create_nodesMakes nodes, each with nested children, inside parent or on the page shown. See Drawing with create_nodes.nodes, parent
update_nodesChanges nodes. Each change names an id and only what changes; null removes a property.changes
move_nodesAnother parent, or another place in the stacking order. Also reorders pages.ids, parent, before, after, at
duplicate_nodesCopies nodes, dx and dy apart, count times. fill repeats across or down until the frame is full.ids, dx, dy, count, fill, into
arrange_nodesWhat the Arrange menu does: group, frame, component, auto layout, ungroup, align, distribute. Not in a batch.ids, action
delete_nodesDeletes nodes with everything in them.ids
add_statesGives a component the states Normal, Pressed, Disabled and Selected as variants; ["Hover"] adds a fifth.node, states
replace_colorOne color for another throughout some nodes: fills, strokes, gradient stops, shadows.ids, from, to
batchSeveral changes as one step, all or none. "@0.0" names the first node the first operation made.operations
list_variablesEvery variable set with its modes, and every variable with its values and its name in CSS, Swift and JSON.none
set_variablesMakes or changes many variables of one set by name. A new set needs modes.set, variables, modes
play_flowPlays the prototype where you see it and fires events. Changes nothing.start, events, stop
librariesAnother Nox document used as a library: link it, place a component from it, list and apply updates.action, path, component
extract_stringsMakes a text variable for each text of a frame, in the set Language, and binds the text to it.node, set, language
import_stringsTranslations in, from .xcstrings, .strings, JSON or CSV. A language is a mode.path or text, format, language, create
export_stringsThe strings out, in the same formats.format, language, path
export_tokensThe variables as CSS custom properties, a Swift Tokens namespace, or Design Tokens JSON.format, set, path
get_document_textThe document, or one node, as text with one property a line.node
undoTakes back the agent's own last step, never yours. redo makes it again.redo, steps
import_fileBrings in a .fig or .sketch file as new pages, or an .svg or .pdf as frames of shapes.path, component, width

create_nodes, a button that hugs its label:

{
  "nodes": [
    {
      "kind": "frame", "name": "Button", "x": 0, "y": 400, "width": "hug", "height": 44,
      "fill": "#5B5BD6", "corner_radius": 10,
      "layout": { "direction": "horizontal", "padding": [0, 20], "align": "center", "cross_align": "center" },
      "children": [
        { "kind": "text", "name": "Label", "text": "Start free trial",
          "font_family": "Inter", "font_size": 15, "font_weight": 600, "fill": "#FFFFFF" }
      ]
    }
  ]
}

update_nodes, two nodes changed in one call:

{
  "changes": [
    { "id": "100:4", "fill": "#5E6472", "font_size": 15, "line_height": 22 },
    { "id": "100:5", "height": 44 }
  ]
}

batch, a badge made, moved to the top of its card, and a button rounded, as one step:

{
  "operations": [
    { "tool": "create_nodes", "arguments": { "parent": "100:1", "nodes": [
      { "kind": "frame", "name": "Badge", "width": "hug", "height": 24, "fill": "#EEF0FF", "corner_radius": 12,
        "layout": { "direction": "horizontal", "padding": [0, 10], "cross_align": "center" },
        "children": [
          { "kind": "text", "name": "Badge label", "text": "Most popular",
            "font_family": "Inter", "font_size": 12, "font_weight": 600, "fill": "#4338CA" }
        ] }
    ] } },
    { "tool": "move_nodes", "arguments": { "ids": ["@0.0"], "before": "100:2" } },
    { "tool": "update_nodes", "arguments": { "changes": [{ "id": "100:5", "corner_radius": 22 }] } }
  ]
}

The tools a batch can hold are create_nodes, update_nodes, move_nodes, delete_nodes, duplicate_nodes, add_states and replace_color.

Showing#

ToolWhat it doesMost used arguments
show_pageMakes a page the one shown, in the app too.page
focus_nodesShows the nodes to you: their page, selected, and the view filled with them.ids, zoom (true)

Out#

ToolWhat it doesMost used arguments
render_previewA picture of one node, returned in the reply, to check work by eye. It can draw the node in another mode, at another width, with instances in another state, or an icon at several sizes.node, max_size (800), mode, width, sizes, states
export_imageOne node to one PNG, WebP or JPEG file.node, path, scale, background, quality
export_assetsNodes to files in a folder at each of scales, named after the node, with @2x and @3x. All or none.ids, folder, format, scales, mode, effects, metadata
export_svgA node as SVG, returned in the reply. current_color writes one plain color as currentColor.node, current_color
export_pdfNodes as the pages of one PDF, shapes as shapes and text as text.nodes, path
export_layerOne layer of what an instance shows, alone, as PNG, JPEG, WebP, SVG or PDF.instance, inside, path, scale
get_design_specA frame as what is to be built: its tree with boxes, colors, typography, tokens, states and the list of assets.node, depth (12), scales, mode

render_preview, a card drawn in the Dark mode of its variables, 640 pixels on its longest side:

{ "node": "100:1", "max_size": 640, "mode": "Dark" }

get_design_spec, a whole frame:

{ "node": "100:1" }

export_assets, a card and its button at 1x and 2x, with room for their shadows:

{ "ids": ["100:1", "100:5"], "folder": "/Users/me/Project/assets", "scales": [1, 2], "effects": true }

This run wrote Plan card.png, Plan card@2x.png, Button.png and Button@2x.png. The folder must exist.

Checking#

ToolWhat it doesMost used arguments
compare_imageHolds a PNG of the built thing against the node it was built from. Says how much differs, where, and on which nodes, and returns a picture with the differences in red.node, image, tolerance (24), mode

Which tool, when#

  • To start: get_context, then get_tree or find.
  • To draw: create_nodes for something new, update_nodes for a change, batch when several changes are one thing to you.
  • To finish: check_design, then render_preview.
  • To hand off: get_design_spec, export_assets, export_tokens, then compare_image on the build.

Agent recipes shows these loops call by call.