fix: normalize null to undefined in ElicitResultSchema content field (#1204)
This commit is contained in:
parent
4b651b8fe1
commit
a6ee2cb3c2
1 changed files with 6 additions and 1 deletions
|
|
@ -1831,8 +1831,13 @@ export const ElicitResultSchema = ResultSchema.extend({
|
|||
/**
|
||||
* The submitted form data, only present when action is "accept".
|
||||
* Contains values matching the requested schema.
|
||||
* Per MCP spec, content is "typically omitted" for decline/cancel actions.
|
||||
* We normalize null to undefined for leniency while maintaining type compatibility.
|
||||
*/
|
||||
content: z.record(z.string(), z.union([z.string(), z.number(), z.boolean(), z.array(z.string())])).optional()
|
||||
content: z.preprocess(
|
||||
val => (val === null ? undefined : val),
|
||||
z.record(z.string(), z.union([z.string(), z.number(), z.boolean(), z.array(z.string())])).optional()
|
||||
)
|
||||
});
|
||||
|
||||
/* Autocomplete */
|
||||
|
|
|
|||
Loading…
Reference in a new issue