19 lines
518 B
Python
19 lines
518 B
Python
from mcp.server.fastmcp import FastMCP
|
|
from mcp.server.fastmcp.prompts import base
|
|
|
|
mcp = FastMCP(name="Prompt Example")
|
|
|
|
|
|
@mcp.prompt(title="Code Review")
|
|
def review_code(code: str) -> str:
|
|
return f"Please review this code:\n\n{code}"
|
|
|
|
|
|
@mcp.prompt(title="Debug Assistant")
|
|
def debug_error(error: str) -> list[base.Message]:
|
|
return [
|
|
base.UserMessage("I'm seeing this error:"),
|
|
base.UserMessage(error),
|
|
base.AssistantMessage("I'll help debug that. What have you tried so far?"),
|
|
]
|