Skip to content

Function: assertFlatSchema()

ts
function assertFlatSchema(schema): void;

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

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.

Parameters

ParameterTypeDescription
schemaZodObject<ZodRawShape>The Zod schema to validate

Returns

void

Throws

Error with coaching message if nested types are found