File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -160,6 +160,15 @@ export function normalizeUnionType(schema: JsonSchemaType): JsonSchemaType {
160160 return { ...schema , type : "string" , anyOf : undefined } ;
161161 }
162162
163+ // Handle anyOf with boolean and null (FastMCP pattern)
164+ if (
165+ schema . anyOf &&
166+ schema . anyOf . some ( ( t ) => ( t as JsonSchemaType ) . type === "boolean" ) &&
167+ schema . anyOf . some ( ( t ) => ( t as JsonSchemaType ) . type === "null" )
168+ ) {
169+ return { ...schema , type : "boolean" , anyOf : undefined } ;
170+ }
171+
163172 // Handle array type with string and null
164173 if (
165174 Array . isArray ( schema . type ) &&
@@ -169,6 +178,15 @@ export function normalizeUnionType(schema: JsonSchemaType): JsonSchemaType {
169178 return { ...schema , type : "string" } ;
170179 }
171180
181+ // Handle array type with boolean and null
182+ if (
183+ Array . isArray ( schema . type ) &&
184+ schema . type . includes ( "boolean" ) &&
185+ schema . type . includes ( "null" )
186+ ) {
187+ return { ...schema , type : "boolean" } ;
188+ }
189+
172190 return schema ;
173191}
174192
You can’t perform that action at this time.
0 commit comments