Chapter 6: Prompts - Instructions and Templates
A Prompt in MCP (Model Context Protocol) is far more than just a piece of text. It is a server-defined template for messages that can give the LLM an identity, rules, or specific context. In the current specification (as of 2025-11-25), Prompts are a powerful instrument for steering the interaction.
What is an MCP Prompt?
Prompts are usually triggered by explicit user actions (e.g. via "slash commands" like /debug in a client). They consist of:
- Name & Description: For identification and explanation to the user.
- Arguments: Dynamic placeholders. New since November 2025: support for default values (SEP-1034).
- Icons (New 2025-11): Optional visual metadata (SEP-973).
- Messages: A list of messages that are to be sent to the model.
Expert tip: In modern agentic systems (such as Gemini CLI), slash commands often serve as an explicit trigger for Agent Skills. While a plain Prompt merely delivers text, a slash command today can activate a whole expert mode and load specialized tools "on demand" (see Chapter 23).
Implementation in Go
The Go SDK provides the method s.AddPrompt.
s.AddPrompt(&mcp.Prompt{
Name: "code_review",
Description: "Analyses the code in a specific file",
Arguments: []*mcp.PromptArgument{
{Name: "file_path", Description: "Path to the file", Required: true},
},
}, func(ctx context.Context, request *mcp.GetPromptRequest) (*mcp.GetPromptResult, error) {
path := request.Params.Arguments["file_path"]
return &mcp.GetPromptResult{
Description: "Code review instructions",
Messages: []*mcp.PromptMessage{
{
Role: "user", // "user" or "assistant" as per spec
Content: &mcp.TextContent{
Text: fmt.Sprintf("Please analyse the code in: %s", path),
},
},
},
}, nil
})New Elicitation Capabilities (SEP-1036)
Since late 2025, MCP supports extended queries (elicitation). A server can now specifically ask for URLs or use complex enums with default values. This makes Prompts even more interactive by letting the client deliberately request information from the user or from their environment (e.g. a browser URL).
Roles and Content (Specification 2025-11-25)
In the current revision, the roles within a Prompt are strictly defined:
user: Messages representing the user or instructions.assistant: Messages simulating an AI response.
Important: The classic system prompt is not carried as a message type in the list in this version. Instructions with system characteristics are instead formulated as user messages with clear directives.
Rich content: images and resources
A Prompt can contain more than just text. Since 26 March 2025 (and confirmed in November 2025), Prompts can reference Resources directly:
&mcp.PromptMessage{
Role: "user",
Content: &mcp.EmbeddedResource{
Resource: &mcp.ResourceContents{
URI: "file:///logs/error.log",
Text: "Log content here...",
},
},
}Testing Prompts with `mcp-tester`
Use the tester to make sure that your templates work correctly with arguments:
# List available prompts (including pagination support via -C)
./bin/mcp-tester prompts list --profile local
# Get a prompt (with arguments)
./bin/mcp-tester prompts get code_review --args '{"file_path": "main.go"}' --profile local← Chapter 5: Resources | Table of Contents | Next Chapter: The Power of Combination →
Copyright Michael Lechner - 2026-04-26