/** * MCP Blackboard Tool Bindings — Phase 4: Behavioral Control Plane * * Exposes the shared blackboard as MCP-compatible tool definitions so any * LLM agent can interact with shared state via standard tool calls. * * Tools exposed: * - blackboard_read — read a single entry by key * - blackboard_write — write a value to the blackboard * - blackboard_list — list all keys (optionally filtered by prefix) * - blackboard_delete — delete an entry by key * - blackboard_exists — check whether a key is present and not expired * * @module mcp-blackboard-tools */ /** JSON Schema subset sufficient for MCP tool descriptors. */ export interface MCPJsonSchema { type: 'object'; properties: Record; required?: string[]; } /** MCP tool definition (matches Model Context Protocol spec). */ export interface MCPToolDefinition { name: string; description: string; inputSchema: MCPJsonSchema; } /** Normalised result returned by every blackboard tool call. */ export interface BlackboardToolResult { ok: boolean; tool: string; data?: unknown; error?: string; } /** Minimal interface required by the tool bindings. */ export interface IBlackboard { read(key: string): { key: string; value: unknown; sourceAgent: string; timestamp: string; ttl: number | null; } | null; write(key: string, value: unknown, sourceAgent: string, ttl?: number, agentToken?: string): { key: string; value: unknown; sourceAgent: string; timestamp: string; ttl: number | null; }; exists(key: string): boolean; getSnapshot(): Record; delete?: (key: string) => void; getScopedSnapshot?: (agentId: string) => Record; } /** MCP tool definitions for all five blackboard operations. */ export declare const BLACKBOARD_TOOL_DEFINITIONS: MCPToolDefinition[]; /** * MCP-compatible tool handler wrapping a {@link IBlackboard} instance. * * Register it with any MCP adapter to expose shared blackboard operations * as callable tools for LLM agents. * * @example * ```typescript * import { BlackboardMCPTools } from 'network-ai'; * * const tools = new BlackboardMCPTools(orchestrator.blackboard); * * // Register with the MCP adapter * for (const def of tools.getDefinitions()) { * mcpAdapter.registerTool(def.name, (args) => tools.call(def.name, args), def); * } * * // Or call directly for testing * const result = await tools.call('blackboard_read', { * key: 'task:q3_analysis', * agent_id: 'data_analyst', * }); * ``` */ export declare class BlackboardMCPTools { private readonly blackboard; constructor(blackboard: IBlackboard); /** Returns all MCP tool definitions for this blackboard instance. */ getDefinitions(): MCPToolDefinition[]; /** * Dispatch a tool call by name. `args` should match the tool's inputSchema. * All errors are caught and returned as `{ ok: false, error }`. */ call(toolName: string, args: Record): Promise; private _read; private _write; private _list; private _delete; private _exists; private _requireString; } /** * Convenience factory: create a `BlackboardMCPTools` instance and register * all tools on an MCPAdapter in one call. * * @example * ```typescript * import { registerBlackboardTools } from 'network-ai'; * * registerBlackboardTools(mcpAdapter, orchestrator.getBlackboard()); * ``` */ export declare function registerBlackboardTools(mcpAdapter: { registerTool(name: string, handler: (args: Record) => Promise, metadata?: { description?: string; inputSchema?: Record; }): void; }, blackboard: IBlackboard): BlackboardMCPTools; //# sourceMappingURL=mcp-blackboard-tools.d.ts.map