fastmcp 1.22.2 → 1.22.3
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/README.md +55 -0
- package/jsr.json +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -378,6 +378,61 @@ server.addTool({
|
|
|
378
378
|
});
|
|
379
379
|
```
|
|
380
380
|
|
|
381
|
+
#### Return combination type
|
|
382
|
+
|
|
383
|
+
You can combine various types in this way and send them back to AI
|
|
384
|
+
|
|
385
|
+
```js
|
|
386
|
+
server.addTool({
|
|
387
|
+
name: "download",
|
|
388
|
+
description: "Download a file",
|
|
389
|
+
parameters: z.object({
|
|
390
|
+
url: z.string(),
|
|
391
|
+
}),
|
|
392
|
+
execute: async (args) => {
|
|
393
|
+
return {
|
|
394
|
+
content: [
|
|
395
|
+
{
|
|
396
|
+
type: "text",
|
|
397
|
+
text: "Hello, world!",
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
type: "image",
|
|
401
|
+
data: "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=",
|
|
402
|
+
mimeType: "image/png",
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
type: "audio",
|
|
406
|
+
data: "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=",
|
|
407
|
+
mimeType: "audio/mpeg",
|
|
408
|
+
},
|
|
409
|
+
],
|
|
410
|
+
};
|
|
411
|
+
},
|
|
412
|
+
|
|
413
|
+
// or...
|
|
414
|
+
// execute: async (args) => {
|
|
415
|
+
// const imgContent = imageContent({
|
|
416
|
+
// url: "https://example.com/image.png",
|
|
417
|
+
// });
|
|
418
|
+
// const audContent = audioContent({
|
|
419
|
+
// url: "https://example.com/audio.mp3",
|
|
420
|
+
// });
|
|
421
|
+
// return {
|
|
422
|
+
// content: [
|
|
423
|
+
// {
|
|
424
|
+
// type: "text",
|
|
425
|
+
// text: "Hello, world!",
|
|
426
|
+
// },
|
|
427
|
+
// imgContent,
|
|
428
|
+
// audContent,
|
|
429
|
+
// ],
|
|
430
|
+
// };
|
|
431
|
+
// },
|
|
432
|
+
});
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
|
|
381
436
|
#### Logging
|
|
382
437
|
|
|
383
438
|
Tools can log messages to the client using the `log` object in the context object:
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fastmcp",
|
|
3
|
-
"version": "1.22.
|
|
3
|
+
"version": "1.22.3",
|
|
4
4
|
"main": "dist/FastMCP.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsup",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"module": "dist/FastMCP.js",
|
|
22
22
|
"types": "dist/FastMCP.d.ts",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@modelcontextprotocol/sdk": "^1.10.
|
|
24
|
+
"@modelcontextprotocol/sdk": "^1.10.2",
|
|
25
25
|
"@standard-schema/spec": "^1.0.0",
|
|
26
26
|
"execa": "^9.5.2",
|
|
27
27
|
"file-type": "^20.4.1",
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
"@types/yargs": "^17.0.33",
|
|
60
60
|
"@valibot/to-json-schema": "^1.0.0",
|
|
61
61
|
"arktype": "^2.1.20",
|
|
62
|
-
"eslint": "^9.25.
|
|
63
|
-
"eslint-plugin-perfectionist": "^4.
|
|
62
|
+
"eslint": "^9.25.1",
|
|
63
|
+
"eslint-plugin-perfectionist": "^4.12.0",
|
|
64
64
|
"eventsource-client": "^1.1.3",
|
|
65
65
|
"get-port-please": "^3.1.2",
|
|
66
66
|
"jsr": "^0.13.4",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"tsup": "^8.4.0",
|
|
70
70
|
"typescript": "^5.8.3",
|
|
71
71
|
"valibot": "^1.0.0",
|
|
72
|
-
"vitest": "^3.1.
|
|
72
|
+
"vitest": "^3.1.2"
|
|
73
73
|
},
|
|
74
74
|
"tsup": {
|
|
75
75
|
"entry": [
|