File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
src/mcp/server/fastmcp/utilities Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -219,7 +219,7 @@ def func_metadata(
219219 """
220220 try :
221221 sig = inspect .signature (func , eval_str = True )
222- except NameError as e :
222+ except NameError as e : # pragma: no cover
223223 # This raise could perhaps be skipped, and we (FastMCP) just call
224224 # model_rebuild right before using it 🤷
225225 raise InvalidSignature (f"Unable to evaluate type annotations for callable { func .__name__ !r} " ) from e
@@ -298,7 +298,9 @@ def func_metadata(
298298 # Reconstruct the original annotation, by preserving the remaining metadata,
299299 # i.e. from `Annotated[CallToolResult, ReturnType, Gt(1)]` to
300300 # `Annotated[ReturnType, Gt(1)]`:
301- original_annotation = Annotated [(return_type_expr , * inspected_return_ann .metadata [1 :])]
301+ original_annotation = Annotated [
302+ (return_type_expr , * inspected_return_ann .metadata [1 :])
303+ ] # pragma: no cover
302304 else :
303305 # We only had `Annotated[CallToolResult, ReturnType]`, treat the original annotation
304306 # as beging `ReturnType`:
Original file line number Diff line number Diff line change @@ -1188,15 +1188,15 @@ def test_disallowed_type_qualifier():
11881188 from mcp .server .fastmcp .exceptions import InvalidSignature
11891189
11901190 def func_disallowed_qualifier () -> Final [int ]: # type: ignore
1191- pass
1191+ pass # pragma: no cover
11921192
11931193 with pytest .raises (InvalidSignature ) as exc_info :
11941194 func_metadata (func_disallowed_qualifier )
11951195 assert "return annotation contains an invalid type qualifier" in str (exc_info .value )
11961196
11971197
11981198def test_preserves_pydantic_metadata ():
1199- def func_with_metadata () -> Annotated [int , Field (gt = 1 )]: ...
1199+ def func_with_metadata () -> Annotated [int , Field (gt = 1 )]: ... # pragma: no branch
12001200
12011201 meta = func_metadata (func_with_metadata )
12021202
You can’t perform that action at this time.
0 commit comments