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 utilizing the x-zuplo-route.mcp.type
property:
Code
The x-zuplo-route.mcp configuration for prompts supports:
type: Must be set to"prompt"otherwise this will be registered as a tool.name- (optional) The identifier for the MCP prompt. If not provided, falls back to theoperationIdof the route. If nooperationIdis set, falls back to an auto-generated name.description- (optional) Description of what the prompt generates. If not provided, falls back to the operation'sdescriptionorsummaryfields. If those are not set, uses an auto-generated description.
MCP Server Handler Configuration
Add prompt configuration to your MCP Server handler options using the
operations array:
Code
See further details in the MCP Server Handler documentation.
Route Handler Implementation
Your route handler must return a structured response with a messages array
containing properly formatted message objects: these are the message objects
that will populate the LLM's context and guide it, based on the templatized user
input, towards the desired result:
Code
For more information on the format of messages to return to the LLM,
role: Either “user” or “assistant” to indicate the speaker in the message flow.content: One of the following content types defined by the MCP specification.
For more information, review
the PromptMessage type and "Data Types" described in the MCP specification.
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