Class McpContext.McpServerResponse

java.lang.Object
org.forgerock.openig.mcp.McpContext.McpServerResponse
Enclosing class:
McpContext

public static final class McpContext.McpServerResponse extends Object
A helper object for working with a valid MCP Server response.
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the error code if this response represents an error response, otherwise 0.
    Returns the error message if this response represents an error response, otherwise null.
    id()
    Returns the ID of the response, can be either a number or a String.
    boolean
    Returns true if this response represents an error response.
    boolean
    Returns true if this response is in response to an initialize request.
    Returns the server name if this is a response to an initialize request, otherwise null.
    Returns the server version if this is a response to an initialize request, otherwise null.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • id

      public JsonValue id()
      Returns the ID of the response, can be either a number or a String.
      Returns:
      the ID of the response, can be either a number or a String
    • isError

      public boolean isError()
      Returns true if this response represents an error response.
      Returns:
      true if this response represents an error response
    • errorCode

      public int errorCode()
      Returns the error code if this response represents an error response, otherwise 0.
      Returns:
      the error code if this response represents an error response, otherwise 0
    • errorMessage

      public String errorMessage()
      Returns the error message if this response represents an error response, otherwise null.
      Returns:
      the error message if this response represents an error response, otherwise null
    • serverName

      public String serverName()
      Returns the server name if this is a response to an initialize request, otherwise null.
      Returns:
      the server name if this is a response to an initialize request, otherwise null
    • serverVersion

      public String serverVersion()
      Returns the server version if this is a response to an initialize request, otherwise null.
      Returns:
      the server version if this is a response to an initialize request, otherwise null
    • isInitialize

      public boolean isInitialize()
      Returns true if this response is in response to an initialize request.
      Returns:
      true if this response is in response to an initialize request