fastmcp 2.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/jsr.json +1 -1
- package/package.json +2 -2
- package/src/FastMCP.test.ts +47 -0
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fastmcp",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"main": "dist/FastMCP.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsup",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"strict-event-emitter-types": "^2.0.0",
|
|
32
32
|
"undici": "^7.8.0",
|
|
33
33
|
"uri-templates": "^0.2.0",
|
|
34
|
-
"xsschema": "0.
|
|
34
|
+
"xsschema": "0.3.0-beta.1",
|
|
35
35
|
"yargs": "^17.7.2",
|
|
36
36
|
"zod": "^3.25.12",
|
|
37
37
|
"zod-to-json-schema": "^3.24.5"
|
package/src/FastMCP.test.ts
CHANGED
|
@@ -16,6 +16,7 @@ import { setTimeout as delay } from "timers/promises";
|
|
|
16
16
|
import { fetch } from "undici";
|
|
17
17
|
import { expect, test, vi } from "vitest";
|
|
18
18
|
import { z } from "zod";
|
|
19
|
+
import { z as z4 } from "zod/v4";
|
|
19
20
|
|
|
20
21
|
import {
|
|
21
22
|
audioContent,
|
|
@@ -137,6 +138,52 @@ test("adds tools", async () => {
|
|
|
137
138
|
});
|
|
138
139
|
});
|
|
139
140
|
|
|
141
|
+
test("adds tools with Zod v4 schema", async () => {
|
|
142
|
+
await runWithTestServer({
|
|
143
|
+
run: async ({ client }) => {
|
|
144
|
+
expect(await client.listTools()).toEqual({
|
|
145
|
+
tools: [
|
|
146
|
+
{
|
|
147
|
+
description: "Add two numbers (using Zod v4 schema)",
|
|
148
|
+
inputSchema: {
|
|
149
|
+
$schema: "https://json-schema.org/draft-2020-12/schema",
|
|
150
|
+
properties: {
|
|
151
|
+
a: { type: "number" },
|
|
152
|
+
b: { type: "number" },
|
|
153
|
+
},
|
|
154
|
+
required: ["a", "b"],
|
|
155
|
+
type: "object",
|
|
156
|
+
},
|
|
157
|
+
name: "add-zod-v4",
|
|
158
|
+
},
|
|
159
|
+
],
|
|
160
|
+
});
|
|
161
|
+
},
|
|
162
|
+
server: async () => {
|
|
163
|
+
const server = new FastMCP({
|
|
164
|
+
name: "Test",
|
|
165
|
+
version: "1.0.0",
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
const AddParamsZod4 = z4.object({
|
|
169
|
+
a: z4.number(),
|
|
170
|
+
b: z4.number(),
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
server.addTool({
|
|
174
|
+
description: "Add two numbers (using Zod v4 schema)",
|
|
175
|
+
execute: async (args) => {
|
|
176
|
+
return String(args.a + args.b);
|
|
177
|
+
},
|
|
178
|
+
name: "add-zod-v4",
|
|
179
|
+
parameters: AddParamsZod4,
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
return server;
|
|
183
|
+
},
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
|
|
140
187
|
test("health endpoint returns ok", async () => {
|
|
141
188
|
const port = await getRandomPort();
|
|
142
189
|
|