File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
clients/simple-task-interactive-client
servers/simple-task-interactive Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ async def sampling_callback(context, params) -> CreateMessageResult:
4949``` python
5050# Call a tool as a task (returns immediately with task reference)
5151result = await session.experimental.call_tool_as_task(" tool_name" , {" arg" : " value" })
52- task_id = result.taskSupport .taskId
52+ task_id = result.task .taskId
5353
5454# Get result - this delivers elicitation/sampling requests and blocks until complete
5555final = await session.experimental.get_task_result(task_id, CallToolResult)
Original file line number Diff line number Diff line change @@ -19,14 +19,14 @@ This server exposes two tools:
1919
2020Asks the user for confirmation before "deleting" a file.
2121
22- - Uses ` TaskSession .elicit()` to request user input
22+ - Uses ` task .elicit()` to request user input
2323- Shows the elicitation flow: task -> input_required -> response -> complete
2424
2525### ` write_haiku ` (demonstrates sampling)
2626
2727Asks the LLM to write a haiku about a topic.
2828
29- - Uses ` TaskSession .create_message()` to request LLM completion
29+ - Uses ` task .create_message()` to request LLM completion
3030- Shows the sampling flow: task -> input_required -> response -> complete
3131
3232## Usage with the client
@@ -68,7 +68,7 @@ Softly on the quiet pon...
6868
6969## Key concepts
7070
71- 1 . ** TaskSession ** : Wraps ServerSession to enqueue elicitation/sampling requests
72- 2 . ** TaskResultHandler ** : Delivers queued messages and routes responses
73- 3 . ** task_execution() ** : Context manager for safe task execution with auto-fail
71+ 1 . ** ServerTaskContext ** : Provides ` elicit() ` and ` create_message() ` for user interaction
72+ 2 . ** run_task() ** : Spawns background work, auto-completes/fails, returns immediately
73+ 3 . ** TaskResultHandler ** : Delivers queued messages and routes responses
74744 . ** Response routing** : Responses are routed back to waiting resolvers
You can’t perform that action at this time.
0 commit comments