Interface McpClientListener


public interface McpClientListener
Listener interface for monitoring MCP client operations.
  • Method Details

    • beforeInitialize

      default void beforeInitialize(McpCallContext context)
      Called before sending the initialize request to the MCP server.
    • afterInitialize

      default void afterInitialize(McpCallContext context)
      Called after the initialize request completes successfully.
    • onInitializeError

      default void onInitializeError(McpCallContext context, Throwable error)
      Called when the initialize request fails.
    • beforeExecuteTool

      default void beforeExecuteTool(McpCallContext context)
      Called before executing a tool.
    • afterExecuteTool

      default void afterExecuteTool(McpCallContext context, ToolExecutionResult result, Map<String,Object> rawResult)
      Called after executing a tool if the execution was successful, or if it resulted in an application-level error (but not a protocol-level or communication error).
    • onExecuteToolError

      default void onExecuteToolError(McpCallContext context, Throwable error)
      Called when a tool execution fails due to a protocol-level or communication error.
    • beforeToolsList

      default void beforeToolsList(McpCallContext context)
      Called before listing tools from the MCP server.
    • afterToolsList

      default void afterToolsList(McpCallContext context, List<ToolSpecification> tools)
      Called after listing tools from the MCP server completes successfully.
    • onToolsListError

      default void onToolsListError(McpCallContext context, Throwable error)
      Called when listing tools from the MCP server fails.
    • beforeResourceGet

      default void beforeResourceGet(McpCallContext context)
      Called before getting a resource.
    • afterResourceGet

      default void afterResourceGet(McpCallContext context, McpReadResourceResult result, Map<String,Object> rawResult)
      Called after getting a resource.
    • onResourceGetError

      default void onResourceGetError(McpCallContext context, Throwable error)
      Called when getting a resource fails.
    • beforeResourcesList

      default void beforeResourcesList(McpCallContext context)
      Called before listing resources from the MCP server.
    • afterResourcesList

      default void afterResourcesList(McpCallContext context, List<McpResource> resources)
      Called after listing resources from the MCP server completes successfully.
    • onResourcesListError

      default void onResourcesListError(McpCallContext context, Throwable error)
      Called when listing resources from the MCP server fails.
    • beforeResourceTemplatesList

      default void beforeResourceTemplatesList(McpCallContext context)
      Called before listing resource templates from the MCP server.
    • afterResourceTemplatesList

      default void afterResourceTemplatesList(McpCallContext context, List<McpResourceTemplate> templates)
      Called after listing resource templates from the MCP server completes successfully.
    • onResourceTemplatesListError

      default void onResourceTemplatesListError(McpCallContext context, Throwable error)
      Called when listing resource templates from the MCP server fails.
    • beforeResourceSubscribe

      default void beforeResourceSubscribe(McpCallContext context)
      Called before subscribing to a resource.
    • afterResourceSubscribe

      default void afterResourceSubscribe(McpCallContext context)
      Called after subscribing to a resource completes successfully.
    • onResourceSubscribeError

      default void onResourceSubscribeError(McpCallContext context, Throwable error)
      Called when subscribing to a resource fails.
    • beforeResourceUnsubscribe

      default void beforeResourceUnsubscribe(McpCallContext context)
      Called before unsubscribing from a resource.
    • afterResourceUnsubscribe

      default void afterResourceUnsubscribe(McpCallContext context)
      Called after unsubscribing from a resource completes successfully.
    • onResourceUnsubscribeError

      default void onResourceUnsubscribeError(McpCallContext context, Throwable error)
      Called when unsubscribing from a resource fails.
    • beforePromptGet

      default void beforePromptGet(McpCallContext context)
      Called before getting a prompt.
    • afterPromptGet

      default void afterPromptGet(McpCallContext context, McpGetPromptResult result, Map<String,Object> rawResult)
      Called after getting a prompt.
    • onPromptGetError

      default void onPromptGetError(McpCallContext context, Throwable error)
      Called when getting a prompt fails.
    • beforePromptsList

      default void beforePromptsList(McpCallContext context)
      Called before listing prompts from the MCP server.
    • afterPromptsList

      default void afterPromptsList(McpCallContext context, List<McpPrompt> prompts)
      Called after listing prompts from the MCP server completes successfully.
    • onPromptsListError

      default void onPromptsListError(McpCallContext context, Throwable error)
      Called when listing prompts from the MCP server fails.
    • beforePing

      default void beforePing(McpCallContext context)
      Called before sending a ping request to the MCP server.
    • afterPing

      default void afterPing(McpCallContext context)
      Called after the ping request completes successfully (the server has responded with a pong).
    • onPingError

      default void onPingError(McpCallContext context, Throwable error)
      Called when the ping request fails (the server didn't send a pong in time or some transport-level issue occurred).
    • onRootsListChanged

      default void onRootsListChanged(McpCallContext context)
      Called after the client sends a notifications/roots/list_changed notification to the server.
    • onNotificationToolsListChanged

      default void onNotificationToolsListChanged()
      Called when the server sends a notifications/tools/list_changed notification.
    • onNotificationResourcesListChanged

      default void onNotificationResourcesListChanged()
      Called when the server sends a notifications/resources/list_changed notification.
    • onNotificationPromptsListChanged

      default void onNotificationPromptsListChanged()
      Called when the server sends a notifications/prompts/list_changed notification.
    • onNotificationResourceUpdated

      default void onNotificationResourceUpdated(String uri)
      Called when the server sends a notifications/resources/updated notification.
    • onNotificationMessage

      default void onNotificationMessage(McpLogMessage message)
      Called when the server sends a notifications/message (log message) notification.
    • onNotificationProgress

      default void onNotificationProgress(McpProgressNotification notification)
      Called when the server sends a notifications/progress notification.
    • onServerPing

      default void onServerPing()
      Called when the server sends a ping request and the client responds.
    • onServerRootsList

      default void onServerRootsList()
      Called when the server sends a roots/list request and the client responds.