Skip to content

Commit ddb2440

Browse files
committed
update docs
1 parent d1604b1 commit ddb2440

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

README.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -389,20 +389,23 @@ Prompts are reusable templates that help LLMs interact with your server effectiv
389389
<!-- snippet-source examples/snippets/servers/basic_prompt.py -->
390390
```python
391391
from mcp.server.fastmcp import FastMCP
392+
from mcp.server.fastmcp.prompts import base
392393

393394
mcp = FastMCP(name="Prompt Example")
394395

395396

396-
@mcp.prompt(description="Generate a summary")
397-
def summarize(text: str, max_words: int = 100) -> str:
398-
"""Create a summarization prompt."""
399-
return f"Summarize this text in {max_words} words:\n\n{text}"
397+
@mcp.prompt(title="Code Review")
398+
def review_code(code: str) -> str:
399+
return f"Please review this code:\n\n{code}"
400400

401401

402-
@mcp.prompt(description="Explain a concept")
403-
def explain(concept: str, audience: str = "general") -> str:
404-
"""Create an explanation prompt."""
405-
return f"Explain {concept} for a {audience} audience"
402+
@mcp.prompt(title="Debug Assistant")
403+
def debug_error(error: str) -> list[base.Message]:
404+
return [
405+
base.UserMessage("I'm seeing this error:"),
406+
base.UserMessage(error),
407+
base.AssistantMessage("I'll help debug that. What have you tried so far?"),
408+
]
406409
```
407410
_Full example: [examples/snippets/servers/basic_prompt.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/basic_prompt.py)_
408411
<!-- /snippet-source -->

0 commit comments

Comments
 (0)