Skip to content

Commit 80f4a1f

Browse files
ZhongpinWangcloud-sdk-js
andauthored
chore: Update sample code with new MCP SDK (#1303)
* Update mcp sdk and sample code tutorial usage * fix: Changes from lint --------- Co-authored-by: cloud-sdk-js <[email protected]>
1 parent c02a677 commit 80f4a1f

File tree

3 files changed

+24
-121
lines changed

3 files changed

+24
-121
lines changed

pnpm-lock.yaml

Lines changed: 15 additions & 116 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sample-code/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@
3737
"@types/express": "^5.0.5",
3838
"express": "^5.1.0",
3939
"uuid": "^13.0.0",
40-
"zod": "^3.25.76"
40+
"zod": "^4.1.13"
4141
}
4242
}

sample-code/src/tutorials/mcp/weather-mcp-server.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,22 @@
33
/* eslint-disable import/no-internal-modules */
44
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
55
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
6-
import * as z from 'zod/v3';
6+
import * as z from 'zod';
77

88
const server = new McpServer({
99
name: 'Open-Meteo Weather MCP Server',
1010
version: '1.0.0'
1111
});
1212

13-
server.tool(
13+
server.registerTool(
1414
'get_weather',
15-
'Tool to fetch weather details for a specific city',
1615
{
17-
city: z.string().describe('The name of the city to get the weather for')
16+
description: 'Tool to fetch weather details for a specific city',
17+
inputSchema: {
18+
city: z
19+
.string()
20+
.meta({ description: 'The name of the city to get the weather for' })
21+
}
1822
},
1923
async ({ city }) => {
2024
try {

0 commit comments

Comments
 (0)