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
19
docs_src/client_callbacks/tutorial004.py
Normal file
19
docs_src/client_callbacks/tutorial004.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
from mcp_types import CreateMessageRequestParams, CreateMessageResult, ListRootsResult, Root, TextContent
|
||||
from pydantic import FileUrl
|
||||
|
||||
from mcp.client import ClientRequestContext
|
||||
|
||||
|
||||
async def handle_sampling(
|
||||
context: ClientRequestContext,
|
||||
params: CreateMessageRequestParams,
|
||||
) -> CreateMessageResult:
|
||||
return CreateMessageResult(
|
||||
role="assistant",
|
||||
content=TextContent(type="text", text="The answer is 42."),
|
||||
model="my-llm",
|
||||
)
|
||||
|
||||
|
||||
async def handle_list_roots(context: ClientRequestContext) -> ListRootsResult:
|
||||
return ListRootsResult(roots=[Root(uri=FileUrl("file:///home/ada/notebooks"), name="notebooks")])
|
||||
Loading…
Reference in a new issue