Package io.modelcontextprotocol.spec
Record Class McpSchema.CreateMessageResult
java.lang.Object
java.lang.Record
io.modelcontextprotocol.spec.McpSchema.CreateMessageResult
- Record Components:
role- The role of the message sender (typically assistant)content- The content of the sampled messagemodel- The name of the model that generated the messagestopReason- The reason why sampling stopped, if knownmeta- See specification for notes on _meta usage
- All Implemented Interfaces:
McpSchema.Result
- Enclosing class:
- McpSchema
public static record McpSchema.CreateMessageResult(McpSchema.Role role, McpSchema.Content content, String model, McpSchema.CreateMessageResult.StopReason stopReason, Map<String,Object> meta)
extends Record
implements McpSchema.Result
The client's response to a sampling/create_message request from the server. The
client should inform the user before returning the sampled message, to allow them
to inspect the response (human in the loop) and decide whether to allow the server
to see it.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic enum -
Constructor Summary
ConstructorsConstructorDescriptionCreateMessageResult(McpSchema.Role role, McpSchema.Content content, String model, McpSchema.CreateMessageResult.StopReason stopReason) CreateMessageResult(McpSchema.Role role, McpSchema.Content content, String model, McpSchema.CreateMessageResult.StopReason stopReason, Map<String, Object> meta) Creates an instance of aCreateMessageResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()content()Returns the value of thecontentrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.meta()Returns the value of themetarecord component.model()Returns the value of themodelrecord component.role()Returns the value of therolerecord component.Returns the value of thestopReasonrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
CreateMessageResult
public CreateMessageResult(McpSchema.Role role, McpSchema.Content content, String model, McpSchema.CreateMessageResult.StopReason stopReason) -
CreateMessageResult
public CreateMessageResult(McpSchema.Role role, McpSchema.Content content, String model, McpSchema.CreateMessageResult.StopReason stopReason, Map<String, Object> meta) Creates an instance of aCreateMessageResultrecord class.- Parameters:
role- the value for therolerecord componentcontent- the value for thecontentrecord componentmodel- the value for themodelrecord componentstopReason- the value for thestopReasonrecord componentmeta- the value for themetarecord component
-
-
Method Details
-
builder
-
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). -
role
Returns the value of therolerecord component.- Returns:
- the value of the
rolerecord component
-
content
Returns the value of thecontentrecord component.- Returns:
- the value of the
contentrecord component
-
model
Returns the value of themodelrecord component.- Returns:
- the value of the
modelrecord component
-
stopReason
Returns the value of thestopReasonrecord component.- Returns:
- the value of the
stopReasonrecord component
-
meta
Returns the value of themetarecord component.- Specified by:
metain interfaceMcpSchema.Result- Returns:
- the value of the
metarecord component
-