Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/widen-elicit-requested-schema.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@modelcontextprotocol/core': patch
---

Widen `requestedSchema` type in `ElicitRequestFormParams` to accept additional JSON Schema fields (e.g., `$schema`, `additionalProperties`) that tools like Zod's `.toJSONSchema()` produce. This removes the need for users to cast through `unknown` when passing Zod-generated schemas to `elicitInput()`.
1 change: 1 addition & 0 deletions packages/core/src/types/spec.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2795,6 +2795,7 @@ export interface ElicitRequestFormParams extends TaskAugmentedRequestParams {
* Only top-level properties are allowed, without nesting.
*/
requestedSchema: {
[key: string]: unknown;
$schema?: string;
type: 'object';
properties: {
Expand Down
12 changes: 7 additions & 5 deletions packages/core/src/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2024,11 +2024,13 @@ export const ElicitRequestFormParamsSchema = TaskAugmentedRequestParamsSchema.ex
* A restricted subset of JSON Schema.
* Only top-level properties are allowed, without nesting.
*/
requestedSchema: z.object({
type: z.literal('object'),
properties: z.record(z.string(), PrimitiveSchemaDefinitionSchema),
required: z.array(z.string()).optional()
})
requestedSchema: z
.object({
type: z.literal('object'),
properties: z.record(z.string(), PrimitiveSchemaDefinitionSchema),
required: z.array(z.string()).optional()
})
.passthrough()
});

/**
Expand Down
Loading