We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0790305 commit cb17c8bCopy full SHA for cb17c8b
src/mcp/server/fastmcp/resources/templates.py
@@ -5,7 +5,7 @@
5
import inspect
6
import re
7
from collections.abc import Callable
8
-from typing import TYPE_CHECKING, Any
+from typing import TYPE_CHECKING, Any, get_origin
9
10
from pydantic import BaseModel, Field, validate_call
11
@@ -58,7 +58,9 @@ def from_function(
58
59
sig = inspect.signature(fn)
60
for param_name, param in sig.parameters.items():
61
- if param.annotation is Context:
+ if get_origin(param.annotation) is not None:
62
+ continue
63
+ if issubclass(param.annotation, Context):
64
context_kwarg = param_name
65
break
66
0 commit comments