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
Copy file name to clipboardExpand all lines: docs/clients/tools.mdx
+25Lines changed: 25 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -101,6 +101,31 @@ async with client:
101
101
-`arguments`: Dictionary of arguments to pass to the tool (optional)
102
102
-`timeout`: Maximum execution time in seconds (optional, overrides client-level timeout)
103
103
-`progress_handler`: Progress callback function (optional, overrides client-level handler)
104
+
-`meta`: Dictionary of metadata to send with the request (optional, see below)
105
+
106
+
## Sending Metadata
107
+
108
+
<VersionBadgeversion="2.13.1" />
109
+
110
+
The `meta` parameter sends ancillary information alongside tool calls. This can be used for various purposes like observability, debugging, client identification, or any context the server may need beyond the tool's primary arguments.
The structure and usage of `meta` is determined by your application. See [Client Metadata](/servers/context#client-metadata) in the server documentation to learn how to access this data in your tool implementations.
-**`ctx.client_id -> str | None`**: Get the ID of the client making the request, if provided during initialization
314
314
-**`ctx.session_id -> str | None`**: Get the MCP session ID for session-based data sharing (HTTP transports only)
315
315
316
+
#### Client Metadata
317
+
318
+
<VersionBadgeversion="2.13.1" />
319
+
320
+
Clients can send contextual information with their requests using the `meta` parameter. This metadata is accessible through `ctx.request_context.meta` and is available for all MCP operations (tools, resources, prompts).
321
+
322
+
The `meta` field is `None` when clients don't provide metadata. When provided, metadata is accessible via attribute access (e.g., `meta.user_id`) rather than dictionary access. The structure of metadata is determined by the client making the request.
0 commit comments