/** * RAG Store Management Tool Handler * * Provides MCP tool operations for managing RAG (Retrieval Augmented Generation) stores. * Supports create, list, get, delete, sync, and status operations. * * @module @wundr/mcp-server/tools/rag/rag-store-manage */ import { z } from 'zod'; import type { McpToolResult } from '../registry.js'; import type { RAGStore, RAGStoreAction, StoreConfig, StoreStats, SyncResult } from './types.js'; export declare const StoreConfigSchema: z.ZodObject<{ chunkSize: z.ZodOptional; chunkOverlap: z.ZodOptional; includePatterns: z.ZodOptional>; excludePatterns: z.ZodOptional>; maxFileSize: z.ZodOptional; embeddingModel: z.ZodOptional; }, "strip", z.ZodTypeAny, { includePatterns?: string[] | undefined; excludePatterns?: string[] | undefined; embeddingModel?: string | undefined; chunkSize?: number | undefined; chunkOverlap?: number | undefined; maxFileSize?: number | undefined; }, { includePatterns?: string[] | undefined; excludePatterns?: string[] | undefined; embeddingModel?: string | undefined; chunkSize?: number | undefined; chunkOverlap?: number | undefined; maxFileSize?: number | undefined; }>; export declare const RagStoreManageInputSchema: z.ZodObject<{ action: z.ZodEnum<["create", "list", "get", "delete", "sync", "status"]>; storeId: z.ZodOptional; displayName: z.ZodOptional; sourcePath: z.ZodOptional; config: z.ZodOptional; chunkOverlap: z.ZodOptional; includePatterns: z.ZodOptional>; excludePatterns: z.ZodOptional>; maxFileSize: z.ZodOptional; embeddingModel: z.ZodOptional; }, "strip", z.ZodTypeAny, { includePatterns?: string[] | undefined; excludePatterns?: string[] | undefined; embeddingModel?: string | undefined; chunkSize?: number | undefined; chunkOverlap?: number | undefined; maxFileSize?: number | undefined; }, { includePatterns?: string[] | undefined; excludePatterns?: string[] | undefined; embeddingModel?: string | undefined; chunkSize?: number | undefined; chunkOverlap?: number | undefined; maxFileSize?: number | undefined; }>>; forceReindex: z.ZodDefault>; format: z.ZodDefault>>; }, "strip", z.ZodTypeAny, { action: "status" | "list" | "create" | "delete" | "get" | "sync"; format: "text" | "json" | "table"; forceReindex: boolean; config?: { includePatterns?: string[] | undefined; excludePatterns?: string[] | undefined; embeddingModel?: string | undefined; chunkSize?: number | undefined; chunkOverlap?: number | undefined; maxFileSize?: number | undefined; } | undefined; storeId?: string | undefined; displayName?: string | undefined; sourcePath?: string | undefined; }, { action: "status" | "list" | "create" | "delete" | "get" | "sync"; config?: { includePatterns?: string[] | undefined; excludePatterns?: string[] | undefined; embeddingModel?: string | undefined; chunkSize?: number | undefined; chunkOverlap?: number | undefined; maxFileSize?: number | undefined; } | undefined; format?: "text" | "json" | "table" | undefined; forceReindex?: boolean | undefined; storeId?: string | undefined; displayName?: string | undefined; sourcePath?: string | undefined; }>; export type RagStoreManageInputValidated = z.infer; export interface RagStoreManageOutput { action: RAGStoreAction; store?: RAGStore; stores?: RAGStore[]; stats?: StoreStats; syncResult?: SyncResult; deleted?: boolean; message: string; } interface StoreMetadata extends RAGStore { files: Map; } interface IndexedFileMetadata { path: string; hash: string; sizeBytes: number; lastModified: string; indexedAt: string; chunkCount: number; mimeType?: string; } declare class RAGStoreRegistry { private stores; private static instance; private constructor(); static getInstance(): RAGStoreRegistry; getStore(id: string): StoreMetadata | undefined; setStore(id: string, store: StoreMetadata): void; deleteStore(id: string): boolean; hasStore(id: string): boolean; getAllStores(): RAGStore[]; getStoreCount(): number; } declare const storeRegistry: RAGStoreRegistry; /** * Create a new RAG store with optional display name */ export declare function createStore(storeId: string, displayName?: string, config?: StoreConfig): Promise>; /** * List all RAG stores with metadata */ export declare function listStores(): Promise>; /** * Get store details and statistics */ export declare function getStore(storeId: string): Promise>; /** * Delete store and all indexed data */ export declare function deleteStore(storeId: string): Promise>; /** * Sync store with changed files only (incremental sync) */ export declare function syncStore(storeId: string, sourcePath: string, forceReindex?: boolean): Promise>; /** * Check indexing status and health */ export declare function getStoreStatus(storeId: string): Promise>; /** * Main RAG store management handler - routes to appropriate operation */ export declare function ragStoreManageHandler(args: Record): Promise>; /** * RAG service interface for dependency injection */ export interface RAGServiceInterface { search?: (query: string, options?: Record) => Promise; index?: (path: string, options?: Record) => Promise; } /** * Creates the RAG store management handler with injected service (for testing/DI) * * @param ragService - Optional RAG service implementation for custom search/index operations. * When provided, the service can be used for production integrations. * Currently, the handler uses an internal registry for store management, * but the service parameter enables future extension points for: * - Custom embedding providers * - External vector database integrations * - Testing with mock services * @returns The RAG store management handler function */ export declare function createRagStoreManageHandler(ragService?: RAGServiceInterface): typeof ragStoreManageHandler; /** * Get default store configuration */ export declare function getDefaultStoreConfig(): Required; /** * Merge custom config with defaults */ export declare function mergeStoreConfig(custom?: Partial): Required; /** * Validate store configuration */ export declare function validateStoreConfig(config: StoreConfig): { valid: boolean; errors: string[]; }; export { RAGStoreRegistry, storeRegistry }; /** * Tool definition for MCP registration */ export declare const ragStoreManageTool: { name: string; description: string; inputSchema: { type: string; properties: { action: { type: string; enum: string[]; description: string; }; storeId: { type: string; description: string; }; displayName: { type: string; description: string; }; sourcePath: { type: string; description: string; }; config: { type: string; description: string; properties: { chunkSize: { type: string; }; chunkOverlap: { type: string; }; includePatterns: { type: string; items: { type: string; }; }; excludePatterns: { type: string; items: { type: string; }; }; maxFileSize: { type: string; }; embeddingModel: { type: string; }; }; }; forceReindex: { type: string; description: string; default: boolean; }; format: { type: string; enum: string[]; description: string; default: string; }; }; required: string[]; }; category: string; }; //# sourceMappingURL=rag-store-manage.d.ts.map