User Message

In the MCP sampling protocol, a User Message represents the literal input from the human interacting with the AI application.

Structure

User messages are part of the messages array in a sampling/createMessage call. They usually contain text but can also contain image or file data if the host supports multimodal inputs.

{
  "role": "user",
  "content": {
    "type": "text",
    "text": "Can you list the files in my current directory?"
  }
}

Contextual Flow

The user message typically triggers the AI to decide whether it needs to call a server tool or read a resource before generating a final response.

Questions & Answers

What does a "User Message" represent in an AI conversation?

In the context of MCP sampling, a user message represents the specific, literal input or instruction provided by the human user to the AI application or agent.

Can user messages contain data other than simple text?

Yes. Depending on the host application’s support for multimodal inputs, user messages can incorporate various types of content, including image data or file attachments, which are then passed to the AI model.

How does the AI model typically process a user message?

When a user message is received, the AI model analyzes the request to determine if it needs to invoke a server tool, access a resource, or request more context before it can generate a final, helpful response.

Back to Glossary