-
Notifications
You must be signed in to change notification settings - Fork 860
feat: Add support for meta parameter to list tools call( paginated request already support meta field). #907
Description
Expected Behavior
McpSyncClient and McpAsyncClient should provide support for passing meta parameter or to expose overloaded paginated list methods that accept a meta parameter, consistent with the Python SDK:
java
client.listTools(String cursor, Map<String, Object> meta)
Current Behavior
McpSchema.PaginatedRequest now has a meta field (added in #344), but listTools
only accepts a cursor string with no way to pass _meta. Due to this, the meta field though supported in request cannot be passed via client for listTools call. Note: The Python SDK already supports this: list_tools(cursor=None, meta=None).
Context
-
How has this issue affected you? When building an MCP server that needs
to pass authentication data via_metain tools/list requests, Java clients have
no way to include this metadata even though the schema supports it. -
What are you trying to accomplish? Pass request-scoped metadata in tools/list calls from Java MCP clients,
consistent with what the Python SDK already supports. -
What other alternatives have you considered? Using a lower-level transport layer to manually construct the JSON-RPC request, but this bypasses the SDK's client abstraction entirely.
-
Are you aware of any workarounds? No clean workaround exists within the SDK API. The only option is to bypass McpSyncClient/McpAsyncClient and send raw JSON-RPC messages directly.
A PR with the implementation is available:PR #906