Merge pull request #82 from YunYouJun/feat/upgrade-ts-sdk-api
chore: update dependencies and refactor tool registration
This commit is contained in:
commit
c85399b2f7
3 changed files with 897 additions and 72 deletions
937
weather-server-typescript/package-lock.json
generated
937
weather-server-typescript/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -17,10 +17,10 @@
|
|||
"license": "ISC",
|
||||
"description": "",
|
||||
"devDependencies": {
|
||||
"@types/node": "^22.10.0",
|
||||
"typescript": "^5.7.2"
|
||||
"@types/node": "^22.19.2",
|
||||
"typescript": "^5.9.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@modelcontextprotocol/sdk": "^1.4.0"
|
||||
"@modelcontextprotocol/sdk": "^1.24.3"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,11 +79,14 @@ const server = new McpServer({
|
|||
});
|
||||
|
||||
// Register weather tools
|
||||
server.tool(
|
||||
server.registerTool(
|
||||
"get-alerts",
|
||||
"Get weather alerts for a state",
|
||||
{
|
||||
state: z.string().length(2).describe("Two-letter state code (e.g. CA, NY)"),
|
||||
title: "Get Weather Alerts",
|
||||
description: "Get weather alerts for a state",
|
||||
inputSchema: {
|
||||
state: z.string().length(2).describe("Two-letter state code (e.g. CA, NY)"),
|
||||
},
|
||||
},
|
||||
async ({ state }) => {
|
||||
const stateCode = state.toUpperCase();
|
||||
|
|
@ -127,16 +130,19 @@ server.tool(
|
|||
},
|
||||
);
|
||||
|
||||
server.tool(
|
||||
server.registerTool(
|
||||
"get-forecast",
|
||||
"Get weather forecast for a location",
|
||||
{
|
||||
latitude: z.number().min(-90).max(90).describe("Latitude of the location"),
|
||||
longitude: z
|
||||
.number()
|
||||
.min(-180)
|
||||
.max(180)
|
||||
.describe("Longitude of the location"),
|
||||
title: "Get Weather Forecast",
|
||||
description: "Get weather forecast for a location",
|
||||
inputSchema: {
|
||||
latitude: z.number().min(-90).max(90).describe("Latitude of the location"),
|
||||
longitude: z
|
||||
.number()
|
||||
.min(-180)
|
||||
.max(180)
|
||||
.describe("Longitude of the location"),
|
||||
},
|
||||
},
|
||||
async ({ latitude, longitude }) => {
|
||||
// Get grid point data
|
||||
|
|
|
|||
Loading…
Reference in a new issue