/** * mcp/server/tool-definitions.ts * * Generates Model Context Protocol tool definitions from the GoodVibes operator * catalog, rather than hand-writing them, so the MCP surface an external agent * tool sees is exactly the daemon's operator contract and can never drift from * it. Every cataloged, invokable operator method becomes one MCP tool: its * dotted method id maps to an MCP-safe tool name, its description carries over, * and its operator inputSchema becomes the tool's JSON Schema input. * * The session lifecycle methods (create / attach / send message / read * transcript / steer, see session-tools.ts) are lifted to the front of the list * and tagged, so they read as first-class tools. */ import type { JsonSchema, OperatorContractManifest, OperatorMethodContract } from '@pellux/goodvibes-contracts'; /** Advisory hints an MCP client may use to present or gate a tool. */ export interface McpToolAnnotations { /** True when the tool only reads state (declares read: scopes, no write). */ readonly readOnlyHint?: boolean | undefined; /** True when the operator method is flagged dangerous. */ readonly destructiveHint?: boolean | undefined; /** True when the method is idempotent (safe to retry). */ readonly idempotentHint?: boolean | undefined; } /** A single MCP tool definition, as returned by tools/list. */ export interface McpToolDefinition { readonly name: string; readonly description: string; readonly inputSchema: JsonSchema; readonly annotations?: McpToolAnnotations | undefined; /** GoodVibes-specific: the operator method id this tool dispatches to. */ readonly operatorMethodId: string; } /** The generated tool set plus the name<->method-id mapping the server dispatches with. */ export interface OperatorMcpToolSet { readonly tools: readonly McpToolDefinition[]; /** Resolve an MCP tool name back to the operator method id it invokes. */ readonly methodIdByToolName: ReadonlyMap; } /** Options controlling which operator methods are exposed as MCP tools. */ export interface BuildOperatorMcpToolsOptions { /** Only include methods in these categories (default: all). */ readonly includeCategories?: readonly string[] | undefined; /** Exclude methods in these categories (applied after includeCategories). */ readonly excludeCategories?: readonly string[] | undefined; /** Only include methods with these access levels (default: all). */ readonly includeAccess?: readonly OperatorMethodContract['access'][] | undefined; /** Include methods marked dangerous (default: true). */ readonly includeDangerous?: boolean | undefined; /** Keep the session lifecycle tools at the front of the list (default: true). */ readonly prioritizeSessionLifecycle?: boolean | undefined; } /** MCP tool names are restricted to a safe slug; the dotted method id maps by replacing dots. */ export declare function operatorMethodIdToToolName(methodId: string): string; /** * Build the MCP tool set from an operator contract manifest. Pure over its * input, pass `getOperatorContract()` (or any manifest) to generate the tools. * Throws when two method ids collapse to the same MCP tool name, so a catalog * change that would silently shadow a tool fails loudly instead. */ export declare function buildOperatorMcpTools(contract: OperatorContractManifest, options?: BuildOperatorMcpToolsOptions): OperatorMcpToolSet; /** Whether the given method id would be surfaced as a first-class session lifecycle tool. */ export declare function isFirstClassSessionTool(methodId: string): boolean; //# sourceMappingURL=tool-definitions.d.ts.map