Repository navigation
Reject roots listing before sending unsupported client requests - #1160
karthiksenv wants to merge 1 commit into
Conversation
soyeladice-svg
left a comment
There was a problem hiding this comment.
AI-assisted review: the new integration assertion appears to check the wrong failure mode. listRoots() returns a Mono<ListRootsResult>, and the new guards return Mono.error(...); they do not throw synchronously when exchange.listRoots() is called. assertThatThrownBy(exchange::listRoots) only invokes the method reference and receives the Mono, so it should not observe the IllegalStateException unless the publisher is subscribed/blocked. Could this assertion consume the publisher (for example assertThatThrownBy(() -> exchange.listRoots().block())...) or use StepVerifier as the unit tests do? Otherwise the integration test does not actually pin the new fail-fast behavior.
|
@soyeladice-svg Thanks for checking this. That concern would apply to the async exchange, but this test uses I reran the 41 async exchange tests and both HTTP/SSE |
|
You're right — I traced the handler type again and missed that this integration path receives |
|
@soyeladice-svg Thanks for taking another look and confirming that your concern is resolved. If you're happy with the rest of the changes, could you please approve the PR? I'd appreciate your review so we can move it toward getting merged. |
A server calling
listRootsagainst an uninitialized client or one without the roots capability currently sends an unsupportedroots/listrequest. Add the same fail-fast checks used by sampling and elicitation, returning anIllegalStateExceptionbefore contacting the session.Fixes #1067.
Both
listRootsoverloads are covered by regression tests that assert no session interaction before or after subscription. Roots support withlistChanged=falseremains valid. The shared client/server integration test now asserts the local exception and a successful tool response instead of allowing an unasserted call to pass.Validation on Windows with Temurin 17.0.19 and embedded Tomcat 11.0.2:
sendRequestwas called.mvnw.cmd -pl mcp-core -am clean testpassed all 457 core tests.testRootsWithoutCapabilitypassed with both Jackson 3 and Jackson 2 (two tests per backend).git diff --checkpassed.mvnw.cmd verify: core and both Jackson modules passed;mcp-testran 822 tests with 0 assertion failures and 12 errors caused by unavailable Docker / dependent class initialization. Conformance modules were skipped after that failure. This is not a fully green local CI run.workflow ci.yml not found on the default branch; the Ubuntu/Docker CI environment remains unverified.This is an AI-assisted contribution requiring human review. The repository's AI submission threshold is not met; the exact required disclosure is included in
disclosure.txt.