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
15
examples/snippets/servers/elicitation_complete.py
Normal file
15
examples/snippets/servers/elicitation_complete.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
from mcp.server.fastmcp import Context, FastMCP
|
||||
from mcp.server.session import ServerSession
|
||||
|
||||
mcp = FastMCP("Elicit Complete Example")
|
||||
|
||||
|
||||
@mcp.tool()
|
||||
async def handle_oauth_callback(elicitation_id: str, ctx: Context[ServerSession, None]) -> str:
|
||||
"""Called when OAuth flow completes out-of-band."""
|
||||
# ... process the callback ...
|
||||
|
||||
# Notify the client that the elicitation is done
|
||||
await ctx.session.send_elicit_complete(elicitation_id)
|
||||
|
||||
return "Authorization complete"
|
||||
Loading…
Reference in a new issue