← Back to ToolBench
Server Capabilities
Prompts
Reusable prompt templates exposed by servers
What it does
Prompts allow servers to expose parameterized prompt templates that clients can discover and use. A prompt has a name, description, and optional arguments. When a client calls prompts/get, the server returns a fully-rendered message sequence. This enables servers to provide domain-specific prompt engineering that the LLM can leverage without the client needing to craft prompts from scratch.
How it works
Example implementation
server.prompt("code_review", { language: z.string(), code: z.string() },
async ({ language, code }) => ({
messages: [{
role: "user",
content: { type: "text", text: `Review this ${language} code:\n${code}` }
}]
})
);