Rebuild the docs around tested examples; shrink README.v2.md to a pitch (#2978)
This commit is contained in:
parent
4caa41f6d5
commit
411a6d3980
1 changed files with 9510 additions and 2639 deletions
21
docs_src/client_callbacks/tutorial002.py
Normal file
21
docs_src/client_callbacks/tutorial002.py
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
from mcp_types import ElicitRequestParams, ElicitResult
|
||||
|
||||
from mcp import Client
|
||||
from mcp.client import ClientRequestContext
|
||||
|
||||
|
||||
async def handle_elicitation(
|
||||
context: ClientRequestContext,
|
||||
params: ElicitRequestParams,
|
||||
) -> ElicitResult:
|
||||
return ElicitResult(action="accept", content={"name": "Ada Lovelace"})
|
||||
|
||||
|
||||
async def main() -> None:
|
||||
async with Client(
|
||||
"http://127.0.0.1:8000/mcp",
|
||||
mode="legacy",
|
||||
elicitation_callback=handle_elicitation,
|
||||
) as client:
|
||||
result = await client.call_tool("issue_card")
|
||||
print(result.content)
|
||||
Loading…
Reference in a new issue