Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions docs/technical-details.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,17 @@ the model can act on. The model sees `error out` of the tool VI like any other
output. Unknown tools and malformed requests are JSON-RPC errors. A tool VI
with a broken run arrow is answered with error `1003`.

Before a tool or prompt VI runs, the server switches off *automatic error
handling* (VI Properties > Execution) in memory, for the VI itself and for
every subVI it calls, level by level. With it on, an error on an output that
is not wired opens LabVIEW's modal error dialog, in the tool VI or in any of
its subVIs, and the server would stop answering until someone pressed
Continue. VIs under `vi.lib` and locked or password-protected VIs are left
alone. No VI is saved; in the IDE a VI that had it on may show as modified
afterwards. In a built application the setting
cannot be changed at run time, so wire the error outputs inside tool VIs
anyway.

## Asking the user (elicitation)

MCP 2026-07-28 is stateless: the server cannot hold a call open while the user
Expand Down
Binary file modified src/MCP Server/Add Array Items To Schema.vi
Binary file not shown.
Binary file modified src/MCP Server/Add Control Details To Schema.vi
Binary file not shown.
Binary file modified src/MCP Server/Add Prompt.vi
Binary file not shown.
Binary file modified src/MCP Server/Add Resource (File).vi
Binary file not shown.
Binary file modified src/MCP Server/Add Structured Content.vi
Binary file not shown.
Binary file modified src/MCP Server/Add Tool.vi
Binary file not shown.
Binary file modified src/MCP Server/Build Content.vi
Binary file not shown.
Binary file modified src/MCP Server/Build Error Response.vi
Binary file not shown.
Binary file modified src/MCP Server/Build Method Not Found Response.vi
Binary file not shown.
Binary file modified src/MCP Server/Build Picture JSON.vi
Binary file not shown.
Binary file modified src/MCP Server/Build Prompt List JSON.vi
Binary file not shown.
Binary file modified src/MCP Server/Build Response Error.vi
Binary file not shown.
Binary file modified src/MCP Server/Build Response Message.vi
Binary file not shown.
Binary file modified src/MCP Server/Build Text JSON for MCP.vi
Binary file not shown.
Binary file modified src/MCP Server/Build Tool.vi
Binary file not shown.
Binary file modified src/MCP Server/Cache Hints.vi
Binary file not shown.
Binary file modified src/MCP Server/Call VI.vi
Binary file not shown.
Binary file modified src/MCP Server/Check Client Access.vi
Binary file not shown.
Binary file modified src/MCP Server/Check MCP Names.vi
Binary file not shown.
Binary file modified src/MCP Server/Check Modern MCP Request.vi
Binary file not shown.
Binary file modified src/MCP Server/Check Prompt Arguments.vi
Binary file not shown.
Binary file modified src/MCP Server/Check Tool Arguments.vi
Binary file not shown.
Binary file modified src/MCP Server/Choose Protocol Version.vi
Binary file not shown.
Binary file modified src/MCP Server/Clean Error Message.vi
Binary file not shown.
Binary file modified src/MCP Server/Clear Tools.vi
Binary file not shown.
Binary file modified src/MCP Server/Complete Tool Entry.vi
Binary file not shown.
Binary file modified src/MCP Server/Convert Image To Base64.vi
Binary file not shown.
Binary file modified src/MCP Server/Create Events.vi
Binary file not shown.
Binary file modified src/MCP Server/Create Server.vi
Binary file not shown.
Binary file modified src/MCP Server/Decode Header Value.vi
Binary file not shown.
Binary file modified src/MCP Server/Default Tool Arguments.vi
Binary file not shown.
Binary file not shown.
Binary file modified src/MCP Server/Finish Tool Call Response.vi
Binary file not shown.
Binary file modified src/MCP Server/Generate Unique Server ID.vi
Binary file not shown.
Binary file modified src/MCP Server/Get Connector Pane Info.vi
Binary file not shown.
Binary file modified src/MCP Server/Get ID from JSON.vi
Binary file not shown.
Binary file modified src/MCP Server/Get ID from name.vi
Binary file not shown.
Binary file modified src/MCP Server/Get Parameter.vi
Binary file not shown.
Binary file modified src/MCP Server/Get Prompts.vi
Binary file not shown.
Binary file modified src/MCP Server/Get Resources.vi
Binary file not shown.
Binary file modified src/MCP Server/Get Server Name from ID.vi
Binary file not shown.
Binary file modified src/MCP Server/Get Server.vi
Binary file not shown.
Binary file modified src/MCP Server/Get Tool.vi
Binary file not shown.
Binary file modified src/MCP Server/Get Tools.vi
Binary file not shown.
Binary file modified src/MCP Server/Handle Server Request Batch.vi
Binary file not shown.
Binary file modified src/MCP Server/Handle Server Request.vi
Binary file not shown.
Binary file modified src/MCP Server/Is Supported Protocol Version.vi
Binary file not shown.
Binary file modified src/MCP Server/JSON To Control Value.vi
Binary file not shown.
Binary file modified src/MCP Server/LV Type To JSON Schema.vi
Binary file not shown.
Binary file modified src/MCP Server/LV type to MCP type.vi
Binary file not shown.
Binary file modified src/MCP Server/Legacy Cancellations.vi
Binary file not shown.
Binary file modified src/MCP Server/List Control Elements.vi
Binary file not shown.
Binary file modified src/MCP Server/Log.vi
Binary file not shown.
Binary file modified src/MCP Server/MCP Connection Probe/Connection Local IP.vi
Binary file not shown.
Binary file modified src/MCP Server/MCP SSE Response/Abort Stream.vi
Binary file not shown.
Binary file modified src/MCP Server/MCP SSE Response/Create MCP SSE Response.vi
Binary file not shown.
Binary file modified src/MCP Server/MCP SSE Response/Get Queues.vi
Binary file not shown.
Binary file modified src/MCP Server/MCP SSE Response/Next Segment.vi
Binary file not shown.
Binary file modified src/MCP Server/MCP SSE Response/Stream Length.vi
Binary file not shown.
1 change: 1 addition & 0 deletions src/MCP Server/MCP Server.lvlib
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@
<Item Name="Input Required Response.vi" Type="VI" URL="../Input Required Response.vi"/>
<Item Name="Response Status Code.vi" Type="VI" URL="../Response Status Code.vi"/>
<Item Name="Should Send Progress.vi" Type="VI" URL="../Should Send Progress.vi"/>
<Item Name="Disable Automatic Error Handling.vi" Type="VI" URL="../Disable Automatic Error Handling.vi"/>
</Item>
<Item Name="SSE" Type="Folder">
<Item Name="MCP SSE Response.lvclass" Type="LVClass" URL="../MCP SSE Response/MCP SSE Response.lvclass"/>
Expand Down
Binary file modified src/MCP Server/Make Output Property Schema.vi
Binary file not shown.
Binary file modified src/MCP Server/Make Output Schema.vi
Binary file not shown.
Binary file modified src/MCP Server/Make Schema Details.vi
Binary file not shown.
Binary file modified src/MCP Server/Mark Tool Error Result.vi
Binary file not shown.
Binary file modified src/MCP Server/Negotiate Protocol Version.vi
Binary file not shown.
Binary file modified src/MCP Server/Null Id For Parse Error.vi
Binary file not shown.
Binary file modified src/MCP Server/Read Numeric Limits.vi
Binary file not shown.
Binary file modified src/MCP Server/Read Resource Contents.vi
Binary file not shown.
Binary file modified src/MCP Server/Reinitialize VI Inputs.vi
Binary file not shown.
Binary file modified src/MCP Server/Reject Invalid Request.vi
Binary file not shown.
Binary file modified src/MCP Server/Reject Non Object Message.vi
Binary file not shown.
Binary file modified src/MCP Server/Remove Default Error Description.vi
Binary file not shown.
Binary file modified src/MCP Server/Remove Empty Description.vi
Binary file not shown.
Binary file modified src/MCP Server/Remove Server.vi
Binary file not shown.
Binary file modified src/MCP Server/Restore Request ID.vi
Binary file not shown.
Binary file modified src/MCP Server/Send onError.vi
Binary file not shown.
Binary file modified src/MCP Server/Send onRpc.vi
Binary file not shown.
Binary file modified src/MCP Server/Server Access Settings.vi
Binary file not shown.
Binary file modified src/MCP Server/Server FGV.vi
Binary file not shown.
Binary file modified src/MCP Server/Set LabVIEW Version.vi
Binary file not shown.
Binary file modified src/MCP Server/Set Parameters.vi
Binary file not shown.
Binary file modified src/MCP Server/Set Tool Annotations.vi
Binary file not shown.
Binary file modified src/MCP Server/Set Tool Title.vi
Binary file not shown.
Binary file modified src/MCP Server/Start.vi
Binary file not shown.
Binary file modified src/MCP Server/Stop.vi
Binary file not shown.
Binary file modified src/MCP Server/Strip Error Details.vi
Binary file not shown.
Binary file modified src/MCP Server/Supported Protocol Versions.vi
Binary file not shown.
Binary file modified src/MCP Server/To MCP Name.vi
Binary file not shown.
Binary file modified src/MCP Server/Validate HTTP Request.vi
Binary file not shown.
Binary file modified src/MCP Server/exit.vi
Binary file not shown.
Binary file modified src/MCP Server/initialize.vi
Binary file not shown.
Binary file modified src/MCP Server/ping.vi
Binary file not shown.
Binary file modified src/MCP Server/prompts get.vi
Binary file not shown.
Binary file modified src/MCP Server/prompts list.vi
Binary file not shown.
Binary file modified src/MCP Server/resources list.vi
Binary file not shown.
Binary file modified src/MCP Server/resources read.vi
Binary file not shown.
Binary file modified src/MCP Server/resources templates list.vi
Binary file not shown.
Binary file modified src/MCP Server/shutdown.vi
Binary file not shown.
Binary file modified src/MCP Server/tool call.vi
Binary file not shown.
Binary file modified src/MCP Server/tool list.vi
Binary file not shown.
Binary file added tests/Add Fixture Unwired Error Tool.vi
Binary file not shown.
37 changes: 21 additions & 16 deletions tests/MCP Server tests.lvlib
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
<Item Name="fake tool add.vi" Type="VI" URL="../fake tool add.vi"/>
<Item Name="fake tool annotated.vi" Type="VI" URL="../fake tool annotated.vi"/>
<Item Name="fake tool array shapes.vi" Type="VI" URL="../fake tool array shapes.vi"/>
<Item Name="fake tool schema shapes.vi" Type="VI" URL="../fake tool schema shapes.vi"/>
<Item Name="fake tool schema details.vi" Type="VI" URL="../fake tool schema details.vi"/>
<Item Name="fake tool arrays.vi" Type="VI" URL="../fake tool arrays.vi"/>
<Item Name="fake tool broken vi.vi" Type="VI" URL="../fake tool broken vi.vi"/>
<Item Name="fake tool confirm.vi" Type="VI" URL="../fake tool confirm.vi"/>
Expand All @@ -31,39 +29,46 @@
<Item Name="fake tool no inputs outputs.vi" Type="VI" URL="../fake tool no inputs outputs.vi"/>
<Item Name="fake tool picture outputs.vi" Type="VI" URL="../fake tool picture outputs.vi"/>
<Item Name="fake tool progress.vi" Type="VI" URL="../fake tool progress.vi"/>
<Item Name="fake tool return error.vi" Type="VI" URL="../fake tool return error.vi"/>
<Item Name="fake tool required input.vi" Type="VI" URL="../fake tool required input.vi"/>
<Item Name="fake tool return error.vi" Type="VI" URL="../fake tool return error.vi"/>
<Item Name="fake tool schema details.vi" Type="VI" URL="../fake tool schema details.vi"/>
<Item Name="fake tool schema shapes.vi" Type="VI" URL="../fake tool schema shapes.vi"/>
<Item Name="fake tool special labels.vi" Type="VI" URL="../fake tool special labels.vi"/>
<Item Name="fake tool unwired error.vi" Type="VI" URL="../fake tool unwired error.vi"/>
<Item Name="fake unwired error subvi.vi" Type="VI" URL="../fake unwired error subvi.vi"/>
<Item Name="fake_tool_say_hello.vi" Type="VI" URL="../fake_tool_say_hello.vi"/>
</Item>
</Item>
<Item Name="SubVIs" Type="Folder">
<Item Name="Add Fixture Array Shapes Tool.vi" Type="VI" URL="../Add Fixture Array Shapes Tool.vi"/>
<Item Name="Add Fixture Annotated Tool.vi" Type="VI" URL="../Add Fixture Annotated Tool.vi"/>
<Item Name="Add Fixture Array Shapes Tool.vi" Type="VI" URL="../Add Fixture Array Shapes Tool.vi"/>
<Item Name="Add Fixture Confirm Tool.vi" Type="VI" URL="../Add Fixture Confirm Tool.vi"/>
<Item Name="Add Fixture Error Descriptions Tool.vi" Type="VI" URL="../Add Fixture Error Descriptions Tool.vi"/>
<Item Name="Add Fixture Files.vi" Type="VI" URL="../Add Fixture Files.vi"/>
<Item Name="Add Fixture Picture Tool.vi" Type="VI" URL="../Add Fixture Picture Tool.vi"/>
<Item Name="Add Fixture Prompt.vi" Type="VI" URL="../Add Fixture Prompt.vi"/>
<Item Name="Add Fixture Progress Tool.vi" Type="VI" URL="../Add Fixture Progress Tool.vi"/>
<Item Name="Add Fixture Schema Shapes Tool.vi" Type="VI" URL="../Add Fixture Schema Shapes Tool.vi"/>
<Item Name="Add Fixture Prompt.vi" Type="VI" URL="../Add Fixture Prompt.vi"/>
<Item Name="Add Fixture Schema Details Tool.vi" Type="VI" URL="../Add Fixture Schema Details Tool.vi"/>
<Item Name="Add Fixture Schema Shapes Tool.vi" Type="VI" URL="../Add Fixture Schema Shapes Tool.vi"/>
<Item Name="Add Fixture Special Labels Tool.vi" Type="VI" URL="../Add Fixture Special Labels Tool.vi"/>
<Item Name="Add Fixture Tool.vi" Type="VI" URL="../Add Fixture Tool.vi"/>
<Item Name="Add Fixture Unwired Error Tool.vi" Type="VI" URL="../Add Fixture Unwired Error Tool.vi"/>
<Item Name="JSON item equals.vi" Type="VI" URL="../JSON item equals.vi"/>
<Item Name="Progress Fixture Record.vi" Type="VI" URL="../Progress Fixture Record.vi"/>
<Item Name="Send HTTP request (custom).vi" Type="VI" URL="../Send HTTP request (custom).vi"/>
<Item Name="Send HTTP request.vi" Type="VI" URL="../Send HTTP request.vi"/>
<Item Name="Send MCP request (headers).vi" Type="VI" URL="../Send MCP request (headers).vi"/>
</Item>
<Item Name="tests" Type="Folder">
<Item Name="test access allowed clients.vi" Type="VI" URL="../test access allowed clients.vi"/>
<Item Name="test access bearer token.vi" Type="VI" URL="../test access bearer token.vi"/>
<Item Name="test add prompt name clash.vi" Type="VI" URL="../test add prompt name clash.vi"/>
<Item Name="test add tool name clash.vi" Type="VI" URL="../test add tool name clash.vi"/>
<Item Name="test batch.vi" Type="VI" URL="../test batch.vi"/>
<Item Name="test broken tool message.vi" Type="VI" URL="../test broken tool message.vi"/>
<Item Name="test broken tool.vi" Type="VI" URL="../test broken tool.vi"/>
<Item Name="test empty msg.vi" Type="VI" URL="../test empty msg.vi"/>
<Item Name="test elicitation.vi" Type="VI" URL="../test elicitation.vi"/>
<Item Name="test empty msg.vi" Type="VI" URL="../test empty msg.vi"/>
<Item Name="test http get rejected.vi" Type="VI" URL="../test http get rejected.vi"/>
<Item Name="test http origin.vi" Type="VI" URL="../test http origin.vi"/>
<Item Name="test http protocol version.vi" Type="VI" URL="../test http protocol version.vi"/>
Expand All @@ -78,25 +83,25 @@
<Item Name="test non object message.vi" Type="VI" URL="../test non object message.vi"/>
<Item Name="test notification accepted.vi" Type="VI" URL="../test notification accepted.vi"/>
<Item Name="test ping.vi" Type="VI" URL="../test ping.vi"/>
<Item Name="test progress cancel by close.vi" Type="VI" URL="../test progress cancel by close.vi"/>
<Item Name="test progress legacy cancel.vi" Type="VI" URL="../test progress legacy cancel.vi"/>
<Item Name="test progress notifications.vi" Type="VI" URL="../test progress notifications.vi"/>
<Item Name="test prompt required argument.vi" Type="VI" URL="../test prompt required argument.vi"/>
<Item Name="test prompt without arguments.vi" Type="VI" URL="../test prompt without arguments.vi"/>
<Item Name="test prompts list required.vi" Type="VI" URL="../test prompts list required.vi"/>
<Item Name="test prompts list.vi" Type="VI" URL="../test prompts list.vi"/>
<Item Name="test progress cancel by close.vi" Type="VI" URL="../test progress cancel by close.vi"/>
<Item Name="test progress legacy cancel.vi" Type="VI" URL="../test progress legacy cancel.vi"/>
<Item Name="test progress notifications.vi" Type="VI" URL="../test progress notifications.vi"/>
<Item Name="test access allowed clients.vi" Type="VI" URL="../test access allowed clients.vi"/>
<Item Name="test access bearer token.vi" Type="VI" URL="../test access bearer token.vi"/>
<Item Name="test protocol version negotiation.vi" Type="VI" URL="../test protocol version negotiation.vi"/>
<Item Name="test protocol version fallback.vi" Type="VI" URL="../test protocol version fallback.vi"/>
<Item Name="test protocol version negotiation.vi" Type="VI" URL="../test protocol version negotiation.vi"/>
<Item Name="test request status.vi" Type="VI" URL="../test request status.vi"/>
<Item Name="test request without method.vi" Type="VI" URL="../test request without method.vi"/>
<Item Name="test resource blob.vi" Type="VI" URL="../test resource blob.vi"/>
<Item Name="test resource templates list.vi" Type="VI" URL="../test resource templates list.vi"/>
<Item Name="test resource text utf8.vi" Type="VI" URL="../test resource text utf8.vi"/>
<Item Name="test resources list.vi" Type="VI" URL="../test resources list.vi"/>
<Item Name="test server discover.vi" Type="VI" URL="../test server discover.vi"/>
<Item Name="test streamed tool error.vi" Type="VI" URL="../test streamed tool error.vi"/>
<Item Name="test string id.vi" Type="VI" URL="../test string id.vi"/>
<Item Name="test tool automatic error handling.vi" Type="VI" URL="../test tool automatic error handling.vi"/>
<Item Name="test tool call default arguments.vi" Type="VI" URL="../test tool call default arguments.vi"/>
<Item Name="test tool call without arguments.vi" Type="VI" URL="../test tool call without arguments.vi"/>
<Item Name="test tool error result.vi" Type="VI" URL="../test tool error result.vi"/>
Expand All @@ -108,13 +113,13 @@
<Item Name="test tools call.vi" Type="VI" URL="../test tools call.vi"/>
<Item Name="test tools list array items.vi" Type="VI" URL="../test tools list array items.vi"/>
<Item Name="test tools list array shapes.vi" Type="VI" URL="../test tools list array shapes.vi"/>
<Item Name="test tools list descriptions defaults ranges.vi" Type="VI" URL="../test tools list descriptions defaults ranges.vi"/>
<Item Name="test tools list error descriptions.vi" Type="VI" URL="../test tools list error descriptions.vi"/>
<Item Name="test tools list every array has items.vi" Type="VI" URL="../test tools list every array has items.vi"/>
<Item Name="test tools list mcp names.vi" Type="VI" URL="../test tools list mcp names.vi"/>
<Item Name="test tools list output schema.vi" Type="VI" URL="../test tools list output schema.vi"/>
<Item Name="test tools list title annotations.vi" Type="VI" URL="../test tools list title annotations.vi"/>
<Item Name="test tools list schema details.vi" Type="VI" URL="../test tools list schema details.vi"/>
<Item Name="test tools list descriptions defaults ranges.vi" Type="VI" URL="../test tools list descriptions defaults ranges.vi"/>
<Item Name="test tools list error descriptions.vi" Type="VI" URL="../test tools list error descriptions.vi"/>
<Item Name="test tools list title annotations.vi" Type="VI" URL="../test tools list title annotations.vi"/>
<Item Name="Test tools list.vi" Type="VI" URL="../Test tools list.vi"/>
<Item Name="test unknown method.vi" Type="VI" URL="../test unknown method.vi"/>
<Item Name="test unknown notification.vi" Type="VI" URL="../test unknown notification.vi"/>
Expand Down
Binary file modified tests/Test_MCP_Server.vi
Binary file not shown.
Binary file added tests/fake tool unwired error.vi
Binary file not shown.
Binary file added tests/fake unwired error subvi.vi
Binary file not shown.
Binary file added tests/test streamed tool error.vi
Binary file not shown.
Binary file added tests/test tool automatic error handling.vi
Binary file not shown.
17 changes: 16 additions & 1 deletion tools/test/Test-McpServer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ Sends requests with curl to an MCP server reachable over HTTP and checks the
answers against the Model Context Protocol specification (Streamable HTTP
transport, JSON-RPC rules, lifecycle, and the list methods of tools, prompts
and resources). It works against any server: nothing depends on which tools,
prompts or resources are registered, and no tool is called.
prompts or resources are registered, and no registered tool is called (only a
tool name that does not exist, plainly and with a progressToken).

Every check is printed as PASS or FAIL. "required" checks are things the
specification demands; "advisory" checks are recommendations or behaviour
Expand Down Expand Up @@ -167,6 +168,20 @@ if (Test-HasProperty $capabilities 'tools') {
$r = Send-Request -Body '{"jsonrpc":"2.0","id":11,"method":"tools/call","params":{"name":"this_tool_does_not_exist","arguments":{}}}'
$failed = (Test-HasProperty $r.Json 'error') -or ((Test-HasProperty $r.Json 'result') -and (Test-HasProperty $r.Json.result 'isError') -and $r.Json.result.isError)
Add-Result 'Tools' 'calling an unknown tool is answered with an error' ($failed -and $r.Json.id -eq 11) "status $($r.Status), body: $(Get-Short $r.Raw)"

# The same call with a progressToken: a server may now answer with an SSE stream. A failing call
# must still be answered, and must not leave the server unable to answer the next request.
$r = Send-Request -Body '{"jsonrpc":"2.0","id":12,"method":"tools/call","params":{"name":"this_tool_does_not_exist","arguments":{},"_meta":{"progressToken":"t12"}}}'
$answer = $r.Json
if ($r.Headers -match '(?im)^content-type:\s*text/event-stream') {
$last = @($r.Raw -split '\r?\n' | Where-Object { $_ -match '^data:' }) | Select-Object -Last 1
$answer = $null
if ($last) { try { $answer = ($last -replace '^data:\s*', '') | ConvertFrom-Json } catch { $answer = $null } }
}
$failed = (Test-HasProperty $answer 'error') -or ((Test-HasProperty $answer 'result') -and (Test-HasProperty $answer.result 'isError') -and $answer.result.isError)
Add-Result 'Tools' 'calling an unknown tool with a progressToken is answered with an error' ($failed -and $answer.id -eq 12) "status $($r.Status), body: $(Get-Short $r.Raw)"
$r = Send-Request -Body '{"jsonrpc":"2.0","id":13,"method":"tools/list","params":{}}'
Add-Result 'Tools' 'the server still answers after that call' ($r.Status -eq 200 -and $r.Json.id -eq 13) "status $($r.Status) within $TimeoutSeconds s, body: $(Get-Short $r.Raw)"
}

if (Test-HasProperty $capabilities 'prompts') {
Expand Down
Loading