Class PromptMessage
- Namespace
- nanoFramework.WebServer.Mcp
- Assembly
- nanoFramework.WebServer.Mcp.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
Remarks
A PromptMessage encapsulates content sent to or received from AI models in the Model Context Protocol. Each message has a specific role (User or Assistant) and contains content which can be text.
It serves as a core data structure in the MCP message exchange flow, particularly in prompt formation and model responses.
Constructors
PromptMessage(string)
Initializes a new instance of the PromptMessage class with this prompt text.
public PromptMessage(string text)
Parameters
textstringThe text content of the message.
Properties
Role
Gets or sets the role of the message sender, specifying whether it's from a "user" or an "assistant".
public Role Role { get; set; }
Property Value
Remarks
In the Model Context Protocol, each message must have a clear role assignment to maintain the conversation flow. User messages represent queries or inputs from users, while assistant messages represent responses generated by AI models.
Text
Gets or sets the text content of the message.
public string Text { get; set; }
Property Value
Methods
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
Remarks
Available only in mscorlib build with support for System.Reflection.