Skip to content

Function: coercePromptArgs()

ts
function coercePromptArgs(rawArgs, zodSchema): Record<string, unknown>;

Defined in: packages/core/src/prompt/PromptExecutionPipeline.ts:100

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.

Parameters

ParameterTypeDescription
rawArgsRecord<string, string>Raw string arguments from the MCP client
zodSchemaZodObject<ZodRawShape>The validated Zod schema for this prompt

Returns

Record<string, unknown>

Coerced argument values ready for Zod validation