Skip to content

Commit 5725802

Browse files
corvid-agentclaude
andcommitted
fix(core): allow additional JSON Schema properties in elicitInput requestedSchema
Add .catchall(z.unknown()) to the requestedSchema object type in ElicitRequestFormParamsSchema, matching the existing pattern used by inputSchema and outputSchema. This fixes a type incompatibility when passing Zod v4's .toJSONSchema() output (which includes $schema, additionalProperties, etc.) to elicitInput's requestedSchema parameter. Fixes #1362 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 65bbcea commit 5725802

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed
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/types.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1993,11 +1993,13 @@ export const ElicitRequestFormParamsSchema = TaskAugmentedRequestParamsSchema.ex
19931993
* A restricted subset of JSON Schema.
19941994
* Only top-level properties are allowed, without nesting.
19951995
*/
1996-
requestedSchema: z.object({
1997-
type: z.literal('object'),
1998-
properties: z.record(z.string(), PrimitiveSchemaDefinitionSchema),
1999-
required: z.array(z.string()).optional()
2000-
})
1996+
requestedSchema: z
1997+
.object({
1998+
type: z.literal('object'),
1999+
properties: z.record(z.string(), PrimitiveSchemaDefinitionSchema),
2000+
required: z.array(z.string()).optional()
2001+
})
2002+
.catchall(z.unknown())
20012003
});
20022004

20032005
/**

0 commit comments

Comments
 (0)