Skip to main content
Glama

按业务协议发送 MQTT 消息

mqtt_send

Publish MQTT messages by specifying a business template and variables: the topic and payload are rendered automatically and the connection is opened if needed. Use it for routine sends after initial setup.

Instructions

核心发送工具:指定模板名与业务变量,自动渲染主题和消息体并发布。若连接尚未建立会自动连接。之后日常使用只需调用本工具。

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": {
      "template": "<template>"
    },
    "name": "mqtt_send"
  }
}

Input Schema

NameRequiredDescriptionDefault
templateYes业务协议模板名称
variablesNo业务变量键值对
connectionNo覆盖模板默认连接(临时切到其它 Broker)
autoConnectNo连接未建立时是否自动连接,默认 true
qosOverrideNo覆盖 QoS
topicOverrideNo覆盖渲染后的主题
retainOverrideNo覆盖 retain

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.6/5.0
Behavior3/5

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

No annotations exist, so the description carries the full behavioral burden; it does disclose the important implicit side effect that the tool will open a connection if one is missing, plus the template-to-topic/body rendering. It says nothing about defaults for QoS/retain, whether the publish is blocking, what happens on render failure, or what the call returns.

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

Conciseness4/5

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

Three short sentences, front-loaded with the core action and followed by the connection caveat and the routing hint. Slight redundancy between '核心发送工具' and the closing '日常使用只需调用本工具', but no sentence is wasted.

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

Completeness3/5

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

For a seven-parameter tool with a nested free-form variables object, no annotations and no output schema, the description covers the happy path and auto-connect but omits return values and error behavior. An agent could invoke it correctly for the basic case but would be guessing about what comes back and what to pass in variables.

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 all seven parameters are already documented, which sets the baseline at 3. The description does add one genuine relational insight — that template plus variables are rendered into topic and body — but the override parameters (connection, topicOverride, qosOverride, retainOverride) and the free-form shape of the nested variables object are left entirely to the schema.

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 gives a concrete verb (render and publish) and a concrete resource (a template-driven MQTT message), and the phrase '指定模板名与业务变量,自动渲染主题和消息体' distinguishes it from a raw publish. It never names the closest sibling, mqtt_publish, so the agent has to infer that the difference is templating rather than raw payloads.

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?

'若连接尚未建立会自动连接' tells the agent it does not need to call mqtt_connect first, and '之后日常使用只需调用本工具' routes everyday sends here. There is no explicit when-not, no statement about when mqtt_publish or mqtt_template_save would be the better choice.

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