/** * MCP tool definitions for cortex-engine. * * This module defines the ToolContext and ToolDefinition interfaces, then * re-exports all tool implementations from src/tools/. Each tool lives in * its own file for maintainability. Shared helpers are in src/tools/_helpers.ts. */ import type { EmbedProvider } from '../core/embed.js'; import type { LLMProvider } from '../core/llm.js'; import type { Session } from '../core/session.js'; import type { NamespaceManager } from '../namespace/manager.js'; import type { TriggerRegistry } from '../triggers/registry.js'; import type { BridgeRegistry } from '../bridges/registry.js'; import type { FederationClient } from '../federation/client.js'; /** Tool context passed to all handlers. */ export interface ToolContext { namespaces: NamespaceManager; embed: EmbedProvider; llm: LLMProvider; session: Session; triggers: TriggerRegistry; bridges: BridgeRegistry; /** All registered tools (core + plugin), for trigger/bridge pipeline lookups. */ allTools: ToolDefinition[]; /** Federation client for multi-instance coordination (optional, only if configured). */ federation?: FederationClient; } /** * Tool category for triage and discovery. * * Drives the `[category]` prefix in composed MCP descriptions and groups tools * in the CLI/docs. Required on every tool — see the type union for valid values. */ export type ToolCategory = 'memory' | 'consolidation' | 'beliefs' | 'ops' | 'threads' | 'journal' | 'social' | 'content' | 'graph' | 'vitals' | 'agents' | 'maintenance' | 'meta'; /** The set of valid tool categories, exported for runtime validation. */ export declare const TOOL_CATEGORIES: readonly ToolCategory[]; /** MCP-compatible tool definition with a working handler. */ export interface ToolDefinition { name: string; description: string; /** Discovery category — see ToolCategory. Drives the [category] prefix in MCP descriptions. */ category: ToolCategory; /** One sentence, agent-facing. Names the trigger condition for picking this tool. */ whenToUse: string; /** Optional disambiguator. Names the case where another tool is the better choice. */ doNotUse?: string; inputSchema: { type: 'object'; properties: Record; required?: string[]; }; handler: (args: Record, ctx: ToolContext) => Promise>; } /** Structured tool metadata for the REST/CLI/docs surfaces. Strips the handler. */ export type ToolMetadata = Omit; /** * Compose the MCP-facing description from a tool's structured metadata. * * Format: * [category] * * Use when: * Don't use when: (optional) * * The [category] prefix lets an LLM scan for relevant tools by category * before reading bodies. The Use when / Don't use when lines are the * disambiguators against similar tools. */ export declare function composeMcpDescription(tool: ToolDefinition): string; /** Project a ToolDefinition down to its metadata-only shape for external surfaces. */ export declare function toToolMetadata(tool: ToolDefinition): ToolMetadata; /** A plugin that contributes additional tools to the cortex engine. */ export interface ToolPlugin { name: string; tools: ToolDefinition[]; } /** All cognitive tool definitions. */ export declare function createTools(): ToolDefinition[]; /** Core tools that are always active regardless of namespace config. */ export declare const CORE_TOOLS: readonly ["query", "observe", "wonder", "speculate", "recall", "neighbors", "stats", "ops_append", "ops_query", "ops_update"]; //# sourceMappingURL=tools.d.ts.map