---
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

