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
The x-zuplo-route.mcp configuration for prompts supports:
type: Must be set to"prompt"name- The identifier for the MCP promptdescription- Description of what the prompt generates
Without x-zuplo-route.mcp, the MCP server will attempt to register it as a
tool, or if configured as a prompt via legacy methods, 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 using the
operations array:
Code
The operations array supports:
file- Path to the OpenAPI specification file containing prompt routesid- The operation ID to include as an MCP prompt
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/jsonrequest body in aPOSTto 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
systemmessages for general behavior instructions - Use
assistantmessages for specific task guidance - Structure complex prompts as multiple focused messages
- Keep individual messages concise and purposeful