Skip to main content
Glama

ros2_assert_topic_published

Verify that a ROS2 topic publishes a message matching an optional condition within a timeout. Confirms expected message flow during testing.

Instructions

Assert that a message matching an optional condition has been published to a topic.

    Args:
        topic: Topic to check (e.g. '/robot/cmd_vel')
        topic_type: Message type string (e.g. 'geometry_msgs/msg/Twist')
        condition_expr: Python expression evaluating 'msg' (e.g. "msg['linear']['x'] > 0.5")
        timeout_sec: Max wait duration in seconds
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
topicYes
topic_typeYes
timeout_secNo
condition_exprNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.1/5.0
Behavior3/5

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

With no annotations provided, the description carries the full behavioral burden. It does disclose useful traits: timeout_sec is a max wait duration, and condition_expr is a Python expression evaluating 'msg', indicating how matching works. However, it does not state what happens on failure—whether it raises an error, returns false, or times out silently—leaving an important behavioral gap.

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?

The description is a compact docstring: a one-sentence summary followed by a structured Args block. Each line serves a purpose, with examples embedded in parameter explanations. There is no fluff, repetition, or tangential information.

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?

All four parameters are well documented, and the core behavior is clear from the summary. Since an output schema exists, return values need not be detailed in the description. The only minor gap is the unspecified failure behavior, but the 'assert' verb and timeout semantics make the tool's contract mostly complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description fully compensates. Every parameter is explained with concrete examples: topic gives '/robot/cmd_vel', topic_type gives 'geometry_msgs/msg/Twist', condition_expr gives a Python expression pattern, and timeout_sec is defined as max wait duration in seconds. This meaning goes well beyond the bare schema.

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

Purpose5/5

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

The description clearly states the tool's function: 'Assert that a message matching an optional condition has been published to a topic.' The verb 'assert' plus the topic resource is specific and distinct from sibling tools like publishing or echoing. The optional condition is immediately mentioned, further narrowing the purpose.

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 description implies usage through its name and purpose—use it to verify a message was published—but it provides no explicit guidance on when to choose this tool over siblings like ros2_topic_echo (for continuous observation) or ros2_measure_topic_hz (for rate measurement). No alternatives or exclusions are mentioned.

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