Spaces:
Running
Running
Jeremiah Lowin Claude commited on
fix: Use Message function and PromptResult type in docs (#1515)
Browse files- docs/servers/prompts.mdx +2 -2
docs/servers/prompts.mdx
CHANGED
|
@@ -188,10 +188,10 @@ FastMCP intelligently handles different return types from your prompt function:
|
|
| 188 |
- **`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`.
|
| 189 |
|
| 190 |
```python
|
| 191 |
-
from fastmcp.prompts.prompt import
|
| 192 |
|
| 193 |
@mcp.prompt
|
| 194 |
-
def roleplay_scenario(character: str, situation: str) ->
|
| 195 |
"""Sets up a roleplaying scenario with initial messages."""
|
| 196 |
return [
|
| 197 |
Message(f"Let's roleplay. You are {character}. The situation is: {situation}"),
|
|
|
|
| 188 |
- **`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`.
|
| 189 |
|
| 190 |
```python
|
| 191 |
+
from fastmcp.prompts.prompt import Message, PromptResult
|
| 192 |
|
| 193 |
@mcp.prompt
|
| 194 |
+
def roleplay_scenario(character: str, situation: str) -> PromptResult:
|
| 195 |
"""Sets up a roleplaying scenario with initial messages."""
|
| 196 |
return [
|
| 197 |
Message(f"Let's roleplay. You are {character}. The situation is: {situation}"),
|