fastmcp 4.15.1 → 4.15.2

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 _chunkMD6EC4EYcjs = require('./chunk-MD6EC4EY.cjs');
14
+ var _chunkN6ZZF5YBcjs = require('./chunk-N6ZZF5YB.cjs');
15
15
 
16
16
 
17
17
 
@@ -49,5 +49,5 @@ var _chunk5FVNY65Mcjs = require('./chunk-5FVNY65M.cjs');
49
49
 
50
50
 
51
51
 
52
- exports.AuthProvider = _chunk5FVNY65Mcjs.AuthProvider; exports.AzureProvider = _chunk5FVNY65Mcjs.AzureProvider; exports.DiscoveryDocumentCache = _chunkMD6EC4EYcjs.DiscoveryDocumentCache; exports.FastMCP = _chunkMD6EC4EYcjs.FastMCP; exports.FastMCPError = _chunkMD6EC4EYcjs.FastMCPError; exports.FastMCPSession = _chunkMD6EC4EYcjs.FastMCPSession; exports.GitHubProvider = _chunk5FVNY65Mcjs.GitHubProvider; exports.GoogleProvider = _chunk5FVNY65Mcjs.GoogleProvider; exports.MEDIA_FETCH_TIMEOUT_MS = _chunkMD6EC4EYcjs.MEDIA_FETCH_TIMEOUT_MS; exports.OAuthProvider = _chunk5FVNY65Mcjs.OAuthProvider; exports.ServerState = _chunkMD6EC4EYcjs.ServerState; exports.SessionError = _chunkMD6EC4EYcjs.SessionError; exports.UnexpectedStateError = _chunkMD6EC4EYcjs.UnexpectedStateError; exports.UserError = _chunkMD6EC4EYcjs.UserError; exports.audioContent = _chunkMD6EC4EYcjs.audioContent; exports.getAuthSession = _chunk5FVNY65Mcjs.getAuthSession; exports.imageContent = _chunkMD6EC4EYcjs.imageContent; exports.jsonSchemaAdapter = _chunkMD6EC4EYcjs.jsonSchemaAdapter; exports.requireAll = _chunk5FVNY65Mcjs.requireAll; exports.requireAny = _chunk5FVNY65Mcjs.requireAny; exports.requireAuth = _chunk5FVNY65Mcjs.requireAuth; exports.requireRole = _chunk5FVNY65Mcjs.requireRole; exports.requireScopes = _chunk5FVNY65Mcjs.requireScopes;
52
+ exports.AuthProvider = _chunk5FVNY65Mcjs.AuthProvider; exports.AzureProvider = _chunk5FVNY65Mcjs.AzureProvider; exports.DiscoveryDocumentCache = _chunkN6ZZF5YBcjs.DiscoveryDocumentCache; exports.FastMCP = _chunkN6ZZF5YBcjs.FastMCP; exports.FastMCPError = _chunkN6ZZF5YBcjs.FastMCPError; exports.FastMCPSession = _chunkN6ZZF5YBcjs.FastMCPSession; exports.GitHubProvider = _chunk5FVNY65Mcjs.GitHubProvider; exports.GoogleProvider = _chunk5FVNY65Mcjs.GoogleProvider; exports.MEDIA_FETCH_TIMEOUT_MS = _chunkN6ZZF5YBcjs.MEDIA_FETCH_TIMEOUT_MS; exports.OAuthProvider = _chunk5FVNY65Mcjs.OAuthProvider; exports.ServerState = _chunkN6ZZF5YBcjs.ServerState; exports.SessionError = _chunkN6ZZF5YBcjs.SessionError; exports.UnexpectedStateError = _chunkN6ZZF5YBcjs.UnexpectedStateError; exports.UserError = _chunkN6ZZF5YBcjs.UserError; exports.audioContent = _chunkN6ZZF5YBcjs.audioContent; exports.getAuthSession = _chunk5FVNY65Mcjs.getAuthSession; exports.imageContent = _chunkN6ZZF5YBcjs.imageContent; exports.jsonSchemaAdapter = _chunkN6ZZF5YBcjs.jsonSchemaAdapter; exports.requireAll = _chunk5FVNY65Mcjs.requireAll; exports.requireAny = _chunk5FVNY65Mcjs.requireAny; exports.requireAuth = _chunk5FVNY65Mcjs.requireAuth; exports.requireRole = _chunk5FVNY65Mcjs.requireRole; exports.requireScopes = _chunk5FVNY65Mcjs.requireScopes;
53
53
  //# sourceMappingURL=FastMCP.cjs.map
@@ -884,6 +884,14 @@ declare class FastMCPSession<T extends FastMCPSessionAuth = FastMCPSessionAuth>
884
884
  get loggingLevel(): LoggingLevel;
885
885
  get roots(): Root[];
886
886
  get server(): Server;
887
+ /**
888
+ * The HTTP session ID, or `undefined` for transports that do not have one.
889
+ *
890
+ * Resolved from the transport on every read rather than captured when the
891
+ * session connects: `StreamableHTTPServerTransport` assigns its `sessionId`
892
+ * while it handles `initialize`, which happens after `connect()` resolves.
893
+ * A value read at connect time is therefore still `undefined`.
894
+ */
887
895
  get sessionId(): string | undefined;
888
896
  set sessionId(value: string | undefined);
889
897
  constructor({ auth, icons, instructions, logger, name, onToolCall, ping, prompts, resources, resourcesTemplates, roots, sessionId, stateless, streamKeepalive, title, tools, transportType, utils, version, websiteUrl, }: {
package/dist/FastMCP.d.ts CHANGED
@@ -884,6 +884,14 @@ declare class FastMCPSession<T extends FastMCPSessionAuth = FastMCPSessionAuth>
884
884
  get loggingLevel(): LoggingLevel;
885
885
  get roots(): Root[];
886
886
  get server(): Server;
887
+ /**
888
+ * The HTTP session ID, or `undefined` for transports that do not have one.
889
+ *
890
+ * Resolved from the transport on every read rather than captured when the
891
+ * session connects: `StreamableHTTPServerTransport` assigns its `sessionId`
892
+ * while it handles `initialize`, which happens after `connect()` resolves.
893
+ * A value read at connect time is therefore still `undefined`.
894
+ */
887
895
  get sessionId(): string | undefined;
888
896
  set sessionId(value: string | undefined);
889
897
  constructor({ auth, icons, instructions, logger, name, onToolCall, ping, prompts, resources, resourcesTemplates, roots, sessionId, stateless, streamKeepalive, title, tools, transportType, utils, version, websiteUrl, }: {
package/dist/FastMCP.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  audioContent,
12
12
  imageContent,
13
13
  jsonSchemaAdapter
14
- } from "./chunk-JI5H5LIK.js";
14
+ } from "./chunk-4VIPI4GU.js";
15
15
  import {
16
16
  AuthProvider,
17
17
  AzureProvider,
@@ -464,8 +464,20 @@ var FastMCPSession = class extends FastMCPSessionEventEmitter {
464
464
  get server() {
465
465
  return this.#server;
466
466
  }
467
+ /**
468
+ * The HTTP session ID, or `undefined` for transports that do not have one.
469
+ *
470
+ * Resolved from the transport on every read rather than captured when the
471
+ * session connects: `StreamableHTTPServerTransport` assigns its `sessionId`
472
+ * while it handles `initialize`, which happens after `connect()` resolves.
473
+ * A value read at connect time is therefore still `undefined`.
474
+ */
467
475
  get sessionId() {
468
- return this.#sessionId;
476
+ if (this.#sessionId !== void 0) {
477
+ return this.#sessionId;
478
+ }
479
+ const transport = this.#server.transport;
480
+ return typeof transport?.sessionId === "string" ? transport.sessionId : void 0;
469
481
  }
470
482
  set sessionId(value) {
471
483
  this.#sessionId = value;
@@ -604,12 +616,6 @@ var FastMCPSession = class extends FastMCPSessionEventEmitter {
604
616
  this.#connectionState = "connecting";
605
617
  try {
606
618
  await this.#server.connect(transport);
607
- if ("sessionId" in transport) {
608
- const transportWithSessionId = transport;
609
- if (typeof transportWithSessionId.sessionId === "string") {
610
- this.#sessionId = transportWithSessionId.sessionId;
611
- }
612
- }
613
619
  if (!this.#stateless) {
614
620
  let attempt = 0;
615
621
  const maxAttempts = 10;
@@ -806,7 +812,7 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
806
812
  log: this.#createLog(),
807
813
  requestId: typeof meta?.requestId === "string" ? meta.requestId : void 0,
808
814
  session: this.#auth,
809
- sessionId: this.#sessionId
815
+ sessionId: this.sessionId
810
816
  };
811
817
  }
812
818
  #createLog() {
@@ -1414,7 +1420,7 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
1414
1420
  reportProgress,
1415
1421
  requestId: typeof request.params?._meta?.requestId === "string" ? request.params._meta.requestId : void 0,
1416
1422
  session: this.#auth,
1417
- sessionId: this.#sessionId,
1423
+ sessionId: this.sessionId,
1418
1424
  streamContent
1419
1425
  })
1420
1426
  );
@@ -2761,4 +2767,4 @@ export {
2761
2767
  FastMCPSession,
2762
2768
  FastMCP
2763
2769
  };
2764
- //# sourceMappingURL=chunk-JI5H5LIK.js.map
2770
+ //# sourceMappingURL=chunk-4VIPI4GU.js.map