Package io.modelcontextprotocol.spec
Record Class McpSchema.JSONRPCResponse
java.lang.Object
java.lang.Record
io.modelcontextprotocol.spec.McpSchema.JSONRPCResponse
- Record Components:
jsonrpc- The JSON-RPC version (must be "2.0")id- The request identifier that this response corresponds toresult- The result of the successful requesterror- Error information if the request failed
- All Implemented Interfaces:
McpSchema.JSONRPCMessage
- Enclosing class:
- McpSchema
public static record McpSchema.JSONRPCResponse(String jsonrpc, Object id, Object result, McpSchema.JSONRPCResponse.JSONRPCError error)
extends Record
implements McpSchema.JSONRPCMessage
A successful (non-error) response to a request.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordA response to a request that indicates an error occurred. -
Constructor Summary
ConstructorsConstructorDescriptionJSONRPCResponse(String jsonrpc, Object id, Object result, McpSchema.JSONRPCResponse.JSONRPCError error) Creates an instance of aJSONRPCResponserecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.error()Returns the value of theerrorrecord component.final inthashCode()Returns a hash code value for this object.id()Returns the value of theidrecord component.jsonrpc()Returns the value of thejsonrpcrecord component.result()Returns the value of theresultrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
JSONRPCResponse
public JSONRPCResponse(String jsonrpc, Object id, Object result, McpSchema.JSONRPCResponse.JSONRPCError error) Creates an instance of aJSONRPCResponserecord class.
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
jsonrpc
Returns the value of thejsonrpcrecord component.- Specified by:
jsonrpcin interfaceMcpSchema.JSONRPCMessage- Returns:
- the value of the
jsonrpcrecord component
-
id
Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
result
Returns the value of theresultrecord component.- Returns:
- the value of the
resultrecord component
-
error
Returns the value of theerrorrecord component.- Returns:
- the value of the
errorrecord component
-