Skip to main content
Glama

Publish a message

publish
Destructive

Send a message to an MQTT topic to issue commands to real IoT devices, such as turning a kitchen light off via a topic and JSON payload.

Instructions

Publish a message to an MQTT topic, e.g. to send a command to a device (topic 'home/kitchen/light/set', payload '{"state":"off"}'). This can change real devices.

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": {
      "topic": "<topic>",
      "payload": "<payload>"
    },
    "name": "publish"
  }
}

Input Schema

NameRequiredDescriptionDefault
qosNoMQTT QoS level
topicYesExact topic to publish to (no wildcards)
retainNoAsk the broker to retain the message for new subscribers
payloadYesMessage payload, usually JSON or plain text

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.8/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=false and destructiveHint=true, so safety is covered. The description adds real value beyond that by warning that messages reach physical devices and can change their state, which frames the blast radius in concrete terms; it does not discuss delivery semantics, QoS tradeoffs, or retention effects.

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

Conciseness5/5

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

Two sentences: the core action with a parenthetical example, then a one-line risk note. The example is compact and the most important information (what it does) comes first, with no filler.

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 four-parameter tool with full schema coverage and destructive annotations, the description covers purpose, a realistic example, and the real-world consequence. The only gap is the publish result itself (fire-and-forget vs. broker acknowledgement), which has no output schema to cover it.

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 description coverage is 100%, so the schema already explains topic, payload, qos, and retain. The worked example reinforces the expected topic format and JSON payload shape, but adds no new constraint or syntax details beyond what the schema provides, so the baseline 3 applies.

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

Purpose4/5

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

The description names a specific verb and resource ("publish a message to an MQTT topic") and a concrete worked example with topic and payload, which removes ambiguity about what the call does. It does not explicitly contrast itself with the subscribe or list_topics siblings, so it falls just short of a 5.

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

Usage Guidelines3/5

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

Usage is only implied through the example ("to send a command to a device"), which conveys the typical scenario but gives no when-not-to-use conditions, no mention of the subscribe/list_topics alternatives, and no guidance on when publish is inappropriate.

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

Deploy Server

Other Tools