Package io.quarkiverse.mcp.server.test
Interface McpAssured.McpTestClient<ASSERT extends McpAssured.McpAssert<ASSERT>,CLIENT extends McpAssured.McpTestClient<ASSERT,CLIENT>>
- All Superinterfaces:
AutoCloseable
- All Known Subinterfaces:
McpAssured.McpSseTestClient,McpAssured.McpStdioTestClient,McpAssured.McpStreamableTestClient,McpAssured.McpWebSocketTestClient
- Enclosing class:
- McpAssured
public static interface McpAssured.McpTestClient<ASSERT extends McpAssured.McpAssert<ASSERT>,CLIENT extends McpAssured.McpTestClient<ASSERT,CLIENT>>
extends AutoCloseable
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface -
Method Summary
Modifier and TypeMethodDescriptiondefault voidclose()default CLIENTconnect()Connect the client and perform the MCP initialization.connect(Consumer<McpAssured.InitResult> assertFunction) Connect the client and perform the MCP initialization.voidDisconnect the client and terminate the MCP connection.booleanio.vertx.core.json.JsonObjectio.vertx.core.json.JsonObjectnewMessage(String method) default io.vertx.core.json.JsonObjectnewRequest(io.quarkiverse.mcp.server.McpMethod method) io.vertx.core.json.JsonObjectnewRequest(String method) voidsendAndForget(io.vertx.core.json.JsonObject message) Sends the message without waiting for the result.snapshot()waitForNotifications(int count) Wait until the specified number of notifications is received.waitForRequests(int count) Wait until the specified number of requests is received.io.vertx.core.json.JsonObjectwaitForResponse(io.vertx.core.json.JsonObject request) Wait until the response for the specified request is received.when()Create a group of MCP requests and corresponding assert functions.Create a group of MCP requests and corresponding assert functions.
-
Method Details
-
isConnected
boolean isConnected()- Returns:
trueif connected,falseotherwise
-
initResult
McpAssured.InitResult initResult()- Returns:
- the result of the
initializeoperation ornullif not connected
-
connect
Connect the client and perform the MCP initialization.- Returns:
- the client
-
connect
Connect the client and perform the MCP initialization.- Parameters:
assertFunction-- Returns:
- the client
-
disconnect
void disconnect()Disconnect the client and terminate the MCP connection.Does not necessarily terminate the session on the server.
-
when
ASSERT when()Create a group of MCP requests and corresponding assert functions.The MCP requests are sent immediately but the responses are not processed and the assert functions are not used until the
McpAssured.McpAssert.thenAssertResults()method is called.- Returns:
- the assert group
- See Also:
-
whenBatch
ASSERT whenBatch()Create a group of MCP requests and corresponding assert functions.The MCP requests are sent in a batch, the responses are processed and the assert functions are used when the
McpAssured.McpAssert.thenAssertResults()method is called.- Returns:
- the assert group
- See Also:
-
newMessage
- Parameters:
method-- Returns:
- a new message
-
newRequest
default io.vertx.core.json.JsonObject newRequest(io.quarkiverse.mcp.server.McpMethod method) - Parameters:
method-- Returns:
- a new request message
-
newRequest
- Parameters:
method-- Returns:
- a new request message
-
newInitMessage
io.vertx.core.json.JsonObject newInitMessage()- Returns:
- a new
initializemessage
-
sendAndForget
void sendAndForget(io.vertx.core.json.JsonObject message) Sends the message without waiting for the result.- Parameters:
message-
-
snapshot
McpAssured.Snapshot snapshot()- Returns:
- the current snapshot
-
waitForNotifications
Wait until the specified number of notifications is received.- Parameters:
count-- Returns:
- the current snapshot
-
waitForRequests
Wait until the specified number of requests is received.- Parameters:
count-- Returns:
- the current snapshot
-
waitForResponse
io.vertx.core.json.JsonObject waitForResponse(io.vertx.core.json.JsonObject request) Wait until the response for the specified request is received.- Parameters:
request-- Returns:
- the reponse
-
close
default void close()- Specified by:
closein interfaceAutoCloseable
-