UNPKG

@vfarcic/dot-ai

Version:

AI-powered development productivity platform that enhances software development workflows through intelligent automation and AI-driven assistance

108 lines 2.55 kB
/** * REST API Tool Registry * * Central registry for all MCP tools exposed via REST API. * Manages tool metadata, schema conversion, and tool discovery capabilities. */ import { z } from 'zod'; import { Logger } from '../core/error-handling'; /** * Tool metadata stored in the registry */ export interface ToolMetadata { name: string; description: string; inputSchema: Record<string, z.ZodSchema>; handler: (...args: unknown[]) => Promise<unknown>; category?: string; tags?: string[]; } /** * JSON Schema representation converted from Zod */ export interface JsonSchema { type?: string; properties?: Record<string, unknown>; required?: string[]; description?: string; $ref?: string; definitions?: Record<string, unknown>; [key: string]: unknown; } /** * Tool information exposed via discovery endpoint */ export interface ToolInfo { name: string; description: string; schema: JsonSchema; category?: string; tags?: string[]; } /** * Registry for managing all tools available via REST API */ export declare class RestToolRegistry { private tools; private logger; private schemaCache; constructor(logger: Logger); /** * Register a tool in the registry */ registerTool(metadata: ToolMetadata): void; /** * Get tool metadata by name */ getTool(name: string): ToolMetadata | undefined; /** * Get all registered tool names */ getToolNames(): string[]; /** * Get all tools with their discovery information */ getAllTools(): ToolInfo[]; /** * Check if a tool is registered */ hasTool(name: string): boolean; /** * Get the number of registered tools */ getToolCount(): number; /** * Clear all registered tools */ clear(): void; /** * Convert Zod schema to JSON Schema using Zod v4 native toJSONSchema */ private convertZodSchemaToJsonSchema; /** * Get tool discovery information with filtering */ getToolsFiltered(options?: { category?: string; tag?: string; search?: string; }): ToolInfo[]; /** * Get all unique categories */ getCategories(): string[]; /** * Get all unique tags */ getTags(): string[]; /** * Get registry statistics */ getStats(): { totalTools: number; categories: string[]; tags: string[]; cacheSize: number; }; } //# sourceMappingURL=rest-registry.d.ts.map