Senzorv1.0.1

MCP tools

Every tool, resource and prompt of the Senzor MCP server, with arguments, results and errors.

senzor-cli mcp and the GUI with MCP on serve the same tools. For setup, see Controlling Senzor from an AI agent.

Conventions

  • Results are JSON objects. Clients that read only text get the same JSON as text.
  • Errors come back as a tool result marked as an error, with a one-line message, and nothing changes. Arguments that do not match a tool's input schema fail the same way, with failed to deserialize parameters: <reason>. Examples are a missing required argument, a key the project file does not know, or null as a pin value. Other arguments a tool does not know are ignored, so check the spelling: get_messages with instance_id instead of instance returns every instance's messages.
  • Times are RFC 3339 in UTC with milliseconds, for example 2026-11-04T14:02:11.123Z.
  • Durations in project-file keys are strings with a unit, for example "10s" or "500ms", as in the project file.
  • Passwords: every result shows the broker password as <redacted>. When set_project, set_broker or set (at broker.password) receives <redacted> as the password, the stored password is kept.
  • Waiting for the host. A tool that changes something waits up to 10 seconds for Senzor to apply it. In the GUI, the window applies changes while it draws frames. When the time runs out, the tool fails with the Senzor window did not respond within 10s; the request was cancelled and will not be applied (from senzor-cli mcp: Senzor did not respond within 10s; …). While Senzor shuts down, tools fail with Senzor is shutting down, and right after start with Senzor is still starting; try again.

Status values

status is an object whose state is one of:

stateOther keysMeaning
stoppedNot running.
connectingFirst connection attempt of this run.
onlineConnected; publishing on its interval.
reconnectingattempt, last_errorRetrying after a network error.
failedreasonThe broker refused the connection, or the instance crashed. Start it again to retry.

Instance summary

get_status and get_instance describe an instance with these keys:

KeyMeaning
idInstance ID, e.g. office-3.
deviceThe [[devices]] entry it belongs to.
statusSee Status values.
publishedMessages published since the project was opened or the instance was added. Stopping and restarting do not reset it.
receivedMessages received on the instance's subscriptions, counted the same way as published.
errorsMessages that could not be rendered or published, failed availability online messages and failed scripts, counted the same way as published.
last_publishTime of the last published message, or null.
pinnedFields forced to a value with pin.
needs_restartRunning with older broker settings or availability than the project's, which need a new connection; restart applies them.
orphanedRunning, but no longer in the project; it disappears once stopped.

Edit result

The tools that change the project return:

KeyMeaning
changedWhether the project changed. Replacing something with an identical copy changes nothing.
problemsEvery validation problem of the project now, each with location (e.g. device `office`) and message.
blockedDevices that cannot start because of problems.
needs_restartRunning instances that now need a restart to use the project's broker settings or availability.
orphanedRunning instances that are no longer in the project.

Each edit that changes the project is one step that undo takes back. Edits never start, stop or restart an instance, and they do not write the file: use save_project. A running instance takes an edit at once and stays connected, unless the edit changes its broker settings or availability; then it is listed in needs_restart. See Editing while running.

Observing

get_status

The project and every instance. No arguments.

KeyMeaning
pathThe project file, or null for a project that was never saved.
dirtyThe project has changes that are not saved.
broker_host, broker_portThe broker the project connects to.
problemsHow many validation problems the project has; get_project lists them.
open_errorWhy the project file could not be opened when senzor-cli mcp started, or when you last used Open in the GUI, or null. A failed open_project returns its error instead.
instancesEvery instance of the devices that can start, plus running orphans, as an instance summary, sorted by ID. Devices blocked by problems have no instances here.

get_instance

One instance with its values.

ArgumentTypeMeaning
instancestringInstance ID. Required.

Returns the instance summary and:

KeyMeaning
templateThe template the instance runs, or null for an orphan.
fieldsEvery field the instance publishes.
valuesThe latest value of each field: a number, true/false or a string. Empty before the first publish.

Errors: there is no instance `<id>`.

get_messages

Published messages, oldest first. These are the messages your templates define, as in the GUI's message log. The log keeps the last 1,000 messages and does not include the online and offline availability messages.

ArgumentTypeDefaultMeaning
after_seqinteger0Only messages with a higher sequence number. Pass the last_seq of the previous call to get only new messages.
instancestringOnly messages of this instance.
devicestringOnly messages of this device's instances.
topic_containsstringOnly messages whose topic contains this text (case-sensitive).
limitinteger100At most this many, from 1 to 1000; other values are clamped to that range. When more match, the newest are returned.
wait_secondsnumber0When no message matches yet, wait up to this long (at most 30; larger values count as 30, negative ones as 0) for one. The call returns as soon as one arrives.
KeyMeaning
messagesEach with seq, time, instance, topic, payload, qos and retain, plus the MQTT 5 properties the message was sent with: message_expiry (seconds), content_type and user_properties (an object of rendered values). Properties the message did not set are left out. A message with a binary encoding has no payload; it has encoding (hex, base64, cbor or protobuf), payload_base64 (the bytes sent, in standard base64) and rendered (the text they were encoded from) instead.
last_seqThe highest sequence number assigned so far. Sequence numbers keep growing when another project is opened.
truncatedMessages after after_seq left the 1,000-message log before they could be read.

list_templates

The built-in templates, then the project's own. No arguments.

KeyMeaning
templatesEach with id, builtin, interval (e.g. 10s), topics, fields (field name to generator, e.g. random_walk) and used_by (the devices that use it).

get_project

The project as TOML. No arguments.

KeyMeaning
tomlThe project as Save writes it, with the password shown as <redacted>.
pathThe project file, or null.
dirtyThe project has changes that are not saved.
problemsEvery validation problem, each with location and message.
blockedDevices that cannot start because of problems.

Running devices

start, stop, kill and restart take the same arguments. Give exactly one of all, devices and instances.

ArgumentTypeDefaultMeaning
allbooleantrue for every instance.
deviceslist of stringsDevice IDs: every instance of each.
instanceslist of stringsInstance IDs.
wait_secondsnumber5Wait up to this long (at most 60; larger values count as 60, negative ones as 0) for the instances to settle. 0 returns at once.

They return:

KeyMeaning
instancesEach affected instance with its id and status. The status is null for an orphan that left once it stopped.
timed_outSome instances had not settled when the wait ran out. Always false with wait_seconds = 0.

Errors, shared by all four:

  • a target is required: give exactly one of all = true, devices or instances
  • unknown device id(s): <ids> or unknown instance id(s): <ids>. Nothing is sent when any ID is unknown. For stop, kill and restart, running orphans and their device IDs count as known.

start

Starts stopped and failed instances; running ones are left alone. It waits until each instance is online, failed or reconnecting, so check the returned statuses.

Errors: device `<id>` has validation errors and cannot start; get_project lists them. This error is returned only when you name the blocked device in devices. An instance of a blocked device, named in instances, is reported as unknown, and all = true skips blocked devices.

stop

Stops running instances gracefully. Each publishes its offline message, if its template has availability, and disconnects, so the broker does not publish its Last Will. It waits until they are stopped.

kill

Drops the connections of running instances without a goodbye, as a device that loses power. The broker publishes the Last Will of each instance whose template has availability. It waits until they are stopped. See Simulating a device dropping off.

restart

Stops running instances gracefully and starts them again with the project's current settings. Stopped instances are started. Orphans are only stopped. It waits until the new run is online, failed or reconnecting.

Errors: the same as start for devices with validation errors.

pin

Forces a field of a running instance to a value, as Pin does in the instance view. The instance publishes that value until it is unpinned or stops.

ArgumentTypeMeaning
instancestringInstance ID. Required.
fieldstringField name, e.g. co2. Required.
valuenumber, boolean or stringThe value to publish. Required.

Returns instance and pinned, the instance's pinned fields.

Errors:

  • there is no instance `<id>`
  • instance `<id>` is not running; start it first
  • instance `<id>` has no field `<field>`; its fields are: <fields>

unpin

Lets pinned fields follow their generators again.

ArgumentTypeMeaning
instancestringInstance ID. Required.
fieldstringThe field to unpin. Without it, every pinned field of the instance.

Returns and errors as pin.

Editing the project

All of these return the edit result.

set_project

Replaces the whole project with TOML text.

ArgumentTypeDefaultMeaning
tomlstringThe whole project file. Required.
dry_runbooleanfalseOnly report the problems the text would have; change nothing.

Text with a TOML syntax error, an unknown or missing key, or a value of the wrong type is refused, and the project stays as it was. The error names the problem and its position, for example line 2, column 1: unknown field `hots`, expected one of …. Text that parses but has validation problems is applied; the problems come back in the result.

set

Changes one value anywhere in the project, without passing the whole device, template or broker.

ArgumentTypeMeaning
pathstringWhere the value goes, as a key path. Required.
valueany JSON except nullThe new value, of the type the key takes: a string, number or boolean, or an object or list for a key that holds a table or list. Durations are strings, e.g. "30s". Required.
{ "path": "templates.office-air.fields.co2.max", "value": 900 }

Tables missing on the way are created: devices.lab.params.room works on a device without params. The number after the last message adds a message: with two messages, set templates.office-air.messages.3 to an object with topic and payload. A value that is already there changes nothing (changed is false).

A path to a device or template sets all of it, as put_device or put_template would, and keeps its id. To change an id, use rename_device or rename_template.

Errors, after which nothing has changed:

  • A value of the wrong type, or an unknown key, with the path and what the key takes: cannot set `devices.office.count`: invalid type: string "many", expected u32, cannot set `devices.office.colour`: unknown field `colour`, expected one of ….
  • A path that names nothing: the project has no device `<id>` (put_device adds one), the project has no template `<id>` (put_template adds one), the built-in template error of rename_template, `<path>` is a list: number its entries from 1 to <n>, or <n+1> to add one, `<path>` holds an integer, which has no key `<key>`.
  • An id: `devices.<id>.id` is the device's id; change it with rename_device, and the same for templates.
  • null: null is not a value in the project file; unset removes a key.
  • A path that cannot be read: `<path>` is not a path: <why>; a path is …, followed by examples.

unset

Removes one key, so its default applies, or removes one message.

ArgumentTypeMeaning
pathstringThe key to remove, as a key path. Required.

For example, devices.office.count goes back to 1, templates.office-air.interval to 10s and broker.port to 1883, and devices.office.params.room leaves the device without that parameter. templates.office-air.messages.2 removes the second message.

Errors, after which nothing has changed:

  • A key the project file requires: cannot unset `devices.office.template`: missing field `template`.
  • A key that is not set: `<path>` is not set, so there is nothing to unset (get_project shows the project).
  • A whole device or template: unset removes a key; remove_device removes the device `<id>`, and the same for templates.
  • The path errors of set.

Key paths

set and unset address a value by the keys of the project file joined by dots:

  • Devices and templates by their id: devices.office.count, templates.office-air.interval.
  • Messages by number, starting at 1, as validation problems count them: templates.office-air.messages.1.payload. messages[1], as the problems write it, works too.
  • Everything else by key: broker.port, broker.tls.ca_file, simulation.seed, devices.office.params.room, devices.office.fields.co2.max (a field override), templates.office-air.fields.co2.max, templates.office-air.messages.1.user_properties.room.
  • A key with a dot or a space goes in double quotes: devices.office.params."floor.level".

Built-in templates cannot be changed; copy one with copy_builtin_template first.

put_device

Adds a device, or replaces the device with the same id. The arguments are the keys of a [[devices]] table: id, template, count, instance_id, params, autostart, interval and fields, with the same defaults as in the project file. A field override in fields merges as in a field override of the project file: it can set generator parameters, unit and name.

{ "id": "lab", "template": "temperature", "count": 3, "autostart": false }

rename_device

ArgumentTypeMeaning
fromstringCurrent device ID. Required.
tostringNew device ID. Required.

Errors: the project has no device `<id>`, a device `<id>` already exists, the name must not be empty.

remove_device

ArgumentTypeMeaning
idstringDevice ID. Required.

Running instances of the device become orphans: they keep running until stopped. Errors: the project has no device `<id>`.

put_template

Adds a template to the project, or replaces the project template with the same id. The arguments are the keys of a [[templates]] table: id, interval, qos, retain, home_assistant, availability, messages, fields and subscriptions. Messages can set the MQTT 5 keys message_expiry, content_type and user_properties, and availability can set will_delay, as in the project file. Each field is its generator table and can add a unit and a name, as in the project file; a field can run a script. Each subscription is an object with topic, qos and script, as in the project file.

{
  "id": "door",
  "interval": "5s",
  "messages": [{ "topic": "home/{{ device_id }}/contact", "payload": "{{ open }}" }],
  "fields": { "open": { "generator": "sequence", "values": [true, false], "name": "Door open" } }
}

Errors: `<id>` is a built-in template id; use another id, or copy_builtin_template.

rename_template

ArgumentTypeMeaning
fromstringCurrent template ID. Required.
tostringNew template ID. Required.

The devices that use the template are changed to the new ID.

Errors: the project has no template `<id>`, `<id>` is a built-in template; built-ins cannot be changed (copy_builtin_template copies one into the project), a template `<id>` already exists, `<id>` is a built-in template id, the name must not be empty.

remove_template

ArgumentTypeMeaning
idstringProject template ID. Required.

Devices that still use the template get a validation problem and cannot start. Errors as rename_template for unknown and built-in IDs.

copy_builtin_template

Copies a built-in template into the project, so it can be changed.

ArgumentTypeMeaning
builtinstringco2, temperature or humidity. Required.
new_idstringThe copy's ID. Required.

Errors: unknown built-in template `<id>`, a template `<id>` already exists, `<id>` is a built-in template id, the name must not be empty.

set_broker

Replaces the broker settings. The arguments are the keys of the [broker] table: host, port, client_id_prefix, keep_alive, mqtt_version, transport, path, session_expiry, username, password, password_env and tls. Omitted keys take their defaults, as in the project file: an omitted mqtt_version is "5", and an omitted username, password, password_env or tls is removed. To change one setting, pass every key get_project shows under [broker]; pass password = "<redacted>" to keep the stored password. Every running instance needs a restart to use the new settings.

Undo and redo

undo and redo step through the project's history in whichever program serves the tools. In the GUI it is the window's own history, the one Undo and Ctrl+Z use: an agent's undo can take back an edit the user made in the window, and the user's Ctrl+Z an agent's edit. Each tool call that changes the project is one step. Opening a project or starting a new one starts a new history, which keeps the last 100 steps.

Running instances take an undo or redo as they take an edit; see the edit result.

undo

Takes back the latest change to the project. No arguments.

Returns the edit result, with changed always true, and:

KeyMeaning
brokerThe step changed the broker settings.
simulationThe step changed the [simulation] settings.
devicesDevices the step added, removed or changed. A rename lists both IDs.
templatesProject templates the step added, removed or changed.
can_undoAnother undo is possible.
can_redoA redo is possible.

Errors: there is nothing to undo: the history starts when the project is opened or created.

redo

Applies again the change the latest undo took back. This is possible until the next edit. No arguments. Returns as undo.

Errors: there is nothing to redo: redo applies again what undo took back, until the next edit.

Files

new_project

Replaces the project with an empty, untitled one. The current instances stop gracefully.

ArgumentTypeDefaultMeaning
discard_unsavedbooleanfalseThrow away unsaved changes.

Returns path (null), problems, blocked and instances (the instance IDs of the project).

Errors: the project has unsaved changes; save it first, or pass discard_unsaved = true. In the GUI, while a dialog is open: the Senzor window is waiting for the user to answer a dialog; try again once it is closed.

open_project

Opens a project file. The current instances stop gracefully, and the new project's devices with autostart = true start once they have stopped, as when you open a project in the GUI.

ArgumentTypeDefaultMeaning
pathstringProject file. Required. A relative path starts at Senzor's working directory.
discard_unsavedbooleanfalseThrow away unsaved changes.
autostartbooleantrueStart the devices with autostart = true.

Returns as new_project. A file with validation problems opens; its problems come back in the result.

Errors: those of new_project, cannot read <path>: <reason>, and the problem of a file that does not parse (a TOML syntax error, an unknown or missing key, or a wrong type). In that case the current project keeps running.

save_project

Writes the project as canonical TOML, the same way Save does in the GUI (see Files).

ArgumentTypeDefaultMeaning
pathstringSave as this file, which then becomes the project's file. .toml is added when the name does not end with it. A relative path starts at Senzor's working directory. Without path, the project's own file.
overwritebooleanfalseReplace an existing file other than the project's own.

Returns path, the absolute path written.

Errors:

  • the project has no file yet; pass a path to save it as
  • <path> already exists; pass overwrite = true to replace it
  • cannot write <path>: <reason>
  • In the GUI, while a dialog is open: the Senzor window is waiting for the user to answer a dialog; try again once it is closed

Resources and subscriptions

Three resources show what changes while Senzor runs, as JSON:

URIContentChanges when
senzor://projectWhat get_project returns: toml, path, dirty, problems and blocked.The project is edited (by the agent or in the window), saved, opened or replaced.
senzor://instancesinstances: each with id, device, status, pinned, needs_restart and orphaned. The counters and values are in get_status and get_instance.An instance starts, connects, drops off, stops or fails, a pin changes, or an edit adds or removes instances.
senzor://messagesThe newest 100 messages and last_seq, as get_messages without arguments returns them.An instance publishes.

These read-only references never change, so an agent can write templates without guessing:

URIContent
senzor://reference/project-fileThe project file reference.
senzor://reference/generatorsThe generators reference.
senzor://reference/template-variablesThe template variables reference.
senzor://reference/scriptsScripts and commands: field scripts, subscriptions, state and the functions scripts can call.
senzor://reference/builtin-templatesThe built-in templates co2, temperature and humidity as TOML.

An agent can subscribe to a resource instead of polling. Clients of MCP versions before 2026-07-28 send resources/subscribe and resources/unsubscribe. Newer clients list the URIs in a subscriptions/listen request and cancel it to stop. Senzor then sends notifications/resources/updated with the URI after each change, and the agent reads the resource or calls a tool to see what changed:

  • An update comes at most every 250 ms per resource. Changes inside that time are sent together in one update when it ends, so the last change of a burst is never missed. With 500 instances publishing, senzor://messages sends four updates a second.
  • An update says only that the resource changed. Call get_messages with after_seq to get every new message, not only the newest 100.
  • Subscribing to an unknown URI fails with no resource `<uri>`. A subscriptions/listen request accepts only the URIs it knows, and its acknowledgment lists them. Subscribing to a reference page works, but it never sends an update.
  • Subscriptions end with the connection.

Prompts

Prompts are ready-made first messages that set the agent to work. A client shows them as commands; Claude Code names them /mcp__<server>__<prompt>, for example /mcp__senzor__simulate-device when the server is registered as senzor.

PromptArgument (required)What the agent is asked to do
simulate-devicedevice: the real device to imitate, with what it measures, how often it reports, and its topics and payload format if you know them.Read the references, create a template with put_template (or start from a built-in one), add a device with put_device, start it and check its messages. It says which details it guessed and does not save.
test-consumerexpectation: what the program that consumes the messages should do in reaction to the values.Start the instances, force values with pin, confirm with get_messages that they went out, take devices away with kill or stop, check how the consumer reacted, then unpin and report each case.
explain-problemsNone.Read the problems with get_project, explain each one, fix them with the editing tools and check that none are left. It does not save.

A missing or empty required argument fails with prompt `<name>` needs the argument `<argument>`, and an unknown name with there is no prompt `<name>`.

On this page