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
Commit 0d340e1
Browse filesBrowse the repository at this point in the historyBrowse files
[Server] Keep JSON types of tool call arguments (#678)
* [Server] Keep JSON types of tool call arguments
* [Examples] Show JSON object arguments in complex-tool-schema
* [Examples] Send an object carrying data in the complex-tool-schema interop case
* [Server] Set empty object defaults after schema merges and keep parse errors
* [Capability] Keep a Traversable passed to an iterable parameter
* [Server] Refuse only tools/call on member names starting with NUL
Copy file name to clipboardExpand all lines: CHANGELOG.md
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,6 +42,11 @@ All notable changes to `mcp/sdk` will be documented in this file.
42
42
* Fix a handler still running after its request was answered, e.g. without a fiber scheduler: it no longer fires `ResponseEvent` or `ErrorEvent`, what it throws is logged, and calling the `ClientGateway` throws.
43
43
*[BC Break] Bind handshake-era sessions to the principal that opened them: `AccessToken::getPrincipal()`, or the `StreamableHttpTransport::PRINCIPAL_ATTRIBUTE` request attribute when set. Requests of another principal, and to sessions opened before the upgrade, are answered with `404`, and to a session the store cannot read with `503`. `Protocol::processInput()`, the transports' `handleMessage()`, `handleSessionEnd()`, `handlePostRequest()` and `handleDeleteRequest()`, and the `onMessage()` and `onSessionEnd()` listeners take a `?string $principal` as last argument.
44
44
*[BC Break] Answer malformed JSON and an `initialize` sent with a session id with HTTP `400`, and a failure before the session is checked with `500`, instead of `200`. Such an answer no longer carries, or removes, the messages queued for the session in `Mcp-Session-Id`.
45
+
*[BC Break] Keep the JSON types of `tools/call` arguments, so validation sees what the client sent: `{}` and `{"0":"x"}` are objects, `[]` and `["x"]` are arrays. Nested JSON objects in `CallToolRequest::$arguments` and in the arguments of `ToolHandlerInterface::execute()` are `\stdClass`.
46
+
*[BC Break] Tool parameters without a type, or typed `mixed`, receive nested JSON objects as `\stdClass`. Parameters typed `array` still receive arrays at every level. Parameters typed `object` or `\stdClass`, which always failed with a `TypeError`, receive `\stdClass`.
47
+
*[BC Break] Reject `tools/call` when `arguments` is not a JSON object with `-32600`, including `"arguments": []`.
48
+
*[BC Break] Reject `tools/call` with `-32600` when its message has a member name starting with a NUL byte, as its arguments cannot keep their JSON types then.
49
+
*[BC Break]`array<string, T>` parameters generate `{"type": "object"}` instead of `{"type": "array"}`, and `array<int, T>` parameters accept a JSON array or a JSON object.
|[`combined-registration`](https://github.com/modelcontextprotocol/php-sdk/tree/main/examples/server/combined-registration)| Discovery and manual registration combined, and which wins on conflict |[Registering elements](servers/registration.md)|
26
26
|[`cached-discovery`](https://github.com/modelcontextprotocol/php-sdk/tree/main/examples/server/cached-discovery)| Caching the discovery scan in a PSR-16 cache |[Server builder](run/server-builder.md#discovery-configuration)|
27
27
|[`custom-dependencies`](https://github.com/modelcontextprotocol/php-sdk/tree/main/examples/server/custom-dependencies)| Handlers pulling services from a PSR-11 container |[Server builder](run/server-builder.md#service-dependencies)|
|[`env-variables`](https://github.com/modelcontextprotocol/php-sdk/tree/main/examples/server/env-variables)| Configuring a server through environment variables |[Server builder](run/server-builder.md)|
31
31
|[`client-communication`](https://github.com/modelcontextprotocol/php-sdk/tree/main/examples/server/client-communication)| Sampling, roots, progress and log messages from inside a handler |[Talking back to the client](handlers/client-communication.md)|
0 commit comments