/** * PromptExecutionPipeline — Prompt Hydration Pipeline * * Handles the complete lifecycle of a `prompts/get` request: * * 1. Schema-Informed Coercion (string → typed values) * 2. Zod Validation (.strict() + coaching errors) * 3. Middleware Chain execution * 4. Handler invocation * * Key feature: **Schema-Informed Boundary Coercion** * MCP transmits ALL prompt arguments as `Record`. * This module reads the Zod schema AST to determine expected types * and coerces string values deterministically — no guessing. * * @module */ import { type ZodObject, type ZodRawShape } from 'zod'; import { type PromptResult } from './types.js'; import { type MiddlewareFn } from '../core/types.js'; /** * Assert that a Zod schema only contains flat primitive fields. * * Throws a descriptive error if any field uses arrays, objects, * tuples, records, maps, or sets — types that MCP clients cannot * render as visual form fields. * * Called at **definition time** (in `definePrompt()`) to fail fast * and prevent runtime surprises. * * @param schema - The Zod schema to validate * @throws Error with coaching message if nested types are found */ export declare function assertFlatSchema(schema: ZodObject): void; /** * Schema-Informed Boundary Coercion. * * Reads the Zod schema AST to determine expected types, * then coerces string values from the MCP wire format. * * This is NOT guessing. The coercion is derived from the * developer's declared schema — it's deterministic. * * @param rawArgs - Raw string arguments from the MCP client * @param zodSchema - The validated Zod schema for this prompt * @returns Coerced argument values ready for Zod validation */ export declare function coercePromptArgs(rawArgs: Record, zodSchema: ZodObject): Record; /** * Execute the full prompt hydration pipeline. * * Steps: * 1. Coerce string args to typed values using schema AST * 2. Validate with Zod (.strict() enforced) * 3. Run middleware chain * 4. Execute handler * * @returns Either a `PromptResult` or an error `PromptResult` with coaching */ export declare function executePromptPipeline(ctx: TContext, rawArgs: Record, schema: ZodObject | undefined, middlewares: readonly MiddlewareFn[], handler: (ctx: TContext, args: Record) => Promise): Promise; //# sourceMappingURL=PromptExecutionPipeline.d.ts.map