Skip to main content
Glama

读取收到的 MQTT 消息

mqtt_messages

Retrieve cached MQTT messages from active subscriptions, filtered by connection, topic pattern, or timestamp, and optionally clear the buffer after reading.

Instructions

读取订阅后缓存在内存中的消息。可按连接、主题过滤器、时间过滤;clear=true 表示读取后清空。

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "mqtt_messages"
  }
}

Input Schema

NameRequiredDescriptionDefault
clearNo读取后是否清空缓冲,默认 false
limitNo最多返回条数,默认 50
sinceNo仅返回该 ISO 时间之后的消息
connectionNo连接名称,留空读取所有连接
topicFilterNo主题过滤器,如 device/+/status

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.7/5.0
Behavior4/5

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

No annotations are supplied, so the description carries the full behavioral burden, and it does disclose two non-obvious traits: messages live in an in-memory buffer and clear=true wipes that buffer after reading — a destructive side effect worth surfacing. It omits buffer capacity/retention behavior, but the critical state-change is disclosed.

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?

Two compact sentences with the core purpose front-loaded and the clearing behavior appended as the final clause. No filler, though the second sentence compresses filters and the clear semantics into one terse line.

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 five-parameter read tool with full schema coverage and no output schema, the definition covers what the resource is, where messages come from, filter axes, and the clearing side effect — enough to invoke correctly. Gaps around return shape and buffer limits are modest given the schema richness.

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 every parameter including defaults, the 1-500 limit range, and the topic filter example is already documented structurally. The description only restates the same filter dimensions and the clear flag, adding no syntax or format detail beyond 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?

Uses a specific verb and resource ('读取订阅后缓存在内存中的消息'), which immediately establishes that this reads already-received messages rather than subscribing or publishing. It does not explicitly name or contrast with siblings such as mqtt_subscribe or mqtt_send, so an agent must infer the boundary.

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?

The phrase '订阅后' implies the message buffer must already exist, effectively signalling a prerequisite. Filter dimensions (connection, topic filter, time) are named, but there is no explicit when-to-use vs. when-not guidance and no mention of what happens if no subscription exists.

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