chore: Update SDK documentation (#2604)

Co-authored-by: marvin-context-protocol[bot] <225465937+marvin-context-protocol[bot]@users.noreply.github.com>
This commit is contained in:
marvin-context-protocol[bot] 2025-12-24 16:21:31 -05:00 committed by GitHub
commit 9d5ffa86b3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
55 changed files with 3213 additions and 1480 deletions

View file

@ -0,0 +1,89 @@
---
title: requests
sidebarTitle: requests
---
# `fastmcp.server.tasks.requests`
SEP-1686 task request handlers.
Handles MCP task protocol requests: tasks/get, tasks/result, tasks/list, tasks/cancel.
These handlers query and manage existing tasks (contrast with handlers.py which creates tasks).
## Functions
### `tasks_get_handler` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/tasks/requests.py#L105" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
```python
tasks_get_handler(server: FastMCP, params: dict[str, Any]) -> GetTaskResult
```
Handle MCP 'tasks/get' request (SEP-1686).
**Args:**
- `server`: FastMCP server instance
- `params`: Request params containing taskId
**Returns:**
- Task status response with spec-compliant fields
### `tasks_result_handler` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/tasks/requests.py#L191" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
```python
tasks_result_handler(server: FastMCP, params: dict[str, Any]) -> Any
```
Handle MCP 'tasks/result' request (SEP-1686).
Converts raw task return values to MCP types based on task type.
**Args:**
- `server`: FastMCP server instance
- `params`: Request params containing taskId
**Returns:**
- MCP result (CallToolResult, GetPromptResult, or ReadResourceResult)
### `tasks_list_handler` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/tasks/requests.py#L352" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
```python
tasks_list_handler(server: FastMCP, params: dict[str, Any]) -> ListTasksResult
```
Handle MCP 'tasks/list' request (SEP-1686).
Note: With client-side tracking, this returns minimal info.
**Args:**
- `server`: FastMCP server instance
- `params`: Request params (cursor, limit)
**Returns:**
- Response with tasks list and pagination
### `tasks_cancel_handler` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/tasks/requests.py#L370" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
```python
tasks_cancel_handler(server: FastMCP, params: dict[str, Any]) -> CancelTaskResult
```
Handle MCP 'tasks/cancel' request (SEP-1686).
Cancels a running task, transitioning it to cancelled state.
**Args:**
- `server`: FastMCP server instance
- `params`: Request params containing taskId
**Returns:**
- Task status response showing cancelled state