feat: add support for meta parameter in listTools by smohite04 · Pull Request #906 · modelcontextprotocol/java-sdk
Add support for meta parameter in listTools method.
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 _meta in tools/list requests:
This change aligns the Java SDK with the Python SDK and the MCP spec which allows _meta in PaginatedRequestParams.
Unit tests (McpAsyncClientTests):
Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.467 s
testListToolsWithCursorAndMeta -- Time elapsed: 0.031 s ✅
testSyncListToolsWithCursorAndMeta -- Time elapsed: 0.006 s ✅
testListToolsWithEmptyCursor -- Time elapsed: 0.360 s ✅
(+ 4 existing tests passing)
BUILD SUCCESS
Integration test (HttpClientStreamableHttpSyncClientTests against real
server-everything via Docker):
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 13.59 s
testListToolsWithMeta -- Time elapsed: 0.445 s ✅
BUILD SUCCESS
None. New overloaded methods added; existing listTools(String cursor) behavior unchanged.