Skip to content

πŸš€ The fast, Pythonic way to build MCP servers and clients.

stop subscripting list init

William Easton16ebb666d6bc
diff --git a/src/fastmcp/server/server.py b/src/fastmcp/server/server.py
index 64227babd..97f14a7c9 100644
--- a/src/fastmcp/server/server.py
+++ b/src/fastmcp/server/server.py
@@ -641,7 +641,7 @@ class FastMCP(Generic[LifespanResultT]):
)
# Apply the middleware chain.
- return list[Tool](
+ return list(
await self._apply_middleware(
context=mw_context, call_next=self._list_tools
)
@@ -725,7 +725,7 @@ class FastMCP(Generic[LifespanResultT]):
)
# Apply the middleware chain.
- return list[Resource](
+ return list(
await self._apply_middleware(
context=mw_context, call_next=self._list_resources
)
@@ -819,7 +819,7 @@ class FastMCP(Generic[LifespanResultT]):
)
# Apply the middleware chain.
- return list[ResourceTemplate](
+ return list(
await self._apply_middleware(
context=mw_context, call_next=self._list_resource_templates
)
@@ -917,7 +917,7 @@ class FastMCP(Generic[LifespanResultT]):
)
# Apply the middleware chain.
- return list[Prompt](
+ return list(
await self._apply_middleware(
context=mw_context, call_next=self._list_prompts
)
@@ -1103,7 +1103,7 @@ class FastMCP(Generic[LifespanResultT]):
method="resources/read",
fastmcp_context=fastmcp.server.dependencies.get_context(),
)
- return list[ReadResourceContents](
+ return list(
await self._apply_middleware(
context=mw_context, call_next=self._read_resource
)