Chat agent modes
Select the prompts, local tools, and MCP filters for the GUI’s Plan and Run modes.
mtc_gui.agent_modes · Source
Operator GUI · Guide · Symbol index
How it is used
AgentBridge calls these helpers when connecting or rebuilding RobotAgent. local_tools_for() exposes queue proposal, clearing, and inspection in both modes; Run also exposes execute_queue. banner_for() describes the corresponding workflow to the agent.
tool_filter_for() returns the same filter in both modes. It blocks seven named mutating tools on ros-mcp-server; it does not restrict tools supplied by other MCP servers.
Start here
Callable |
Purpose |
|---|---|
Select the GUI-local tool schemas for planning or execution. |
|
Build the MCP admission predicate shared by both GUI modes. |
|
Select the GUI-specific system-prompt prefix describing queue proposal and dispatch behavior. |
Example
# No Qt, ROS, or hardware required.
from mtc_gui.agent_modes import local_tools_for, tool_filter_for
assert "execute_queue" not in {t["name"] for t in local_tools_for("plan")}
assert "execute_queue" in {t["name"] for t in local_tools_for("run")}
assert not tool_filter_for("run")("ros-mcp-server", "send_action_goal")
Functions
local_tools_for()
Select the GUI-local tool schemas for planning or execution.
Function · Source
local_tools_for(mode: str) -> List[dict]
Parameter |
Meaning |
|---|---|
|
Exact string “plan” or “run”. |
Returns: A new list referencing shared schema dictionaries: propose_tasks, clear_proposed_tasks, get_current_tasks; Run inserts execute_queue before get_current_tasks.
Errors: Raises ValueError for any other mode.
Side effects: None; callers should avoid mutating the shared schema dictionaries.
Referenced in source (2)
AgentBridge._async_connect— mtc_gui.agent_bridgeAgentBridge._async_set_mode— mtc_gui.agent_bridge
tool_filter_for()
Build the MCP admission predicate shared by both GUI modes.
Function · Source
tool_filter_for(mode: str) -> Callable[[str, str], bool]
Parameter |
Meaning |
|---|---|
|
Accepted for API consistency but discarded without validation; it does not affect filtering. |
Returns: A callable accepting (server_name, tool_name) and returning whether to retain that tool.
Errors: No explicit error handling or mode validation.
Referenced in source (2)
AgentBridge._async_connect— mtc_gui.agent_bridgeAgentBridge._async_set_mode— mtc_gui.agent_bridge
Internal callbacks and helpers
tool_filter_for.predicate()
Reject the seven named mutating tools on ros-mcp-server and retain all other server/tool combinations.
Callback · Source
predicate(server_name: str, tool_name: str) -> bool
Parameter |
Meaning |
|---|---|
|
MCP server identifier; only the exact name “ros-mcp-server” is filtered. |
|
Tool name; the denylist is send_action_goal, cancel_action_goal, publish_once, publish_for_durations, call_service, set_parameter, delete_parameter. |
Returns: False for a denylisted tool on ros-mcp-server; True otherwise.
Errors: No local validation; tool_name must be hashable when checked against the denylist.
Referenced in source (1)
tool_filter_for— mtc_gui.agent_modes