import type { JSONSchema7 } from "json-schema"; export interface ToolExecutor { buildInputSchema(config: TConfig): JSONSchema7; buildDescription(config: TConfig): string; execute(input: unknown, config: TConfig, ctx: ToolContext): Promise; } export interface ToolContext { toolId: string; toolSlug: string; userId: number | null; } export interface ToolResult { success: boolean; data?: unknown; error?: string; metadata?: { statusCode?: number; responseSize?: number; durationMs: number; }; } 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()); }