Expand description
Principal-gated MCP tool loop (U3-A / U3-B).
Talk and agent UIs never invoke local MCP tools without an explicit principal Permit. Deny never reaches the MCP surface.
Flow: propose → Permit / Deny → execute (if Permit + allowlist) → result.
Allowlist source of truth: crate::agent_registry::AgentDefinition::allowed_mcp_tools.
- Empty list → deny-all for tools
"*"→ all tools (use sparingly; prefer explicit names)- otherwise exact tool name match via
AgentDefinition::has_tool
In-process dispatch uses
qualia_core_db::mcp::mcp_server::handle_jsonrpc_message — no second
LLM HTTP API, no external agent SDK.
Structs§
- McpTool
Info - One entry from the local MCP
tools/listsurface.
Enums§
- Gate
Decision - Outcome of the principal + allowlist gate (no MCP call).
Constants§
- SAFE_
SEED_ TOOLS - Safe golden tools for dogfood (empty args or
{"op":"list"}).
Functions§
- agent_
set_ allowed_ mcp_ tools - Set
allowed_mcp_toolson an existing roster agent and persist. - dispatch_
mcp_ tool_ call - Dispatch one MCP
tools/callin-process. Caller must already have passed the principal + allowlist gate. Prefermcp_call_tool_gated_for_agent. - ensure_
safe_ tool_ allowlist - If the agent’s allowlist is empty, seed the safe golden tools and persist. Returns the (possibly updated) allowlist. Does not auto-Permit any call.
- evaluate_
tool_ gate - Pure gate: principal flag + allowlist membership. Unit-testable without APP_STATE or MCP.
- mcp_
call_ tool_ gated - Load agent from roster, gate, then dispatch. Empty slug resolves to
"local". - mcp_
call_ tool_ gated_ for_ agent - Gate + optional dispatch for a concrete
AgentDefinition(testable without storage). - mcp_
list_ local_ tools - List local in-process MCP tools via JSON-RPC
tools/list.