Skip to content

Conversation

@judus
Copy link
Contributor

@judus judus commented Jul 23, 2025

This PR includes two commits:

  1. Normalize stdClass to array in Request::fromArray() to ensure params is always array or null
  2. Normalize arguments in CallToolRequest::fromRequest() by defaulting to [] and casting stdClass to array

Together, these fixes eliminate the root cause of php-mcp/server#53,
which caused type errors when clients omitted 'arguments' or sent an empty object {}.

Fixes php-mcp/server#53
See php-mcp/server#53 (comment)

judus added 2 commits July 23, 2025 18:28
…fety

Converts stdClass to an associative array when decoding 'params' in JsonRpc\Request,
ensuring type compliance with downstream DTOs.

Fixes php-mcp/server#53
See php-mcp/server#53 (comment)
Fixes runtime issue where 'arguments' could be a stdClass when omitted or sent as {}.
Casts to array and defaults to [] to ensure strict constructor contract.

Related to php-mcp/server#53
@CodeWithKyrian
Copy link
Contributor

Going ahead to merge this one in. Thanks a lot for the contribution!

@CodeWithKyrian CodeWithKyrian merged commit 380c4a0 into php-mcp:main Jul 25, 2025
@judus judus deleted the fix/request-params-normalization branch July 25, 2025 14:53
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.

Error when Client MCP try to get products list

2 participants