@@ -896,36 +896,6 @@ def test_tool(value: int) -> int:
896896 assert mcp_spans [0 ]["origin" ] == "auto.ai.mcp"
897897
898898
899- @pytest .mark .parametrize ("FastMCP" , fastmcp_implementations , ids = fastmcp_ids )
900- def test_fastmcp_without_request_context (sentry_init , capture_events , FastMCP ):
901- """Test FastMCP handling when no request context is available"""
902- sentry_init (
903- integrations = [MCPIntegration ()],
904- traces_sample_rate = 1.0 ,
905- )
906- events = capture_events ()
907-
908- mcp = FastMCP ("Test Server" )
909-
910- # Clear request context
911- if request_ctx is not None :
912- request_ctx .set (None )
913-
914- @mcp .tool ()
915- def test_tool_no_ctx (x : int ) -> dict :
916- """Test tool without context"""
917- return {"result" : x + 1 }
918-
919- with start_transaction (name = "fastmcp tx" ):
920- result = call_tool_through_mcp (mcp , "test_tool_no_ctx" , {"x" : 99 })
921-
922- assert result == {"result" : 100 }
923-
924- # Should still create transaction even if context is missing
925- (tx ,) = events
926- assert tx ["type" ] == "transaction"
927-
928-
929899# =============================================================================
930900# Transport Detection Tests
931901# =============================================================================
0 commit comments