/** * SchemaDispatcher - Generic dispatcher for schema-driven operations * * This module provides automatic dispatch from operation schemas to handler methods. * It eliminates the need for manual switch statements in MCPAQLHandler by: * * 1. Looking up operation in schema * 2. Resolving handler from registry * 3. Building method arguments from params * 4. Calling the handler method * 5. Applying field selection/transformation to response (Issue #202) * * ARCHITECTURE: * - SchemaDispatcher.dispatch(operation, params, registry) → Promise * - Uses argBuilder to determine how to pass parameters to handler * - Validates required parameters before dispatch * - Provides clear error messages for missing handlers/methods * * INPUT NORMALIZATION (Issue #251): * - Parameters can have multiple sources via `sources` field * - Resolution order: sources[0], sources[1], ..., params[key] * - Supports dot notation: 'input.elementType', 'params.type' * - Operations with `needsFullInput: true` have access to full OperationInput * * FIELD SELECTION (Issue #202): * - When `fields` param is provided, filters response to requested fields only * - Transforms field names for LLM consistency (name → element_name) * - Supports preset field sets: 'minimal', 'standard', 'full' * * @see Issue #247 - Schema-driven operation definitions * @see Issue #251 - ElementCRUD input normalization * @see Issue #202 - GraphQL field selection for response token optimization */ import { getOperationSchema, isSchemaOperation } from './OperationSchema.js'; import type { HandlerRegistry } from './MCPAQLHandler.js'; import type { OperationInput } from './types.js'; /** * Resolve a value from a dot-notation path on an object. * Example: getNestedValue({ input: { elementType: 'persona' } }, 'input.elementType') => 'persona' * * Security: Validates path format and blocks prototype pollution vectors. */ declare function getNestedValue(obj: Record, path: string): unknown; /** * SchemaDispatcher - Dispatch operations using schema definitions * * This class provides the core dispatch logic for schema-driven operations. * It replaces the manual dispatch methods in MCPAQLHandler for operations * that are defined in the schema. */ export declare class SchemaDispatcher { /** * Check if an operation can be handled by schema dispatch */ static canDispatch(operation: string): boolean; /** * Dispatch an operation using its schema definition * * @param operation - Operation name (e.g., 'browse_collection') * @param params - Operation parameters * @param registry - Handler registry with all configured handlers * @param input - Optional full OperationInput for source resolution * @returns Promise resolving to operation result * @throws Error if operation not found, handler missing, or params invalid */ static dispatch(operation: string, params: Record, registry: HandlerRegistry, input?: OperationInput): Promise; } export { isSchemaOperation, getOperationSchema }; export declare const __test__: { getNestedValue: typeof getNestedValue; SAFE_PATH_PATTERN: RegExp; FORBIDDEN_PATHS: Set; }; //# sourceMappingURL=SchemaDispatcher.d.ts.map