发布原始 MQTT 消息
mqtt_publishPublish a raw message payload to an MQTT topic on a configured connection, with control over QoS, retain flag, and MQTT 5 user properties. Use it when you need exact payload control instead of a business template.
Instructions
向指定主题发布一条原始消息。payload 为字符串,对象请先 JSON.stringify。一般业务消息推荐使用 mqtt_send 走协议模板。
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": {
"connection": "<connection>",
"topic": "<topic>",
"payload": "<payload>"
},
"name": "mqtt_publish"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| qos | No | QoS,默认 0 | |
| topic | Yes | 目标主题 | |
| retain | No | 是否保留消息,默认 false | |
| payload | Yes | 消息内容(字符串;对象请序列化为 JSON 字符串) | |
| connection | Yes | 连接名称 | |
| userProperties | No | MQTT 5 用户属性 |