C.W.K.
Stream
Lesson 04 of 05 · published

Prompts — Templated Workflows

~18 min · prompts, templates, user-invokable

Level 0Curious Reader
0 XP0/48 lessons0/14 achievements
0/100 XP to next level100 XP to go0% complete

Prompts are the underrated primitive. A Prompt in MCP is a server-defined templated workflow that the user invokes — typically through a slash command or a quick-pick menu in the host UI. The server owns the wording, the variables, and the structure; the user fills in arguments and the host inflates the template into a conversation seed.

The flow: client lists prompts (prompts/list), the host renders them in its UI as user-invokable items, user picks one and supplies arguments, host calls prompts/get, server returns a list of messages already filled in. The host then injects those messages into the LLM context as the start of the conversation.

Why bother? Because the server author knows the right phrasing for their domain. A GitHub MCP server's "summarize this PR" prompt can know exactly which fields to pull (title, description, recent commits, review comments) and how to ask the model to format the answer. The user does not need to remember the right prompt; the server ships it.

Prompts compose well with the rest of the protocol. A prompt response can include resource references that the host should read in (so the prompt template stays small) and tool suggestions that hint the LLM what to call next. Treat prompts as the server's chance to set up a conversation, not just to send a one-off message.

Code

Defining a prompt in the Python SDK·python
from mcp.server.fastmcp import FastMCP
from mcp.types import GetPromptResult, PromptMessage, TextContent

app = FastMCP("github-server")

@app.prompt()
def review_pr(pr_number: int) -> GetPromptResult:
    pr = github.get_pull(pr_number)
    return GetPromptResult(
        description=f"Review pull request #{pr_number}: {pr.title}",
        messages=[
            PromptMessage(role="user", content=TextContent(
                type="text",
                text=(
                    f"Review PR #{pr_number}.\n"
                    f"Title: {pr.title}\n"
                    f"Description: {pr.body}\n\n"
                    f"Focus on correctness and changes that touch user data. "
                    f"Suggest at most three improvements."
                ),
            )),
        ],
    )

External links

Exercise

Add one prompt to your tiny server — something domain-specific like 'summarize_recent_changes' or 'draft_release_notes'. Connect from Claude Desktop and invoke it through the slash-command UI. Notice the moment the user sees the prompt's seed message and realizes the server author has already done the prompt-engineering work.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.