You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Capability] An array shape with a nullable or union key rejects valid tool arguments #612
A tool whose array parameter is documented with an array shape that has a nullable key, such as @param array{name: string, nickname: string|null} $user, rejects every call with -32602. SchemaGenerator looks for null anywhere in the type string to decide whether a parameter is nullable, so the null of the nickname key makes the whole parameter array|null and the schema loses the shape.
A ?string key does not hit that check, but the shape conversion maps ?string and union keys such as int|string to object, so those keys reject their values instead.
and tools/call with {"user": {"name": "Ada", "nickname": null}} returns:
-32602 Invalid parameters for tool 'greet': Property '/user': Invalid type. Expected `array|null`, but received `object`.
With array{name: string, age: ?int} or array{id: int|string}, the schema keeps the shape but types age and id as object, so "age": 5 and "id": 7 fail with "Expected object, but received integer".
Expected behavior
The schema keeps the shape and types each key from its own union, for example:
Activity