Skip to content

Commit b37543e

Browse files
corvid-agentfelixweinberger
authored andcommitted
fix(core): allow additional JSON Schema properties in elicitInput requestedSchema
Adds .catchall(z.unknown()) to requestedSchema, matching the pattern used by inputSchema/outputSchema. Fixes type incompatibility when using Zod v4's .toJSONSchema() output which includes extra properties like $schema and additionalProperties. Fixes #1362
1 parent 40174d2 commit b37543e

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@modelcontextprotocol/core': patch
3+
---
4+
5+
Allow additional JSON Schema properties in elicitInput's requestedSchema type by adding .catchall(z.unknown()), matching the pattern used by inputSchema. This fixes type incompatibility when using Zod v4's .toJSONSchema() output which includes extra properties like $schema and additionalProperties.

packages/core/src/types/schemas.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1855,11 +1855,13 @@ export const ElicitRequestFormParamsSchema = TaskAugmentedRequestParamsSchema.ex
18551855
* A restricted subset of JSON Schema.
18561856
* Only top-level properties are allowed, without nesting.
18571857
*/
1858-
requestedSchema: z.object({
1859-
type: z.literal('object'),
1860-
properties: z.record(z.string(), PrimitiveSchemaDefinitionSchema),
1861-
required: z.array(z.string()).optional()
1862-
})
1858+
requestedSchema: z
1859+
.object({
1860+
type: z.literal('object'),
1861+
properties: z.record(z.string(), PrimitiveSchemaDefinitionSchema),
1862+
required: z.array(z.string()).optional()
1863+
})
1864+
.catchall(z.unknown())
18631865
});
18641866

18651867
/**

0 commit comments

Comments
 (0)