MCPA Certification Curriculum

Prompt Templates and Argument Completion

A prompt is a template the server writes and the user chooses to run. Nothing about it should surprise the person who picked it. Explain why prompts are user-controlled, and how that differs from the model-controlled tools primitive and the application-driven resources primitive. Read prompts/list and prompts/get requests and results, including arguments, pagination cursors, and cache hints. Build PromptMessage content from text and resource links, and substitute caller-supplied arguments into a template. Return -32602 for an unknown prompt name, a missing required argument, and an unrecognized pagination cursor. Use completion/complete with ref/prompt and ref/resource references, context.arguments, and the 100-value cap with hasMore. A host that lets a user type a slash command needs somewhere to keep the text those commands expand into. It could hardcode a handful of templates into the client, but then every new template needs a client release, and no two hosts agree on the same set. It could let the model invent the wording each time, but then a careful, reviewed prompt, the kind a team writes once and wants everyone to reuse the same way, drifts a little differently every time it runs. MCP gives that text a home on the server, behind a primitive built for exactly this: content the user picks on purpose, with named arguments the host can turn into a form.…

Prompt Templates and Argument Completion: A prompt is a template the server writes and the user chooses to run. Nothing about it should surprise the person…

This free lesson is part of the AI Engineering from Scratch curriculum. Read the full explanation, run the lesson code, and verify the result in the interactive reader or from the repository source.

Browse the complete course catalog or open this lesson on GitHub.