Prompts are templates the user picks. The model does not call them by itself, and the application only reads them when the user asks for one.
How a client discovers prompts
Clients enumerate available prompts by calling theprompts/list RPC method. The server responds with a list of prompt templates and metadata. After the user chooses a prompt and provides any required arguments, the client requests a filled-in prompt with prompts/get.
Example (simplified) JSON-RPC response for prompts/list:
prompts/list response:
_metaprovides server identity and versioning.promptsis an array of templates the client can present to the user.- Each prompt includes
name,description, and anargumentsschema the client can use to render a form or elicitation UI.
escalate_shipment with ref = "PL-4417"), the client calls prompts/get. The server returns the assembled prompt content and metadata.
Example (simplified) request and response for prompts/get:
Request (client -> server):
messages array contains the assembled prompt text and its role. The client should surface this message as the user input to the model (or otherwise present it in the UI).
Prompts are not tools. They are user-facing templates and must be selected and filled by a user (or user-driven UI). Do not assume the model will request or use prompts automatically.
Example server implementation (server.py)
Below is a focused example showing how to register a prompt template on the server side using the MCP server API. This demonstrates a prompt that builds a short escalation note for a shipment reference.- The
@server.promptdecorator registers a prompt template calledescalate_shipment. - The prompt function accepts
ref: strand returns a concrete text prompt based on application data. - Returning a factual, specific prompt helps reduce model hallucination by grounding the prompt in known data.
Prompts vs. Tools vs. Resources — quick comparison
Example mcp.json snippet (register server)
Below is an example client-side MCP config to launch the server locally:Typical client workflow
- Discover available servers (server discovery).
- Client calls
prompts/listto enumerate available prompt templates. - User selects a prompt and provides any required arguments (for example,
ref = "PL-4417"). - Client calls
prompts/getto fetch the filled-in prompt text. - Client presents the returned
messagestext as the user input to a model or surfaces it in the UI.
References and further reading
- MCP protocol and server patterns — see your project’s MCP documentation for protocol details and conventions.
- JSON-RPC specification: https://www.jsonrpc.org/specification
- Pydantic (used in many MCP server examples): https://pydantic-docs.helpmanual.io/