Table of Contents

Class CreateMessageResult

Namespace
ModelContextProtocol.Protocol
Assembly
ModelContextProtocol.Core.dll

Represents a client's response to a SamplingCreateMessage from the server.

public class CreateMessageResult
Inheritance
CreateMessageResult
Inherited Members

Remarks

See the schema for details.

Properties

Content

Gets or sets the content of the message.

[JsonPropertyName("content")]
public required Content Content { get; init; }

Property Value

Content

Model

Gets or sets the name of the model that generated the message.

[JsonPropertyName("model")]
public required string Model { get; init; }

Property Value

string

Remarks

This should contain the specific model identifier such as "claude-3-5-sonnet-20241022" or "o3-mini".

This property allows the server to know which model was used to generate the response, enabling appropriate handling based on the model's capabilities and characteristics.

Role

Gets or sets the role of the user who generated the message.

[JsonPropertyName("role")]
public required Role Role { get; init; }

Property Value

Role

StopReason

Gets or sets the reason why message generation (sampling) stopped, if known.

[JsonPropertyName("stopReason")]
public string? StopReason { get; init; }

Property Value

string

Remarks

Common values include:

  • endTurnThe model naturally completed its response.
  • maxTokensThe response was truncated due to reaching token limits.
  • stopSequenceA specific stop sequence was encountered during generation.