MCP Academy · Lesson

Register Your First Prompt

Decorate a function to publish a prompt.

Your First Prompt

Time to publish a prompt: a reusable, user-triggered template that starts a task with well-crafted wording every time. 💬

The Decorator

You turn a plain Python function into a prompt with the @mcp.prompt() decorator, just like you marked tools with @mcp.tool().

@mcp.prompt()
def greet() -> str:
    return "Say hello warmly."

All lessons in this course

  1. Register Your First Prompt
  2. Add Arguments to a Prompt
  3. Return Messages, Not Just Text
  4. A Code-Review Prompt Template
← Back to MCP Academy