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
PHPDoc pseudo-types (non-empty-string, positive-int, list<T> in shapes…) become {"type":"object"} and valid calls are rejected #641
Follow-up to #397/#422 and #612/#613: those fixed int<…> ranges and nullable or union keys in shapes, but on main (after #613) other PHPDoc types still fall through to object.
Since #422, int<0, max> maps to integer, but other PHPDoc types that override the native type still fall through to object: non-empty-string, numeric-string, class-string, lowercase-string, positive-int, non-negative-int, array-key, literals ('a'|'b'), non-empty-list<T>, non-empty-array<T>. Inside an array shape, keys typed list<T>, mixed, array<K, V> or any of the above also become object. The tool then rejects every valid call with -32602.
Actual: -32602 Invalid parameters for tool 'greet': Property '/name': Invalid type. Expected object, but received string. (tag with {"a":{"tags":["x"]}} is rejected the same way.)
Expected: string, and an array of string, as the native type or the PHPStan meaning says.
Possible solution
In SchemaGenerator, when a DocBlock type maps to nothing known, fall back to the native reflection type instead of object (getParameterTypeString(), mapPhpTypeToJsonSchemaType() default), and map the common pseudo-types to their base type. In shapes, mapTypeToSchema() / mapSimpleTypeToJsonSchema() need the same, plus list<T> and a split of shape keys that is aware of <…> (the comma in array<int, string> currently splits the key).
Versions: mcp/sdk main (5d311d6) and v0.9.0, PHP 8.3.
Activity
[Capability] Map PHPDoc pseudo-types to the JSON Schema type of their…
[Capability] Map PHPDoc pseudo-types to the JSON Schema type of their…