feat: add support for meta parameter in listTools#906
Open
smohite04 wants to merge 1 commit intomodelcontextprotocol:mainfrom
Open
feat: add support for meta parameter in listTools#906smohite04 wants to merge 1 commit intomodelcontextprotocol:mainfrom
smohite04 wants to merge 1 commit intomodelcontextprotocol:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add support for meta parameter in listTools method.
Motivation and Context
McpSchema.PaginatedRequest now has a meta field (added in #344), but the client API methods don't expose it. As a result, servers which can accept the meta parameter in list tools cannot be used with java client. The Python SDK already supports passing
_metain tools/list requests:python
async def list_tools(self, *, cursor=None, meta=None) -> ListToolsResultThis change aligns the Java SDK with the Python SDK and the MCP spec which allows
_metain PaginatedRequestParams.How Has This Been Tested?
McpAsyncClientTests.testListToolsWithCursorAndMeta()andtestSyncListToolsWithCursorAndMeta()- verify_metais correctly serialized in the JSON-RPC requestAbstractMcpSyncClientTests.testListToolsWithMeta()- verified against the real server-everything MCP server via HttpClientStreamableHttpSyncClientTests (Docker/Testcontainers).Ran per recommendations
Breaking Changes
None. New overloaded methods added; existing listTools(String cursor) behavior unchanged.
Types of changes
Checklist
Additional context
Closes #907