-
Notifications
You must be signed in to change notification settings - Fork 51
Closed
php-mcp/schema
#4Description
Hello ! When my MCP Client (Claude) try to call my tool "get_products", this error as thrown in my logs, and response from MCP is "Error executing code: Cannot convert undefined or null to object".
This is my MCP logs:
[2025-07-23T07:55:23.232001+00:00] mcp.DEBUG: Request received {"method":"POST","path":"/mcp","target":"/mcp"} []
[2025-07-23T07:55:23.232362+00:00] mcp.DEBUG: Message received. {"sessionId":"b141abde81a52372f3e46496490195a1","message":{"PhpMcp\\Schema\\JsonRpc\\Request":{"jsonrpc":"2.0","id":7,"method":"tools/call","params":{"name":"get_products"}}}} []
[2025-07-23T07:55:23.232745+00:00] mcp.ERROR: MCP Processor caught unexpected error {"method":"tools/call","exception":"PhpMcp\\Schema\\Request\\CallToolRequest::__construct(): Argument #3 ($arguments) must be of type array, stdClass given, called in .../php-mcp/schema/src/Request/CallToolRequest.php on line 66","trace":"#0 .../php-mcp/schema/src/Request/CallToolRequest.php(66): PhpMcp\\Schema\\Request\\CallToolRequest->__construct(7, 'get_...', Object(stdClass), NULL)\n#1 .../php-mcp/server/src/Dispatcher.php(77): PhpMcp\\Schema\\Request\\CallToolRequest::fromRequest(Object(PhpMcp\\Schema\\JsonRpc\\Request))\n#2 .../php-mcp/server/src/Protocol.php(192): PhpMcp\\Server\\Dispatcher->handleRequest(Object(PhpMcp\\Schema\\JsonRpc\\Request), Object(PhpMcp\\Server\\Session\\Session))\n#3 .../php-mcp/server/src/Protocol.php(142): PhpMcp\\Server\\Protocol->processRequest(Object(PhpMcp\\Schema\\JsonRpc\\Request), Object(PhpMcp\\Server\\Session\\Session))\n#4 .../vendor/evenement/evenement/src/EventEmitterTrait.php(143): PhpMcp\\Server\\Protocol->processMessage(Object(PhpMcp\\Schema\\JsonRpc\\Request), 'b141abde81a5237...', Array)\n#5 .../vendor/php-mcp/server/src/Transports/StreamableHttpServerTransport.php(359): PhpMcp\\Server\\Transports\\StreamableHttpServerTransport->emit('message', Array)\n#6 .../vendor/react/event-loop/src/Tick/FutureTickQueue.php(46): PhpMcp\\Server\\Transports\\StreamableHttpServerTransport->PhpMcp\\Server\\Transports\\{closure}()\n#7 .../vendor/react/event-loop/src/StreamSelectLoop.php(183): React\\EventLoop\\Tick\\FutureTickQueue->tick()\n#8 .../server/src/Server.php(161): React\\EventLoop\\StreamSelectLoop->run()\n#9 .../bin/mcp-serverfull.php(48): PhpMcp\\Server\\Server->listen(Object(PhpMcp\\Server\\Transports\\StreamableHttpServerTransport))\n#10 {main}"} []
[2025-07-23T07:55:23.232887+00:00] mcp.INFO: All expected responses sent for POST SSE stream. Closing. {"streamId":"3f8edfd763f7c8cce3dd4925496b4494","sessionId":"b141abde81a52372f3e46496490195a1"} []
[2025-07-23T07:55:23.232984+00:00] mcp.INFO: POST SSE stream closed by client/server. {"streamId":"3f8edfd763f7c8cce3dd4925496b4494","sessionId":"b141abde81a52372f3e46496490195a1"} []
[2025-07-23T07:55:23.233075+00:00] mcp.DEBUG: Response sent. {"sessionId":"b141abde81a52372f3e46496490195a1","payload":{"PhpMcp\\Schema\\JsonRpc\\Error":{"jsonrpc":"2.0","id":7,"error":{"code":-32603,"message":"Internal error processing method tools/call","data":"PhpMcp\\Schema\\Request\\CallToolRequest::__construct(): Argument #3 ($arguments) must be of type array, stdClass given, called in .../vendor/php-mcp/schema/src/Request/CallToolRequest.php on line 66"}}}} []
When I call the tool directly, everything works fine. There's no issue when using it through MCP Inspector either. However, when Claude makes a call to my get_languages tool followed by a get_products call, I encounter an error. It appears the payload sent by Claude is not properly interpreted by the MCP library, likely due to an unexpected format.
Metadata
Metadata
Assignees
Labels
No labels