mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-09 23:29:10 +02:00
* Update repository references from jlowin/fastmcp to prefecthq/fastmcp * Retrigger CI after repo transfer * chore: Update SDK documentation * Only run deep triage on bug issues for jlowin --------- Co-authored-by: marvin-context-protocol[bot] <225465937+marvin-context-protocol[bot]@users.noreply.github.com>
37 lines
1.1 KiB
Text
37 lines
1.1 KiB
Text
---
|
|
title: routing
|
|
sidebarTitle: routing
|
|
---
|
|
|
|
# `fastmcp.server.tasks.routing`
|
|
|
|
|
|
Task routing helper for MCP components.
|
|
|
|
Provides unified task mode enforcement and docket routing logic.
|
|
|
|
|
|
## Functions
|
|
|
|
### `check_background_task` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/tasks/routing.py#L26" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
```python
|
|
check_background_task(component: Tool | Resource | ResourceTemplate | Prompt, task_type: TaskType, arguments: dict[str, Any] | None = None, task_meta: TaskMeta | None = None) -> mcp.types.CreateTaskResult | None
|
|
```
|
|
|
|
|
|
Check task mode and submit to background if requested.
|
|
|
|
**Args:**
|
|
- `component`: The MCP component
|
|
- `task_type`: Type of task ("tool", "resource", "template", "prompt")
|
|
- `arguments`: Arguments for tool/prompt/template execution
|
|
- `task_meta`: Task execution metadata. If provided, execute as background task.
|
|
|
|
**Returns:**
|
|
- CreateTaskResult if submitted to docket, None for sync execution
|
|
|
|
**Raises:**
|
|
- `McpError`: If mode="required" but no task metadata, or mode="forbidden"
|
|
but task metadata is present
|
|
|