๐Ÿš€ Everything is free โ€” help us improve! Submit feedback and shape the platform.
๐ŸงชTDD Challengeยทintermediateยทโฑ๏ธ 30โ€“45mยทโญ 175 XP

M-050Build an MCP Prompt Template Server

Description

Nebula Corp wants to share reusable prompt templates across all their AI assistants via MCP. Build a prompt template server that registers templates with argument placeholders, lists available prompts, and renders them with provided arguments. The server should support variable interpolation like {{customerName}} and validate that all required arguments are provided.

Test Cases (4)

Lists all prompts
Should list all registered prompt templates
Input:handleRequest({ method: 'prompts/list' })
Expected:CONTAINS:customer-support
Renders support prompt
Should render template with provided arguments
Input:handleRequest({ method: 'prompts/get', params: { name: 'customer-support', arguments: { companyName: 'Nebula', customerName: 'Alice', issue: 'billing error' } } })
Expected:CONTAINS:Nebula
Rejects missing required args
Should error when required arguments are missing
Input:handleRequest({ method: 'prompts/get', params: { name: 'customer-support', arguments: { companyName: 'Nebula' } } })
Expected:CONTAINS:Missing
Handles optional args gracefully
Should render even when optional args are omitted
Input:handleRequest({ method: 'prompts/get', params: { name: 'code-review', arguments: { language: 'Python', code: 'print(1)' } } })
Expected:CONTAINS:Python

Related Lessons

Click Run / Check to validate your solution