InProcessKernelServerHost class

Implemented types

Constructors

InProcessKernelServerHost({String name = 'kernel', String version = '0.1.0', Set<ToolScope> visibility = const {ToolScope.external}, bool debugMode = false})

Properties

activeVisibility Set<ToolScope>
Visibility filter the host launches with. Tools outside the filter stay tracked (for introspection) but never reach the transport.
no setteroverride
debugMode bool
no setteroverride
dispatchLog List<Map<String, Object?>>
Read-only snapshot of recent dispatches (kernel observability surface; reference impl caps the buffer at ~200 entries).
no setteroverride
externalSpec McpServerSpec?
External dial-back description for this host. Returns null for in-process implementations that never expose a wire transport. Transport-binding implementations override this once start() has wired a concrete URL / port / command pair so consumers (Claude Code's --mcp-config, sibling hosts, debug tooling) can reach the server without re-encoding wire details. See host/mcp_server_spec.dart.
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
isRegistered bool
no setter
name String
Caller-supplied server identity surfaced on initialize.
final
promptDefinitions List<KernelPromptDef>
Read-only snapshot of every registered prompt definition.
no setteroverride
resourceUris List<String>
Read-only snapshot of every registered resource URI (parity with toolDefinitions / promptDefinitions). Used by hosts and tests to confirm what the server exposes — e.g. the MCP Serving bundle document at bundle://manifest.json.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
toolDefinitions List<KernelToolDef>
Read-only snapshot of every registered tool definition.
no setteroverride
toolScopes Map<String, ToolScope>
Read-only snapshot of registered tool scopes.
no setteroverride
version String
final

Methods

addPrompt({required String name, required String description, required List<KernelPromptArgument> arguments, required KernelPromptHandler handler}) → void
Register an MCP prompt. The handler returns a KernelGetPromptResult (description + list of messages); the host translates to the wire shape (mcp.GetPromptResult for the reference impl, host-specific for custom transports).
override
addResource({required String uri, required String name, required String description, required String mimeType, required KernelResourceHandler handler}) → void
Register an MCP-style resource. The handler returns KernelReadResourceResult; the host translates to its wire shape.
override
addTool({required String name, required String description, required Map<String, dynamic> inputSchema, required KernelToolHandler handler, ToolScope scope = ToolScope.external}) → void
Register a tool. Idempotent re-registration replaces the handler.
override
callTool(String name, Map<String, dynamic> args) Future<KernelToolResult>
In-process tool dispatch. Used by BundleActivation flows whose toolDispatcher closure routes through the host's local server surface, by BundleSessionBridge mirroring, and by host code that wants to invoke a tool without going over the transport.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
register() → void
Mark the server as registered without binding a transport. The in-process AppPlayer use case where no network surface is exposed.
override
removePrompt(String name) bool
Remove a previously registered prompt. Returns true when an entry was removed (the call is idempotent on missing names).
override
removeResource(String uri) bool
Remove a previously registered resource. Returns true when an entry was removed (the call is idempotent on missing URIs).
override
removeTool(String name) bool
Remove a previously registered tool. Returns true when an entry was removed.
override
shutdown() Future<void>
Tear the transport down.
override
start(KernelTransportKind transport, {String host = '127.0.0.1', int port = 7820}) Future<void>
Bind a transport. Implementations that only support in-process dispatch may ignore the call or raise.
override
toString() String
A string representation of this object.
inherited

Operators

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