Describe the bug
When calling a tool with no arguments the request is malformed. The PHP JSON implementation transforms the empty arguments array to a JSON array: [] instead of the expected {} by JSON-RPC.
To Reproduce
Use this script to reproduce the behavior:
<?php
use Mcp\Client;
use Mcp\Client\Transport\HttpTransport;
$client = Client::builder()
->setClientInfo('HTTP Example Client', '1.0.0')
->setInitTimeout(30)
->setRequestTimeout(60)
->build();
$transport = new HttpTransport(
endpoint: 'https://knowledge-mcp.global.api.aws',
);
$client->connect($transport);
$client->callTool('aws___list_regions', []);
Expected behavior
Currently the request body is as follow:
{"jsonrpc":"2.0","id":3,"method":"tools\/call","params":{"name":"aws___list_regions","arguments":[]}}
Note "arguments":[], that should be "arguments":{}:
{"jsonrpc":"2.0","id":3,"method":"tools\/call","params":{"name":"aws___list_regions","arguments":{}}}
Logs
Additional context
The AWS MCP server returns the following error:
{"jsonrpc":"2.0","id":3,"error":{"code":-32600,"message":"Invalid request - Malformed JSON-RPC request"}}
Describe the bug
When calling a tool with no arguments the request is malformed. The PHP JSON implementation transforms the empty arguments array to a JSON array:
[]instead of the expected{}by JSON-RPC.To Reproduce
Use this script to reproduce the behavior:
Expected behavior
Currently the request body is as follow:
{"jsonrpc":"2.0","id":3,"method":"tools\/call","params":{"name":"aws___list_regions","arguments":[]}}Note
"arguments":[], that should be"arguments":{}:{"jsonrpc":"2.0","id":3,"method":"tools\/call","params":{"name":"aws___list_regions","arguments":{}}}Logs
Additional context
The AWS MCP server returns the following error:
{"jsonrpc":"2.0","id":3,"error":{"code":-32600,"message":"Invalid request - Malformed JSON-RPC request"}}