mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-26 23:44:17 +02:00
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:
parent
ae3c2abbf6
commit
9d5ffa86b3
55 changed files with 3213 additions and 1480 deletions
89
docs/python-sdk/fastmcp-server-tasks-requests.mdx
Normal file
89
docs/python-sdk/fastmcp-server-tasks-requests.mdx
Normal 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
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue