fastmcp 4.20.9 → 4.20.11
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 +4 -3
- package/dist/FastMCP.cjs +2 -2
- package/dist/FastMCP.d.cts +8 -4
- package/dist/FastMCP.d.ts +8 -4
- package/dist/FastMCP.js +1 -1
- package/dist/{chunk-SOLSE5ML.js → chunk-JCT6AJPZ.js} +13 -13
- package/dist/chunk-JCT6AJPZ.js.map +1 -0
- package/dist/{chunk-53W7Y6E7.cjs → chunk-MA2QZQFN.cjs} +13 -13
- package/dist/chunk-MA2QZQFN.cjs.map +1 -0
- package/dist/examples/custom-routes.cjs +2 -2
- package/dist/examples/custom-routes.js +1 -1
- package/dist/openapi/index.cjs +5 -5
- package/dist/openapi/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-53W7Y6E7.cjs.map +0 -1
- package/dist/chunk-SOLSE5ML.js.map +0 -1
package/README.md
CHANGED
|
@@ -631,9 +631,10 @@ server.addTool({
|
|
|
631
631
|
});
|
|
632
632
|
```
|
|
633
633
|
|
|
634
|
-
Works for `outputSchema` too. Note that FastMCP advertises
|
|
635
|
-
|
|
636
|
-
|
|
634
|
+
Works for `outputSchema` too. Note that FastMCP advertises input schemas with
|
|
635
|
+
`additionalProperties: false`, whatever your schema said — the same treatment
|
|
636
|
+
Zod and Valibot schemas get. Output schemas keep whatever additional-properties
|
|
637
|
+
rule your schema declared.
|
|
637
638
|
|
|
638
639
|
Unlike the schema libraries above, a plain JSON Schema carries no TypeScript
|
|
639
640
|
types, so `execute` receives `unknown` arguments. Cast or narrow them yourself.
|
package/dist/FastMCP.cjs
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunkMA2QZQFNcjs = require('./chunk-MA2QZQFN.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
@@ -49,5 +49,5 @@ var _chunkBTXI2HQScjs = require('./chunk-BTXI2HQS.cjs');
|
|
|
49
49
|
|
|
50
50
|
|
|
51
51
|
|
|
52
|
-
exports.AuthProvider = _chunkBTXI2HQScjs.AuthProvider; exports.AzureProvider = _chunkBTXI2HQScjs.AzureProvider; exports.DiscoveryDocumentCache =
|
|
52
|
+
exports.AuthProvider = _chunkBTXI2HQScjs.AuthProvider; exports.AzureProvider = _chunkBTXI2HQScjs.AzureProvider; exports.DiscoveryDocumentCache = _chunkMA2QZQFNcjs.DiscoveryDocumentCache; exports.FastMCP = _chunkMA2QZQFNcjs.FastMCP; exports.FastMCPError = _chunkMA2QZQFNcjs.FastMCPError; exports.FastMCPSession = _chunkMA2QZQFNcjs.FastMCPSession; exports.GitHubProvider = _chunkBTXI2HQScjs.GitHubProvider; exports.GoogleProvider = _chunkBTXI2HQScjs.GoogleProvider; exports.MEDIA_FETCH_TIMEOUT_MS = _chunkMA2QZQFNcjs.MEDIA_FETCH_TIMEOUT_MS; exports.OAuthProvider = _chunkBTXI2HQScjs.OAuthProvider; exports.ServerState = _chunkMA2QZQFNcjs.ServerState; exports.SessionError = _chunkMA2QZQFNcjs.SessionError; exports.UnexpectedStateError = _chunkMA2QZQFNcjs.UnexpectedStateError; exports.UserError = _chunkMA2QZQFNcjs.UserError; exports.audioContent = _chunkMA2QZQFNcjs.audioContent; exports.getAuthSession = _chunkBTXI2HQScjs.getAuthSession; exports.imageContent = _chunkMA2QZQFNcjs.imageContent; exports.jsonSchemaAdapter = _chunkMA2QZQFNcjs.jsonSchemaAdapter; exports.requireAll = _chunkBTXI2HQScjs.requireAll; exports.requireAny = _chunkBTXI2HQScjs.requireAny; exports.requireAuth = _chunkBTXI2HQScjs.requireAuth; exports.requireRole = _chunkBTXI2HQScjs.requireRole; exports.requireScopes = _chunkBTXI2HQScjs.requireScopes;
|
|
53
53
|
//# sourceMappingURL=FastMCP.cjs.map
|
package/dist/FastMCP.d.cts
CHANGED
|
@@ -85,9 +85,8 @@ interface JsonSchemaStandardSchema extends StandardSchemaV1 {
|
|
|
85
85
|
* (and `ajv-formats` if you use `format` keywords) to use this. It is imported
|
|
86
86
|
* on first validation, so servers that never call this pay nothing for it.
|
|
87
87
|
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
* said.
|
|
88
|
+
* FastMCP advertises tool input objects with `additionalProperties: false`.
|
|
89
|
+
* Output schemas preserve the declared rules for additional properties.
|
|
91
90
|
*
|
|
92
91
|
* @example
|
|
93
92
|
* ```ts
|
|
@@ -916,8 +915,13 @@ declare class FastMCPSession<T extends FastMCPSessionAuth = FastMCPSessionAuth>
|
|
|
916
915
|
*/
|
|
917
916
|
get sessionId(): string | undefined;
|
|
918
917
|
set sessionId(value: string | undefined);
|
|
919
|
-
constructor({ auth, icons, instructions, logger, name, onToolCall, ping, prompts, resources, resourcesTemplates, roots, sessionId, stateless, streamKeepalive, title, tools, transportType, utils, version, websiteUrl, }: {
|
|
918
|
+
constructor({ auth, hasTools, icons, instructions, logger, name, onToolCall, ping, prompts, resources, resourcesTemplates, roots, sessionId, stateless, streamKeepalive, title, tools, transportType, utils, version, websiteUrl, }: {
|
|
920
919
|
auth?: T;
|
|
920
|
+
/**
|
|
921
|
+
* Whether the server has any tools at all, including ones this session's
|
|
922
|
+
* `canAccess` filtering removed from `tools`. Defaults to `tools.length > 0`.
|
|
923
|
+
*/
|
|
924
|
+
hasTools?: boolean;
|
|
921
925
|
icons?: Icon[];
|
|
922
926
|
instructions?: string;
|
|
923
927
|
logger: Logger;
|
package/dist/FastMCP.d.ts
CHANGED
|
@@ -85,9 +85,8 @@ interface JsonSchemaStandardSchema extends StandardSchemaV1 {
|
|
|
85
85
|
* (and `ajv-formats` if you use `format` keywords) to use this. It is imported
|
|
86
86
|
* on first validation, so servers that never call this pay nothing for it.
|
|
87
87
|
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
* said.
|
|
88
|
+
* FastMCP advertises tool input objects with `additionalProperties: false`.
|
|
89
|
+
* Output schemas preserve the declared rules for additional properties.
|
|
91
90
|
*
|
|
92
91
|
* @example
|
|
93
92
|
* ```ts
|
|
@@ -916,8 +915,13 @@ declare class FastMCPSession<T extends FastMCPSessionAuth = FastMCPSessionAuth>
|
|
|
916
915
|
*/
|
|
917
916
|
get sessionId(): string | undefined;
|
|
918
917
|
set sessionId(value: string | undefined);
|
|
919
|
-
constructor({ auth, icons, instructions, logger, name, onToolCall, ping, prompts, resources, resourcesTemplates, roots, sessionId, stateless, streamKeepalive, title, tools, transportType, utils, version, websiteUrl, }: {
|
|
918
|
+
constructor({ auth, hasTools, icons, instructions, logger, name, onToolCall, ping, prompts, resources, resourcesTemplates, roots, sessionId, stateless, streamKeepalive, title, tools, transportType, utils, version, websiteUrl, }: {
|
|
920
919
|
auth?: T;
|
|
920
|
+
/**
|
|
921
|
+
* Whether the server has any tools at all, including ones this session's
|
|
922
|
+
* `canAccess` filtering removed from `tools`. Defaults to `tools.length > 0`.
|
|
923
|
+
*/
|
|
924
|
+
hasTools?: boolean;
|
|
921
925
|
icons?: Icon[];
|
|
922
926
|
instructions?: string;
|
|
923
927
|
logger: Logger;
|
package/dist/FastMCP.js
CHANGED
|
@@ -556,9 +556,11 @@ var FastMCPSession = class extends FastMCPSessionEventEmitter {
|
|
|
556
556
|
* to interested clients only.
|
|
557
557
|
*/
|
|
558
558
|
#subscriptions = /* @__PURE__ */ new Set();
|
|
559
|
+
#transportType;
|
|
559
560
|
#utils;
|
|
560
561
|
constructor({
|
|
561
562
|
auth,
|
|
563
|
+
hasTools,
|
|
562
564
|
icons,
|
|
563
565
|
instructions,
|
|
564
566
|
logger,
|
|
@@ -588,8 +590,10 @@ var FastMCPSession = class extends FastMCPSessionEventEmitter {
|
|
|
588
590
|
this.#sessionId = sessionId;
|
|
589
591
|
this.#stateless = stateless;
|
|
590
592
|
this.#streamKeepaliveConfig = streamKeepalive;
|
|
593
|
+
this.#transportType = transportType;
|
|
591
594
|
this.#needsEventLoopFlush = transportType === "httpStream";
|
|
592
|
-
|
|
595
|
+
const supportsTools = hasTools ?? tools.length > 0;
|
|
596
|
+
if (supportsTools) {
|
|
593
597
|
this.#capabilities.tools = {};
|
|
594
598
|
}
|
|
595
599
|
if (resources.length || resourcesTemplates.length) {
|
|
@@ -618,7 +622,7 @@ var FastMCPSession = class extends FastMCPSessionEventEmitter {
|
|
|
618
622
|
this.setupLoggingHandlers();
|
|
619
623
|
this.setupRootsHandlers();
|
|
620
624
|
this.setupCompleteHandlers();
|
|
621
|
-
if (
|
|
625
|
+
if (supportsTools) {
|
|
622
626
|
this.setupToolHandlers(tools);
|
|
623
627
|
}
|
|
624
628
|
if (resources.length || resourcesTemplates.length) {
|
|
@@ -692,7 +696,7 @@ ${e instanceof Error ? e.stack : JSON.stringify(e)}`
|
|
|
692
696
|
}
|
|
693
697
|
}
|
|
694
698
|
if (this.#clientCapabilities) {
|
|
695
|
-
const pingConfig = this.#getPingConfig(
|
|
699
|
+
const pingConfig = this.#getPingConfig();
|
|
696
700
|
if (pingConfig.enabled) {
|
|
697
701
|
this.#pingInterval = setInterval(async () => {
|
|
698
702
|
if (this.#pingInFlight) {
|
|
@@ -916,14 +920,9 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
916
920
|
return `${path}: ${issue.message}`;
|
|
917
921
|
}).join(", ");
|
|
918
922
|
}
|
|
919
|
-
#getPingConfig(
|
|
923
|
+
#getPingConfig() {
|
|
920
924
|
const pingConfig = this.#pingConfig || {};
|
|
921
|
-
|
|
922
|
-
if ("type" in transport) {
|
|
923
|
-
if (transport.type === "httpStream") {
|
|
924
|
-
defaultEnabled = true;
|
|
925
|
-
}
|
|
926
|
-
}
|
|
925
|
+
const defaultEnabled = this.#transportType === "httpStream";
|
|
927
926
|
return {
|
|
928
927
|
enabled: pingConfig.enabled !== void 0 ? pingConfig.enabled : defaultEnabled,
|
|
929
928
|
intervalMs: pingConfig.intervalMs || 5e3,
|
|
@@ -1386,8 +1385,8 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
1386
1385
|
},
|
|
1387
1386
|
name: tool.name,
|
|
1388
1387
|
...tool.outputSchema && {
|
|
1389
|
-
outputSchema:
|
|
1390
|
-
|
|
1388
|
+
outputSchema: await toJsonSchema(
|
|
1389
|
+
tool.outputSchema
|
|
1391
1390
|
)
|
|
1392
1391
|
},
|
|
1393
1392
|
// Pass through _meta for MCP ext-apps UI support (issue #229)
|
|
@@ -2217,6 +2216,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2217
2216
|
) : this.#tools;
|
|
2218
2217
|
return new FastMCPSession({
|
|
2219
2218
|
auth,
|
|
2219
|
+
hasTools: this.#tools.length > 0,
|
|
2220
2220
|
icons: this.#options.icons,
|
|
2221
2221
|
instructions: this.#options.instructions,
|
|
2222
2222
|
logger: this.#logger,
|
|
@@ -2927,4 +2927,4 @@ export {
|
|
|
2927
2927
|
FastMCPSession,
|
|
2928
2928
|
FastMCP
|
|
2929
2929
|
};
|
|
2930
|
-
//# sourceMappingURL=chunk-
|
|
2930
|
+
//# sourceMappingURL=chunk-JCT6AJPZ.js.map
|