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 {
160
160
return { ...schema , type : "string" , anyOf : undefined } ;
161
161
}
162
162
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
+
163
172
// Handle array type with string and null
164
173
if (
165
174
Array . isArray ( schema . type ) &&
@@ -169,6 +178,15 @@ export function normalizeUnionType(schema: JsonSchemaType): JsonSchemaType {
169
178
return { ...schema , type : "string" } ;
170
179
}
171
180
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
+
172
190
return schema ;
173
191
}
174
192
You can’t perform that action at this time.
0 commit comments