Class McpRequestId

java.lang.Object
com.soklet.McpRequestId

@ThreadSafe public final class McpRequestId extends Object
An immutable MCP JSON-RPC request identifier.
Author:
Mark Allen
  • Method Details

    • fromString

      Creates a request identifier from its string wire value.
      Parameters:
      value - the string identifier
      Returns:
      the request identifier
    • fromInteger

      Creates a request identifier from its integral numeric wire value.
      Parameters:
      value - the integral identifier
      Returns:
      the request identifier
    • asString

      Returns the string representation when this is a string request ID.
      Returns:
      the string value, or the empty optional for an integer request ID
    • asInteger

      Returns the numeric representation when this is an integer request ID.
      Returns:
      the integer value, or the empty optional for a string request ID
    • equals

      public boolean equals(@Nullable Object object)
      Compares request IDs by wire type and value.
      Overrides:
      equals in class Object
      Parameters:
      object - the object to compare
      Returns:
      true if the object is an equal request ID
    • hashCode

      public int hashCode()
      Returns a hash code derived from the request ID's wire type and value.
      Overrides:
      hashCode in class Object
      Returns:
      the request ID hash code
    • toString

      Returns a redacted diagnostic representation that preserves only the MCP wire type. Request identifiers are client-supplied and may contain secrets or high-cardinality values; use asString() or asInteger() only when exact application processing requires them.
      Overrides:
      toString in class Object
      Returns:
      the safe diagnostic representation