fastmcp 4.20.9 → 4.20.10

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/dist/FastMCP.cjs CHANGED
@@ -11,7 +11,7 @@
11
11
 
12
12
 
13
13
 
14
- var _chunk53W7Y6E7cjs = require('./chunk-53W7Y6E7.cjs');
14
+ var _chunk27HK2PAJcjs = require('./chunk-27HK2PAJ.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 = _chunk53W7Y6E7cjs.DiscoveryDocumentCache; exports.FastMCP = _chunk53W7Y6E7cjs.FastMCP; exports.FastMCPError = _chunk53W7Y6E7cjs.FastMCPError; exports.FastMCPSession = _chunk53W7Y6E7cjs.FastMCPSession; exports.GitHubProvider = _chunkBTXI2HQScjs.GitHubProvider; exports.GoogleProvider = _chunkBTXI2HQScjs.GoogleProvider; exports.MEDIA_FETCH_TIMEOUT_MS = _chunk53W7Y6E7cjs.MEDIA_FETCH_TIMEOUT_MS; exports.OAuthProvider = _chunkBTXI2HQScjs.OAuthProvider; exports.ServerState = _chunk53W7Y6E7cjs.ServerState; exports.SessionError = _chunk53W7Y6E7cjs.SessionError; exports.UnexpectedStateError = _chunk53W7Y6E7cjs.UnexpectedStateError; exports.UserError = _chunk53W7Y6E7cjs.UserError; exports.audioContent = _chunk53W7Y6E7cjs.audioContent; exports.getAuthSession = _chunkBTXI2HQScjs.getAuthSession; exports.imageContent = _chunk53W7Y6E7cjs.imageContent; exports.jsonSchemaAdapter = _chunk53W7Y6E7cjs.jsonSchemaAdapter; exports.requireAll = _chunkBTXI2HQScjs.requireAll; exports.requireAny = _chunkBTXI2HQScjs.requireAny; exports.requireAuth = _chunkBTXI2HQScjs.requireAuth; exports.requireRole = _chunkBTXI2HQScjs.requireRole; exports.requireScopes = _chunkBTXI2HQScjs.requireScopes;
52
+ exports.AuthProvider = _chunkBTXI2HQScjs.AuthProvider; exports.AzureProvider = _chunkBTXI2HQScjs.AzureProvider; exports.DiscoveryDocumentCache = _chunk27HK2PAJcjs.DiscoveryDocumentCache; exports.FastMCP = _chunk27HK2PAJcjs.FastMCP; exports.FastMCPError = _chunk27HK2PAJcjs.FastMCPError; exports.FastMCPSession = _chunk27HK2PAJcjs.FastMCPSession; exports.GitHubProvider = _chunkBTXI2HQScjs.GitHubProvider; exports.GoogleProvider = _chunkBTXI2HQScjs.GoogleProvider; exports.MEDIA_FETCH_TIMEOUT_MS = _chunk27HK2PAJcjs.MEDIA_FETCH_TIMEOUT_MS; exports.OAuthProvider = _chunkBTXI2HQScjs.OAuthProvider; exports.ServerState = _chunk27HK2PAJcjs.ServerState; exports.SessionError = _chunk27HK2PAJcjs.SessionError; exports.UnexpectedStateError = _chunk27HK2PAJcjs.UnexpectedStateError; exports.UserError = _chunk27HK2PAJcjs.UserError; exports.audioContent = _chunk27HK2PAJcjs.audioContent; exports.getAuthSession = _chunkBTXI2HQScjs.getAuthSession; exports.imageContent = _chunk27HK2PAJcjs.imageContent; exports.jsonSchemaAdapter = _chunk27HK2PAJcjs.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
@@ -916,8 +916,13 @@ declare class FastMCPSession<T extends FastMCPSessionAuth = FastMCPSessionAuth>
916
916
  */
917
917
  get sessionId(): string | undefined;
918
918
  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, }: {
919
+ constructor({ auth, hasTools, icons, instructions, logger, name, onToolCall, ping, prompts, resources, resourcesTemplates, roots, sessionId, stateless, streamKeepalive, title, tools, transportType, utils, version, websiteUrl, }: {
920
920
  auth?: T;
921
+ /**
922
+ * Whether the server has any tools at all, including ones this session's
923
+ * `canAccess` filtering removed from `tools`. Defaults to `tools.length > 0`.
924
+ */
925
+ hasTools?: boolean;
921
926
  icons?: Icon[];
922
927
  instructions?: string;
923
928
  logger: Logger;
package/dist/FastMCP.d.ts CHANGED
@@ -916,8 +916,13 @@ declare class FastMCPSession<T extends FastMCPSessionAuth = FastMCPSessionAuth>
916
916
  */
917
917
  get sessionId(): string | undefined;
918
918
  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, }: {
919
+ constructor({ auth, hasTools, icons, instructions, logger, name, onToolCall, ping, prompts, resources, resourcesTemplates, roots, sessionId, stateless, streamKeepalive, title, tools, transportType, utils, version, websiteUrl, }: {
920
920
  auth?: T;
921
+ /**
922
+ * Whether the server has any tools at all, including ones this session's
923
+ * `canAccess` filtering removed from `tools`. Defaults to `tools.length > 0`.
924
+ */
925
+ hasTools?: boolean;
921
926
  icons?: Icon[];
922
927
  instructions?: string;
923
928
  logger: Logger;
package/dist/FastMCP.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  audioContent,
12
12
  imageContent,
13
13
  jsonSchemaAdapter
14
- } from "./chunk-SOLSE5ML.js";
14
+ } from "./chunk-A5IEOE6F.js";
15
15
  import {
16
16
  AuthProvider,
17
17
  AzureProvider,
@@ -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
- if (tools.length) {
595
+ const supportsTools = _nullishCoalesce(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 (tools.length) {
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(transport);
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(transport) {
923
+ #getPingConfig() {
920
924
  const pingConfig = this.#pingConfig || {};
921
- let defaultEnabled = false;
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,
@@ -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 @@ var FastMCP = class extends FastMCPEventEmitter {
2927
2927
 
2928
2928
 
2929
2929
  exports.DiscoveryDocumentCache = DiscoveryDocumentCache; exports.jsonSchemaAdapter = jsonSchemaAdapter; exports.MEDIA_FETCH_TIMEOUT_MS = MEDIA_FETCH_TIMEOUT_MS; exports.imageContent = imageContent; exports.audioContent = audioContent; exports.FastMCPError = FastMCPError; exports.SessionError = SessionError; exports.UnexpectedStateError = UnexpectedStateError; exports.UserError = UserError; exports.ServerState = ServerState; exports.FastMCPSession = FastMCPSession; exports.FastMCP = FastMCP;
2930
- //# sourceMappingURL=chunk-53W7Y6E7.cjs.map
2930
+ //# sourceMappingURL=chunk-27HK2PAJ.cjs.map