File tree Expand file tree Collapse file tree
samples/QuickstartWeatherServer/Tools Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1-
21using System . Text . Json ;
32
43namespace ModelContextProtocol ;
54
65internal static class HttpClientExt
76{
8- public static async Task < JsonDocument > ReadJsonDocument ( this HttpClient client , string requestUri )
7+ public static async Task < JsonDocument > ReadJsonDocumentAsync ( this HttpClient client , string requestUri )
98 {
109 using var response = await client . GetAsync ( requestUri ) ;
1110 response . EnsureSuccessStatusCode ( ) ;
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ public static async Task<string> GetAlerts(
1414 HttpClient client ,
1515 [ Description ( "The US state to get alerts for." ) ] string state )
1616 {
17- using var jsonDocument = await client . ReadJsonDocument ( $ "/alerts/active/area/{ state } ") ;
17+ using var jsonDocument = await client . ReadJsonDocumentAsync ( $ "/alerts/active/area/{ state } ") ;
1818 var jsonElement = jsonDocument . RootElement ;
1919 var alerts = jsonElement . GetProperty ( "features" ) . EnumerateArray ( ) ;
2020
@@ -42,7 +42,7 @@ public static async Task<string> GetForecast(
4242 [ Description ( "Latitude of the location." ) ] double latitude ,
4343 [ Description ( "Longitude of the location." ) ] double longitude )
4444 {
45- using var jsonDocument = await client . ReadJsonDocument ( $ "/points/{ latitude } ,{ longitude } ") ;
45+ using var jsonDocument = await client . ReadJsonDocumentAsync ( $ "/points/{ latitude } ,{ longitude } ") ;
4646 var jsonElement = jsonDocument . RootElement ;
4747 var periods = jsonElement . GetProperty ( "properties" ) . GetProperty ( "periods" ) . EnumerateArray ( ) ;
4848
You can’t perform that action at this time.
0 commit comments