ToolDispatcher class

Dispatches MCP tool calls and returns the parsed JSON response so the runtime can apply spec §3.10 auto-merge against its own state. Host responsibilities here are limited to MCP forwarding, listTools-based existence checks (for clearer error messaging), and exception modelling (MOD-RUNTIME-003, FR-TOOL-001~005).

In-process resolver hook — tools registered by the core (or by the host) run directly without an external MCP server call. The brain_kernel standard tool surface (bk.*) is registered through this path so every facade call resolves in-process with zero round-trip cost.

Constructors

ToolDispatcher({Logger? logger})

Properties

hashCode int
The hash code for this object.
no setterinherited
inProcessToolNames List<String>
Names of every currently-registered in-process tool.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

call({required Client client, required String tool, required Map<String, dynamic> params}) Future
callInProcess(String tool, Map<String, dynamic> params) Future
Dispatch a registered tool entirely in-process, with no external MCP client involved. Used by JS atoms such as host.mcp.callTool. Throws ToolNotFoundException for unregistered tool names.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerInProcessTool(String name, InProcessToolHandler handler) → void
Register a single tool. Overwrites any previous handler bound to the same name, since hosts may intentionally replace a wrapper.
registerInProcessTools(Map<String, InProcessToolHandler> tools) → void
Register multiple tools at once.
toString() String
A string representation of this object.
inherited
unregisterInProcessTool(String name) → void
Unregister a tool — used when the tool surface changes dynamically.

Operators

operator ==(Object other) bool
The equality operator.
inherited