/** * L2 Tool Registry Guard * * Maintains strict control over which tools can be executed. * Prevents LLM hallucination attacks. */ import { ToolDefinition, ToolRegistryResult, Role, GuardLogger } from "../types"; export interface ToolRegistryConfig { tools: ToolDefinition[]; strictMatching?: boolean; logger?: GuardLogger; } export declare class ToolRegistry { private tools; private strictMatching; private logger; constructor(config: ToolRegistryConfig); /** * Check if a tool exists and is accessible for the given role */ check(toolName: string, role: Role, requestId?: string): ToolRegistryResult; /** * Detect if tool name looks like a hallucination */ private detectHallucination; /** * Find similar registered tools for helpful error messages */ private findSimilarTools; /** * Get tools for a specific role */ getToolsForRole(role: Role): ToolDefinition[]; /** * Get all registered tool names */ getRegisteredToolNames(): string[]; /** * Register a new tool at runtime */ registerTool(tool: ToolDefinition): void; /** * Unregister a tool */ unregisterTool(toolName: string): boolean; }