read_topic
Retrieve the latest message from a ROS2 topic, returning serialized data and message age in milliseconds. Supports latched topics for static data like /map or /robot_description.
Instructions
Read the latest message from a ROS2 topic. Returns the serialized message and data age in milliseconds. For latched topics (/map, /robot_description), set latched=true.
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>"
},
"name": "read_topic"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| topic | Yes | Topic name, e.g. '/scan' | |
| latched | No | Set true for topics published once on connect (/map, /robot_description) | |
| msg_type | No | ROS2 message type, e.g. 'sensor_msgs/LaserScan' | std_msgs/String |
| timeout_ms | No | Max wait time in milliseconds |