docs: add snippet verification for docs/ pages (#2115)
This commit is contained in:
parent
cfbbd7d71a
commit
1ef124e4a8
1 changed files with 446 additions and 43 deletions
12
examples/snippets/servers/prompt_change_notifications.py
Normal file
12
examples/snippets/servers/prompt_change_notifications.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
from mcp.server.fastmcp import Context, FastMCP
|
||||
from mcp.server.session import ServerSession
|
||||
|
||||
mcp = FastMCP("Dynamic Prompts")
|
||||
|
||||
|
||||
@mcp.tool()
|
||||
async def update_prompts(ctx: Context[ServerSession, None]) -> str:
|
||||
"""Update available prompts and notify clients."""
|
||||
# ... modify prompts ...
|
||||
await ctx.session.send_prompt_list_changed()
|
||||
return "Prompts updated"
|
||||
Loading…
Reference in a new issue