Skip to content

πŸš€ The fast, Pythonic way to build MCP servers and clients.

fix: Use Message function and PromptResult type in docs (#1515)

Jeremiah Lowin2547243038d8
diff --git a/docs/servers/prompts.mdx b/docs/servers/prompts.mdx
index 1d512d98d..c57ed571b 100644
--- a/docs/servers/prompts.mdx
+++ b/docs/servers/prompts.mdx
@@ -188,10 +188,10 @@ FastMCP intelligently handles different return types from your prompt function:
- **`Any`**: If the return type is not one of the above, the return value is attempted to be converted to a string and used as a `PromptMessage`.
```python
-from fastmcp.prompts.prompt import PromptMessage
+from fastmcp.prompts.prompt import Message, PromptResult
@mcp.prompt
-def roleplay_scenario(character: str, situation: str) -> list[PromptMessage]:
+def roleplay_scenario(character: str, situation: str) -> PromptResult:
"""Sets up a roleplaying scenario with initial messages."""
return [
Message(f"Let's roleplay. You are {character}. The situation is: {situation}"),