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
  • Method Details

    • isConnected

      boolean isConnected()
      Returns:
      true if connected, false otherwise
    • initResult

      McpAssured.InitResult initResult()
      Returns:
      the result of the initialize operation or null if not connected
    • connect

      default CLIENT connect()
      Connect the client and perform the MCP initialization.
      Returns:
      the client
    • connect

      CLIENT connect(Consumer<McpAssured.InitResult> assertFunction)
      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

      io.vertx.core.json.JsonObject newMessage(String method)
      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

      io.vertx.core.json.JsonObject newRequest(String method)
      Parameters:
      method -
      Returns:
      a new request message
    • newInitMessage

      io.vertx.core.json.JsonObject newInitMessage()
      Returns:
      a new initialize message
    • sendAndForget

      void sendAndForget(io.vertx.core.json.JsonObject message)
      Sends the message without waiting for the result.
      Parameters:
      message -
    • snapshot

      Returns:
      the current snapshot
    • waitForNotifications

      McpAssured.Snapshot waitForNotifications(int count)
      Wait until the specified number of notifications is received.
      Parameters:
      count -
      Returns:
      the current snapshot
    • waitForRequests

      McpAssured.Snapshot waitForRequests(int count)
      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:
      close in interface AutoCloseable