fastmcp/docs/python-sdk/fastmcp-utilities-async_utils.mdx
marvin-context-protocol[bot] 74eb8a0645
chore: Update SDK documentation (#2717)
Co-authored-by: marvin-context-protocol[bot] <225465937+marvin-context-protocol[bot]@users.noreply.github.com>
2025-12-26 16:15:08 -05:00

31 lines
789 B
Text

---
title: async_utils
sidebarTitle: async_utils
---
# `fastmcp.utilities.async_utils`
Async utilities for FastMCP.
## Functions
### `gather` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/async_utils.py#L25" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
```python
gather(*awaitables: Awaitable[T]) -> list[T] | list[T | BaseException]
```
Run awaitables concurrently and return results in order.
Uses anyio TaskGroup for structured concurrency.
**Args:**
- `*awaitables`: Awaitables to run concurrently
- `return_exceptions`: If True, exceptions are returned in results.
If False, first exception cancels all and raises.
**Returns:**
- List of results in the same order as input awaitables.