Skip to content

fix(schema): avoid assuming array items are strings - #3

Merged
lihq1403 merged 1 commit into
dtyq:masterfrom
yixin2021:fix/array-schema-items
Nov 16, 2026
Merged

lihq1403 merged 1 commit into
dtyq:masterfrom
yixin2021:fix/array-schema-items

Conversation

@yixin2021

Copy link
Copy Markdown

Problem

SchemaUtils::generateInputSchemaByClassMethod() generated every PHP array parameter with:

'items' => ['type' => 'string']

A PHP array type does not provide element type information. This causes valid arrays of objects, such as MCP filter definitions, to be advertised and validated as string arrays.

Fix

Remove the assumed string items schema and generate only type: array when the element shape is unknown. Callers with known structures can continue to provide explicit inputSchema definitions.

Validation

  • Updated SchemaUtilsTest expectations for array parameters.
  • PHPUnit: 10 tests, 15 assertions passed.
  • PHPStan: no errors.
  • PHP syntax check and git diff --check passed.

@lihq1403
lihq1403 merged commit e9c38ec into dtyq:master Nov 16, 2026
0 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants