fastmcp 4.28.3 → 4.28.4

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.
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkA2TZVOOYcjs = require('./chunk-A2TZVOOY.cjs');
3
+ var _chunk7IQ5QHVZcjs = require('./chunk-7IQ5QHVZ.cjs');
4
4
 
5
5
 
6
6
 
@@ -141,7 +141,7 @@ var DiscoveryDocumentCache = class {
141
141
  throw error;
142
142
  }
143
143
  if (!res.ok) {
144
- await _chunkA2TZVOOYcjs.cancelResponseBody.call(void 0, res);
144
+ await _chunk7IQ5QHVZcjs.cancelResponseBody.call(void 0, res);
145
145
  throw new Error(
146
146
  `Failed to fetch discovery document from ${url}: ${res.status} ${res.statusText}`
147
147
  );
@@ -258,7 +258,7 @@ var imageContent = async (input) => {
258
258
  signal: AbortSignal.timeout(timeoutMs)
259
259
  });
260
260
  if (!response.ok) {
261
- await _chunkA2TZVOOYcjs.cancelResponseBody.call(void 0, response);
261
+ await _chunk7IQ5QHVZcjs.cancelResponseBody.call(void 0, response);
262
262
  throw new Error(
263
263
  `Server responded with status: ${response.status} - ${response.statusText}`
264
264
  );
@@ -340,7 +340,7 @@ var audioContent = async (input) => {
340
340
  signal: AbortSignal.timeout(timeoutMs)
341
341
  });
342
342
  if (!response.ok) {
343
- await _chunkA2TZVOOYcjs.cancelResponseBody.call(void 0, response);
343
+ await _chunk7IQ5QHVZcjs.cancelResponseBody.call(void 0, response);
344
344
  throw new Error(
345
345
  `Server responded with status: ${response.status} - ${response.statusText}`
346
346
  );
@@ -1651,7 +1651,7 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
1651
1651
  tools: cachedToolsList
1652
1652
  };
1653
1653
  }
1654
- cachedToolsList = await Promise.all(
1654
+ const listedTools = await Promise.all(
1655
1655
  tools.map(async (tool) => {
1656
1656
  let inputSchema;
1657
1657
  try {
@@ -1669,6 +1669,12 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
1669
1669
  );
1670
1670
  inputSchema = { type: "object" };
1671
1671
  }
1672
+ if (inputSchema.type !== "object") {
1673
+ this.#logger.warn(
1674
+ `[FastMCP warning] Tool '${tool.name}' parameters must describe an object. Omitting the tool from tools/list.`
1675
+ );
1676
+ return void 0;
1677
+ }
1672
1678
  let outputSchema;
1673
1679
  if (tool.outputSchema) {
1674
1680
  try {
@@ -1681,18 +1687,27 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
1681
1687
  error
1682
1688
  );
1683
1689
  }
1690
+ if (outputSchema && outputSchema.type !== "object") {
1691
+ this.#logger.warn(
1692
+ `[FastMCP warning] Tool '${tool.name}' outputSchema must describe an object. Omitting the tool from tools/list.`
1693
+ );
1694
+ return void 0;
1695
+ }
1684
1696
  }
1685
1697
  return {
1686
1698
  annotations: tool.annotations,
1687
1699
  description: tool.description,
1688
1700
  inputSchema,
1689
1701
  name: tool.name,
1690
- ...outputSchema && { outputSchema },
1702
+ ...outputSchema && {
1703
+ outputSchema
1704
+ },
1691
1705
  // Pass through _meta for MCP ext-apps UI support (issue #229)
1692
1706
  ...tool._meta && { _meta: tool._meta }
1693
1707
  };
1694
1708
  })
1695
1709
  );
1710
+ cachedToolsList = listedTools.filter((tool) => tool !== void 0);
1696
1711
  return {
1697
1712
  tools: cachedToolsList
1698
1713
  };
@@ -3712,4 +3727,4 @@ var FastMCP = class extends FastMCPEventEmitter {
3712
3727
 
3713
3728
 
3714
3729
  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;
3715
- //# sourceMappingURL=chunk-SQS3SIW7.cjs.map
3730
+ //# sourceMappingURL=chunk-DPJW5QEO.cjs.map