import type { JSONSchema7 } from "json-schema"; export interface ToolExecutor { buildInputSchema(config: TConfig): JSONSchema7; buildDescription(config: TConfig): string; buildDescriptionAsync?(config: TConfig, ctx?: { agentId?: number | null }): Promise; execute(input: unknown, config: TConfig, ctx: ToolContext): Promise; formatResult?(result: ToolResult, config: TConfig): string; } export interface ToolContext { toolId: string; toolSlug: string; userId: number | null; approved?: boolean; agentId?: number | null; recursionDepth?: number; } export interface ToolResult { success: boolean; data?: unknown; error?: string; metadata?: { statusCode?: number; responseSize?: number; durationMs: number; [key: string]: unknown; }; } const registry = new Map>(); export function registerToolType(type: string, executor: ToolExecutor): void { registry.set(type, executor); } export function getExecutor(type: string): ToolExecutor | undefined { return registry.get(type); } export function listToolTypes(): string[] { return Array.from(registry.keys()); }