Class PromptMessage | MCP C# SDK

Namespace
ModelContextProtocol.Protocol
Assembly
ModelContextProtocol.Core.dll

Represents a message within the Model Context Protocol (MCP) system, used for communication between clients and AI models.

public sealed class PromptMessage
Inheritance

PromptMessage

Inherited Members
Extension Methods

Properties

Content

Gets or sets the content of the message, which can be text, image, audio, or an embedded resource.

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

Property Value

ContentBlock

Remarks

Role

Gets or sets the role of the message sender, specifying whether it's from a "user" or an "assistant".

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

Property Value

Role