Skip to content

Tool reference

Every tool returns a single JSON object (as a text content block). The connect argument is optional everywhere and resolves to connectZENOH_CONNECTtcp/localhost:7447.

Connect to a router and confirm reachability.

Arguments

NameTypeRequiredDescription
connectstringnoRouter endpoint.

Returns

{
"connected": true,
"endpoint": "tcp/192.0.2.10:7447",
"session_zid": "3e68be0d2e4cfd72e6cdc6fe26cc998c",
"zenoh_version": "1.8.0",
"router_admin_keys": ["@/<zid>/router"]
}

Send a Zenoh GET (query) for a selector and return replies. Works for data queryables and for the router admin space (@/** → topology, plugins, transports). CDR replies are decoded.

Arguments

NameTypeRequiredDefaultDescription
selectorstringyesSelector / key expression, e.g. @/** or demo/**.
connectstringnoRouter endpoint.
timeout_msintegerno3000 (≤30000)Max time to wait for replies.

Returns

{
"selector": "@/**",
"endpoint": "tcp/192.0.2.10:7447",
"count": 1,
"replies": [
{ "key": "@/<zid>/router", "ros_type": null, "kind": "Put", "value": { "...": "..." } }
]
}

A reply that carries a query error becomes { "error": "<message>" }.

Publish a UTF-8 value to a key expression. Useful for poking subscribers and queryables. Mutates network state.

Arguments

NameTypeRequiredDescription
keystringyesKey expression to publish to, e.g. demo/test.
valuestringyesUTF-8 payload.
connectstringnoRouter endpoint.

Returns

{ "ok": true, "key": "demo/test", "bytes": 11, "endpoint": "tcp/192.0.2.10:7447" }

Subscribe to a key expression for a few seconds and return the samples received, with ROS2 CDR payloads decoded to JSON. The primary tool for “what is being published on this topic right now?”.

Arguments

NameTypeRequiredDefaultDescription
keystringno**Key expression to subscribe to.
connectstringnoRouter endpoint.
duration_secsintegerno3 (1–30)How long to collect samples.
max_samplesintegerno100 (1–2000)Stop early after this many samples.

Returns

{
"key": "0/kuka/joint_states/**",
"endpoint": "tcp/192.0.2.10:7447",
"duration_secs": 2,
"count": 1,
"truncated": true,
"samples": [
{
"key": "0/kuka/joint_states",
"ros_type": "sensor_msgs/JointState",
"kind": "Put",
"value": {
"header": { "frame_id": "kuka_base", "stamp": { "sec": 1780658057, "nanosec": 215979475 } },
"name": ["a1", "a2", "a3", "a4", "a5", "a6"],
"position": [-0.140, -1.582, 1.779, 0.135, 0.809, -0.248],
"velocity": [],
"effort": []
}
}
]
}

truncated is true when collection stopped because max_samples was reached rather than the duration elapsing.

Discover topics: listen briefly on a key expression and return the distinct keys seen, each with its inferred ROS2 type and a sample count. Like ros2 topic list for the Zenoh network.

Arguments

NameTypeRequiredDefaultDescription
keystringno**Key expression to sweep.
connectstringnoRouter endpoint.
duration_secsintegerno3 (1–30)How long to listen before reporting.

Returns

{
"endpoint": "tcp/192.0.2.10:7447",
"duration_secs": 3,
"distinct_keys": 2,
"keys": [
{ "key": "0/chatter", "ros_type": "std_msgs/String", "samples": 3 },
{ "key": "0/kuka/pose", "ros_type": "geometry_msgs/PoseStamped", "samples": 83 }
]
}