Skip to main content
Glama

vi_create

Creates a new LabVIEW VI from a specification, including front-panel controls/indicators and a wired block diagram, returning a summary and diagram image.

Instructions

Create a new VI with front-panel controls/indicators and a wired block diagram. Returns a summary and a picture of the generated diagram; then use vi_run to test it.

spec = { "controls": [{"name": "x", "type": "dbl", "label": "x", "default": 1.0}, ...], "indicators": [{"name": "result", "type": "dbl"}], "constants": [{"name": "k", "type": "dbl", "value": 2.5}], "functions": [{"name": "add", "function": "Add"}], # palette names; find them with # lv_functions(query) and their terminals with function_terminals(name) "subvis": [{"name": "s", "path": "C:\abs\Helper.vi"}], "wires": [["x", "add.x"], ["k", "add.y"], ["add.x+y", "result"]] } names are ids ([A-Za-z_][A-Za-z0-9_]). Wires go [from, to]. Controls, indicators and constants are referenced by name alone; functions and subVIs as "name.Terminal", where the terminal is its Context Help label (Add: x, y, x+y; Multiply: x, y, xy) or, for a subVI, the label of its control/indicator. Types: dbl, sgl, i8..i64, u8..u64, bool, string, path; arrays "dbl[]", "string[][]"; clusters {"cluster": [{"name": "a", "type": "dbl"}, ...]}; enums {"enum": ["Init", "Run", "Stop"]} (values, defaults and vi_run inputs/outputs are item names; a case on an enum has frames {"value": "Init"}, ...). Any other type (waveform, picture, timestamp, class objects, typedefs, numbers with units) can be copied from an existing VI: vi_dump gives such a control or constant a "flat" entry; use it as the type ({"flat": "...", "data": "..."}, with its default value).

Structures (top level or nested, in "structures"; they hold constants/functions/subvis/ structures of their own; all names are global and wires are always listed at the top level): {"name": "L", "type": "for_loop", "functions": [...], "shift_registers": ["acc"]} terminals L.N (count), L.i; shift register: acc.left (previous value), acc.right (next); acc.left[2], acc.left[3], ... stack it (values 2, 3, ... iterations back; wire each an initial value from outside like acc.left) {"name": "W", "type": "while_loop", "stop_if_true": true, ...} terminals W.i, W.stop {"name": "C", "type": "case", "output_tunnels": ["t"], "cases": [ {"value": true, ...contents}, {"value": 3}, {"value": "apple"}, {"default": true}]} terminal C.selector. Several values or ranges in one frame use LabVIEW's case-name text: {"value": "1..3, 5"}, {"value": "10.."}, {"value": ""a", "b""}. Values passing INTO a structure: wire the outer node straight to the inner node. Values leaving a loop: wire the inner node to the outer node (For Loops build an array, While Loops pass the last value). Values leaving a case: wire each frame's result to an output tunnel ("t"), then "t" to the destination. Example, sum of 0..n-1: {"controls": [{"name": "n", "type": "i32"}], "indicators": [{"name": "total", "type": "i32"}], "constants": [{"name": "zero", "type": "i32", "value": 0}], "structures": [{"name": "L", "type": "for_loop", "shift_registers": ["acc"], "functions": [{"name": "a", "function": "Add"}]}], "wires": [["n", "L.N"], ["zero", "acc.left"], ["acc.left", "a.x"], ["L.i", "a.y"], ["a.x+y", "acc.right"], ["acc.right", "total"]]} Functions LabVIEW's scripting has no name for (Merge Errors, First Call?, To Time Stamp, TDMS, newer file I/O, Shared Variable) are placed by their palette name and wired by terminal reference (not inside event frames); Merge Errors: "size" = inputs, wired m.error in[1], [2], ... Static VI Reference: {"name": "r", "function": "Static VI Reference", "vi": "<absolute .vi path>", "strict": true}; wire "r.vi reference" (not inside event frames). Growable functions take "size" (check it with function_terminals(name, size)): {"name": "cat", "function": "Concatenate Strings", "size": 3} -> inputs cat.element[1..3], output cat.concatenated string; Build Array likewise ("appended array"); Unbundle (by position, size = number of cluster elements) -> u.cluster in, u.element[i] out; Format Into String with 2 inputs -> "size": 5, wired as fs.input 1, fs.input 2. The names the diagram shows work too: Compound Arithmetic "value[k]", Concatenate Strings "string[k]", Build Array "array[k]", Build Cluster Array "component element[k]", Index & Bundle Cluster Array "component array[k]", Reshape Array "dimension size[k]" (size = 2 x dimensions), a grown 2-D Index Array "index (row)[k]" / "index (col)[k]" / "subarray[k]". Build Array with "concatenate": true joins array inputs end to end (Concatenate Inputs). Unbundle By Name / Bundle By Name: wire the cluster to "u.input cluster" and wire elements by name ("u.gain", "b.offset"); the node shows the elements its wires name, in wire order (or set "elements": [...] for another order). Build Waveform ("w.waveform" in, "w.output waveform" out) and Get Waveform Components ("g.waveform" in) work the same way with the components t0, dt, Y, attributes, error. A case wired to an error cluster has frames "No Error" and "Error". To pass a value through a case frame unchanged, give that frame "pass": [["acc.left", "t"]] (source, output tunnel); a wire from outside straight to an output tunnel does not work. Loop tunnels: a For Loop indexes arrays going in and builds arrays coming out, a While Loop does neither. To change that, give the wire as {"from": ..., "to": ..., "indexing": false} (or true; or {"": false} for one of several loops it crosses). Queues (producer/consumer, queued message handler): "Obtain Queue" (wire a constant of the element type to "element data type"; "queue out"), "Enqueue Element" ("queue", "element"), "Dequeue Element" ("queue", "element" out, "queue out"), "Release Queue" ("queue"). Loops in parallel share the queue wire; release it from the consumer's "queue out". State machine: a while loop with shift registers ["state", ...], the enum state wired to state.left -> C.selector, one case frame per state, each frame wiring the next state to an output tunnel -> state.right, and a boolean tunnel -> W.stop. Connector pane: every control and indicator is wired to the 4x2x2x4 connector pane so the VI works as a subVI right away (controls on the left then top, indicators on the right then bottom, in spec order). Pin a slot with "connector": "left3" (left0-3, top0-1, bottom0-1, right0-3) or leave one off with "connector": false. LabVIEW convention: error in at left3, error out at right3; type "error" is an error cluster. Front-panel look: "style" on a control/indicator replaces it with that Controls-palette object of the same data type: bool "Stop Button", "OK Button", "Round LED", "Vertical Toggle Switch"; numeric "Knob", "Gauge", "Thermometer", "Vertical Pointer Slide", "Waveform Chart" (dbl indicator). Restyled objects are restacked by their real size so none overlap. Labels may use any language. A control/indicator wired only inside a While Loop gets its terminal inside it (a Stop button read outside its loop would be read once); "in": "" / "#" / "" places it explicitly. A For Loop keeps outside terminals (its tunnels index arrays). User interfaces: an event structure, usually inside a while loop, runs one frame per user event: {"name": "E", "type": "event", "events": [ {"control": "stop"}, # "event" defaults to "Value Change" {"control": "go", "event": "Value Change", "functions": [...], ...contents}]} "control" names a control/indicator of the spec. Other events: "Mouse Down", "Mouse Up", "Mouse Enter", "Mouse Leave", "Key Down", ... Events of the VI itself have no "control": {"event": "Timeout", "timeout": 100, ...contents} # runs when no event came for 100 ms {"event": "Panel Close?", "filter": "f", ...} # wire a True constant to "f.Discard?" (also "Panel Close", "Panel Resize", "Key Down", "Mouse Enter", ...). Event data: "data": "d" names the frame's event data node; wire "d.NewVal", "d.OldVal", "d.Coords", "d.Button", "d.CtlRef", ... (the node shows the items that are wired). Code in a frame may be wired to code in the same frame and to objects outside the event structure, also shift registers and the output tunnels of a case around it. One frame can handle more events: "more": [{"control": "b"}, {"event": "Panel Close"}]. A value a frame passes on unchanged (state in a shift register) is listed in that frame's "wires": {"control": "stop", "wires": [["state.left", "state.right"]]}. A case output tunnel left unwired in some frames gives its default there. A front-panel terminal used by only one frame is placed in it (read when the event happens), and [button, "W.stop"] reads the button in its own frame and stops the loop W, as in NI's templates. Example: {"controls": [{"name": "stop", "type": "bool", "style": "Stop Button"}, {"name": "go", "type": "bool", "label": "Double it", "style": "OK Button"}, {"name": "x", "type": "dbl", "style": "Knob"}], "indicators": [{"name": "y", "type": "dbl", "style": "Gauge"}], "structures": [{"name": "W", "type": "while_loop", "structures": [{"name": "E", "type": "event", "events": [{"control": "stop"}, {"control": "go", "functions": [{"name": "m", "function": "Multiply"}], "constants": [{"name": "k", "type": "dbl", "value": 2}]}]}]}], "wires": [["stop", "W.stop"], ["x", "m.x"], ["k", "m.y"], ["m.x*y", "y"]]} Test a UI with vi_run's "actions" (click buttons, set values, read indicators while it runs). The new VI has LabVIEW's automatic error handling off, so an unwired error does not open a dialog that would block LabVIEW; "auto_error_handling": true in the spec keeps it on. "library": "<absolute .lvclass or .lvlib path>" in the spec makes the new VI a member of that class or library (then saved); a class member may Bundle/Unbundle the class's private data. vi_dump reports the library a VI belongs to as "library". Property and Invoke Nodes (top level, in loops, cases and event frames): "property_nodes": [{"name": "p", "control": "chart", "properties": ["Visible"], "write": true}, {"name": "a", "class": "Application", "properties": ["App.Version"]}], "invoke_nodes": [{"name": "i", "control": "x", "method": "Reinit To Dflt"}] "control" links the node to a front-panel object (it gets that object's class); "class" makes an unlinked node (wire a reference into "p.reference"; Application needs none). Properties are read unless "write" is true or lists them. Wire "p.Visible", "i.", "p.error in", "p.error out"; chain error wires to order nodes. Names are LabVIEW's short names ("Visible", "Value", "DefVal", "Disabled", "App.Version", method "Reinit To Dflt"). Nested properties are written as LabVIEW shows them: "Label.Text", "Plot.Plot Color", "YScale.Multiplier"; wire them the same way ("p.Label.Text"). A node linked to a chart, slide, listbox, ... needs that control's "style" ("Waveform Chart", "Vertical Fill Slide", "Listbox") so the control has those properties. The diagram is tidied with LabVIEW's Clean Up Diagram.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "path": "<path>",
      "spec": "<spec>"
    },
    "name": "vi_create"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYes
specYes
overwriteNo
descriptionNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.40.1

TDQS

A4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden and does disclose real behavioral traits: automatic error handling is off so unwired errors don't block LabVIEW (and can be re-enabled via the spec), every control/indicator is auto-wired to the connector pane, the diagram is run through LabVIEW's Clean Up Diagram, library membership triggers a save, and restyled objects are restacked. The notable gap is that it never says what happens when the target path already exists, despite an 'overwrite' flag.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

It is front-loaded correctly — purpose and the vi_run handoff come first, and the reference material follows. But the body is an undifferentiated wall of prose with two full inline examples and long enumerations, and sectioning or tighter grouping would make the same content far easier to scan.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool whose spec object is effectively a small language, the description is unusually complete: it covers the spec grammar, structure nesting rules, connector pane placement, and partially covers the return value (summary plus diagram picture). The remaining holes — path requirements, overwrite/description behavior, and whether a missing return-path directory is created — are modest against this much complexity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so the description must compensate, and it does so exhaustively for 'spec' — the type grammar, wiring rules, structures, queues, state machines, event structures, property/invoke nodes are all documented in detail. However, 'path', 'overwrite' (default false) and 'description' are never mentioned, so a third of the parameters carry no semantics beyond their bare titles.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The opening states a specific verb and resource ('Create a new VI with front-panel controls/indicators and a wired block diagram') and immediately names what it returns (a summary and a diagram picture), which separates it cleanly from vi_edit/vi_text. It also routes subtasks to siblings (vi_run to test, lv_functions and function_terminals to resolve palette/terminal names, vi_dump for unsupported types), so an agent can place it in the toolchain without opening any schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is clear and contextualized: create here, then test with vi_run's 'actions', and look up symbols with lv_functions/function_terminals before building the spec. It names the conditions that select those alternatives, but never states when NOT to use this tool — for example that an existing VI should be changed with vi_edit rather than recreated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.