Skip to content

Commit 8a709f6

Browse files
authored
Merge pull request #372 from koic/clarify_server_context_hash
[Doc] Clarify `server_context` Hash requirement for `_meta` merging
2 parents 6929d52 + 8d123fb commit 8a709f6

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,11 @@ See the relevant sections below for the arguments they receive.
260260

261261
The MCP protocol supports a special [`_meta` parameter](https://modelcontextprotocol.io/specification/2025-06-18/basic#general-fields) in requests that allows clients to pass request-specific metadata. The server automatically extracts this parameter and makes it available to tools and prompts as a nested field within the `server_context`.
262262

263+
> [!NOTE]
264+
> `_meta` is only merged when `server_context` is a `Hash` (or `nil`, in which case a new `{ _meta: ... }` hash is synthesized).
265+
> If you assign a non-`Hash` value to `server_context`, `_meta` is not merged and tools will not see it
266+
> under `server_context[:_meta]`. Keep `server_context` as a `Hash` if your tools need access to `_meta`.
267+
263268
**Access Pattern:**
264269

265270
When a client includes `_meta` in the request params, it becomes available as `server_context[:_meta]`:

0 commit comments

Comments
 (0)