Skip to content
This repository was archived by the owner on Apr 8, 2025. It is now read-only.

Commit 3b93f07

Browse files
committed
Updates for dotnet; GetForecast needs to make two client api calls
1 parent 9573fef commit 3b93f07

File tree

1 file changed

+27
-12
lines changed

1 file changed

+27
-12
lines changed

Diff for: quickstart/server.mdx

+27-12
Original file line numberDiff line numberDiff line change
@@ -747,12 +747,12 @@ Save the file, and restart **Claude for Desktop**.
747747
<Tab title='Java'>
748748

749749
<Note>
750-
This is a quickstart demo based on Spring AI MCP auto-configuration and boot starters.
750+
This is a quickstart demo based on Spring AI MCP auto-configuration and boot starters.
751751
To learn how to create sync and async MCP Servers, manually, consult the [Java SDK Server](/sdk/java/mcp-server) documentation.
752752
</Note>
753753

754754

755-
Let's get started with building our weather server!
755+
Let's get started with building our weather server!
756756
[You can find the complete code for what we'll be building here.](https://github.com/spring-projects/spring-ai-examples/tree/main/model-context-protocol/weather/starter-stdio-server)
757757

758758
For more information, see the [MCP Server Boot Starter](https://docs.spring.io/spring-ai/reference/api/mcp/mcp-server-boot-starter-docs.html) reference documentation.
@@ -789,7 +789,7 @@ You will need to add the following dependencies:
789789
```groovy
790790
dependencies {
791791
implementation platform("org.springframework.ai:spring-ai-starter-mcp-server")
792-
implementation platform("org.springframework:spring-web")
792+
implementation platform("org.springframework:spring-web")
793793
}
794794
```
795795
</Tab>
@@ -848,7 +848,7 @@ public class WeatherService {
848848
// - Wind speed and direction
849849
// - Detailed forecast description
850850
}
851-
851+
852852
@Tool(description = "Get weather alerts for a US state")
853853
public String getAlerts(
854854
@ToolParam(description = "Two-letter US state code (e.g. CA, NY") String state)
@@ -868,7 +868,7 @@ public class WeatherService {
868868
The `@Service` annotation with auto-register the service in your application context.
869869
The Spring AI `@Tool` annotation, making it easy to create and maintain MCP tools.
870870

871-
The auto-configuration will automatically register these tools with the MCP server.
871+
The auto-configuration will automatically register these tools with the MCP server.
872872

873873
### Create your Boot Application
874874

@@ -907,11 +907,11 @@ Let's now test your server from an existing MCP host, Claude for Desktop.
907907
Claude for Desktop is not yet available on Linux.
908908
</Note>
909909

910-
First, make sure you have Claude for Desktop installed.
910+
First, make sure you have Claude for Desktop installed.
911911
[You can install the latest version here.](https://claude.ai/download) If you already have Claude for Desktop, **make sure it's updated to the latest version.**
912912

913-
We'll need to configure Claude for Desktop for whichever MCP servers you want to use.
914-
To do this, open your Claude for Desktop App configuration at `~/Library/Application Support/Claude/claude_desktop_config.json` in a text editor.
913+
We'll need to configure Claude for Desktop for whichever MCP servers you want to use.
914+
To do this, open your Claude for Desktop App configuration at `~/Library/Application Support/Claude/claude_desktop_config.json` in a text editor.
915915
Make sure to create the file if it doesn't exist.
916916

917917
For example, if you have [VS Code](https://code.visualstudio.com/) installed:
@@ -929,7 +929,7 @@ For example, if you have [VS Code](https://code.visualstudio.com/) installed:
929929
</Tab>
930930
</Tabs>
931931

932-
You'll then add your servers in the `mcpServers` key.
932+
You'll then add your servers in the `mcpServers` key.
933933
The MCP UI elements will only show up in Claude for Desktop if at least one server is properly configured.
934934

935935
In this case, we'll add our single weather server like so:
@@ -1033,7 +1033,7 @@ For more information, see the [MCP Client Boot Starters](https://docs.spring.io/
10331033

10341034
## More Java MCP Server examples
10351035

1036-
The [starter-webflux-server](https://github.com/spring-projects/spring-ai-examples/tree/main/model-context-protocol/weather/starter-webflux-server) demonstrates how to create a MCP server using SSE transport.
1036+
The [starter-webflux-server](https://github.com/spring-projects/spring-ai-examples/tree/main/model-context-protocol/weather/starter-webflux-server) demonstrates how to create a MCP server using SSE transport.
10371037
It showcases how to define and register MCP Tools, Resources, and Prompts, using the Spring Boot's auto-configuration capabilities.
10381038

10391039
</Tab>
@@ -1503,7 +1503,12 @@ namespace QuickstartWeatherServer.Tools;
15031503
[McpServerToolType]
15041504
public static class WeatherTools
15051505
{
1506-
[McpServerTool, Description("Get weather alerts for a US state.")]
1506+
[McpServerTool,
1507+
Description(@"
1508+
Get weather alerts for a US state.
1509+
Args:
1510+
State: Two-letter US state code (e.g. CA, NY)
1511+
")]
15071512
public static async Task<string> GetAlerts(
15081513
HttpClient client,
15091514
[Description("The US state to get alerts for.")] string state)
@@ -1529,13 +1534,23 @@ public static class WeatherTools
15291534
}));
15301535
}
15311536

1532-
[McpServerTool, Description("Get weather forecast for a location.")]
1537+
[McpServerTool,
1538+
Description(@"
1539+
Get weather forecast for a location.
1540+
1541+
Args:
1542+
Latitude: Latitude of the location.
1543+
Longitude: Longitude of the location.
1544+
")]
15331545
public static async Task<string> GetForecast(
15341546
HttpClient client,
15351547
[Description("Latitude of the location.")] double latitude,
15361548
[Description("Longitude of the location.")] double longitude)
15371549
{
15381550
var jsonElement = await client.GetFromJsonAsync<JsonElement>($"/points/{latitude},{longitude}");
1551+
var forecastUrl = jsonElement.GetProperty("properties").GetProperty("forecast").GetString();
1552+
1553+
jsonElement = await client.GetFromJsonAsync<JsonElement>(forecastUrl);
15391554
var periods = jsonElement.GetProperty("properties").GetProperty("periods").EnumerateArray();
15401555

15411556
return string.Join("\n---\n", periods.Select(period => $"""

0 commit comments

Comments
 (0)