MCP Server Prompts
The MCP (Model Context Protocol) Server handler supports prompts in addition to tools, enabling you to provide reusable, parameterized prompt templates through the MCP protocol.
MCP prompts allow AI clients to request and execute structured prompt templates with dynamic parameters, making it easy to standardize and share prompt patterns and context across different AI workflows.
Overview
Much like tools, Zuplo's MCP prompts work by utilizing structured API routes as prompt generators that return formatted messages for AI consumption. When an MCP client calls a prompt, your route handler returns a structured message array that the AI can use directly.
But unlike MCP tools that perform actions and return data, MCP prompts return formatted instructions or context that guide AI reasoning and responses.
Configuration
Route Configuration
Configure a route in your OpenAPI doc:
Code
To provide MCP specific metadata for the prompt, use x-zuplo-mcp-prompt
:
Code
The x-zuplo-mcp-prompt
extension supports:
name
- The identifier for the MCP promptdescription
- Description of what the prompt generates
Without x-zuplo-mcp-prompt
, the MCP server will use the route's operationId
as the prompt name and the summary
as the prompt description.
MCP Server Handler Configuration
Add prompt configuration to your MCP Server handler options:
Code
The prompts
array supports:
path
- Path to the OpenAPI specification file containing prompt routesoperationIds
- Array of operation IDs to include as MCP prompts
Route Handler Implementation
Your route handler must return a structured response with a messages
array
containing properly formatted message objects:
Code
Message Structure
Each message in the messages
array should follow this structure:
role
- The role of the message ("assistant"
,"user"
, or"system"
)content
- The content object with:type
- Content type ("text"
for text content)text
- The actual text content
For more information, review
the PromptMessage
type described in the MCP docs.
Multiple Messages
You can return multiple messages to create complex and dynamic templates:
Code
Testing MCP Prompts
List Available Prompts
Use the MCP prompts/list
method to see available prompts:
Code
Response:
Code
Execute a Prompt
Use the MCP prompts/get
method to execute a prompt with parameters:
Code
Response:
Code
Best Practices
Prompt Design
- Write clear, specific prompt instructions that guide AI behavior
- Use parameter interpolation to create dynamic, contextual prompts
- Include relevant context and constraints in your prompt text
- Consider the target AI model's strengths and prompt formatting preferences
Parameter Schema
- Define comprehensive JSON schemas for prompt parameters - this must appear
as a
application/json
request body in aPOST
to your route. Typically, this will point to a module that programmatically can craft the prompt. - Include helpful descriptions for each parameter
- Mark required parameters appropriately
- Use validation to ensure parameter quality
Message Organization
- Use
system
messages for general behavior instructions - Use
assistant
messages for specific task guidance - Structure complex prompts as multiple focused messages
- Keep individual messages concise and purposeful