fastmcp 4.20.13 → 4.20.15

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.
@@ -877,40 +877,16 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
877
877
  #createLog() {
878
878
  return {
879
879
  debug: (message, context) => {
880
- this.#server.sendLoggingMessage({
881
- data: {
882
- context,
883
- message
884
- },
885
- level: "debug"
886
- });
880
+ this.#sendLog("debug", message, context);
887
881
  },
888
882
  error: (message, context) => {
889
- this.#server.sendLoggingMessage({
890
- data: {
891
- context,
892
- message
893
- },
894
- level: "error"
895
- });
883
+ this.#sendLog("error", message, context);
896
884
  },
897
885
  info: (message, context) => {
898
- this.#server.sendLoggingMessage({
899
- data: {
900
- context,
901
- message
902
- },
903
- level: "info"
904
- });
886
+ this.#sendLog("info", message, context);
905
887
  },
906
888
  warn: (message, context) => {
907
- this.#server.sendLoggingMessage({
908
- data: {
909
- context,
910
- message
911
- },
912
- level: "warning"
913
- });
889
+ this.#sendLog("warning", message, context);
914
890
  }
915
891
  };
916
892
  }
@@ -929,6 +905,27 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
929
905
  logLevel: pingConfig.logLevel || "debug"
930
906
  };
931
907
  }
908
+ /**
909
+ * `sendLoggingMessage` rejects once the client has hung up, and these four
910
+ * callers are synchronous, so the rejection has nowhere to go. Swallow it the
911
+ * way every other notification sender in this class does, or a client that
912
+ * disconnects mid-tool takes the server process down with it.
913
+ */
914
+ #sendLog(level, message, context) {
915
+ this.#server.sendLoggingMessage({
916
+ data: {
917
+ context,
918
+ message
919
+ },
920
+ level
921
+ }).catch((error) => {
922
+ this.#logger.error(
923
+ `[FastMCP error] failed to send ${level} log notification.
924
+
925
+ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
926
+ );
927
+ });
928
+ }
932
929
  /**
933
930
  * Periodically writes to the response stream of an in-flight tool call, so an
934
931
  * idle-connection timeout (proxy, load balancer) does not close it while a
@@ -1411,7 +1408,7 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
1411
1408
  let args = void 0;
1412
1409
  if (tool.parameters) {
1413
1410
  const parsed = await tool.parameters["~standard"].validate(
1414
- request.params.arguments
1411
+ request.params.arguments ?? {}
1415
1412
  );
1416
1413
  if (parsed.issues) {
1417
1414
  const friendlyErrors = this.#formatSchemaIssues(parsed.issues);
@@ -2927,4 +2924,4 @@ export {
2927
2924
  FastMCPSession,
2928
2925
  FastMCP
2929
2926
  };
2930
- //# sourceMappingURL=chunk-JCT6AJPZ.js.map
2927
+ //# sourceMappingURL=chunk-ZNPHP74O.js.map