fastmcp 4.28.2 → 4.28.3

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.
Files changed (43) hide show
  1. package/dist/FastMCP.cjs +4 -4
  2. package/dist/FastMCP.d.cts +2 -2
  3. package/dist/FastMCP.d.ts +2 -2
  4. package/dist/FastMCP.js +3 -3
  5. package/dist/{OAuthProvider-DvIxa9N1.d.cts → OAuthProvider-D9JYSSem.d.cts} +1 -0
  6. package/dist/{OAuthProvider-DvIxa9N1.d.ts → OAuthProvider-D9JYSSem.d.ts} +1 -0
  7. package/dist/auth/index.cjs +2 -2
  8. package/dist/auth/index.d.cts +2 -2
  9. package/dist/auth/index.d.ts +2 -2
  10. package/dist/auth/index.js +1 -1
  11. package/dist/bin/fastmcp.cjs +0 -1
  12. package/dist/bin/fastmcp.cjs.map +1 -1
  13. package/dist/bin/fastmcp.js +0 -1
  14. package/dist/bin/fastmcp.js.map +1 -1
  15. package/dist/{chunk-76OY4FEK.js → chunk-2RLFFOY2.js} +32 -15
  16. package/dist/chunk-2RLFFOY2.js.map +1 -0
  17. package/dist/{chunk-HZJE6ZGH.cjs → chunk-A2TZVOOY.cjs} +36 -19
  18. package/dist/chunk-A2TZVOOY.cjs.map +1 -0
  19. package/dist/{chunk-AM3HVK4Z.js → chunk-B2QUCZGV.js} +42 -18
  20. package/dist/chunk-B2QUCZGV.js.map +1 -0
  21. package/dist/{chunk-MBIVAKUB.js → chunk-GAPP6V64.js} +11 -5
  22. package/dist/chunk-GAPP6V64.js.map +1 -0
  23. package/dist/{chunk-2NZFMD6I.cjs → chunk-OCCYKYIM.cjs} +42 -18
  24. package/dist/chunk-OCCYKYIM.cjs.map +1 -0
  25. package/dist/{chunk-GW5MENCI.cjs → chunk-SQS3SIW7.cjs} +17 -11
  26. package/dist/chunk-SQS3SIW7.cjs.map +1 -0
  27. package/dist/edge/index.cjs +3 -3
  28. package/dist/edge/index.js +1 -1
  29. package/dist/examples/custom-routes.cjs +4 -4
  30. package/dist/examples/custom-routes.js +3 -3
  31. package/dist/openapi/index.cjs +23 -12
  32. package/dist/openapi/index.cjs.map +1 -1
  33. package/dist/openapi/index.d.cts +1 -1
  34. package/dist/openapi/index.d.ts +1 -1
  35. package/dist/openapi/index.js +17 -6
  36. package/dist/openapi/index.js.map +1 -1
  37. package/package.json +1 -1
  38. package/dist/chunk-2NZFMD6I.cjs.map +0 -1
  39. package/dist/chunk-76OY4FEK.js.map +0 -1
  40. package/dist/chunk-AM3HVK4Z.js.map +0 -1
  41. package/dist/chunk-GW5MENCI.cjs.map +0 -1
  42. package/dist/chunk-HZJE6ZGH.cjs.map +0 -1
  43. package/dist/chunk-MBIVAKUB.js.map +0 -1
@@ -4,23 +4,7 @@ function objectRootSchema(schema) {
4
4
  return schema.type === void 0 ? { ...schema, type: "object" } : schema;
5
5
  }
6
6
  function strictInputSchema(schema, nested = false) {
7
- const { $ref, additionalProperties, allOf, anyOf, oneOf, properties } = schema;
8
- if (!nested && ($ref || allOf || anyOf || oneOf)) {
9
- return objectRootSchema(schema);
10
- }
11
- const keepsAdditionalProperties = Object.keys(_nullishCoalesce(properties, () => ( {}))).length === 0 && (typeof additionalProperties === "object" || additionalProperties === true || nested && additionalProperties === void 0 && !properties);
12
- const strict = {
13
- ...schema,
14
- ...keepsAdditionalProperties ? {} : { additionalProperties: false },
15
- ...properties && {
16
- properties: Object.fromEntries(
17
- Object.entries(properties).map(([key, value]) => [
18
- key,
19
- typeof value === "object" && value.type === "object" ? strictInputSchema(value, true) : value
20
- ])
21
- )
22
- }
23
- };
7
+ const strict = strictSchemaNode(schema, nested, false);
24
8
  return nested ? strict : objectRootSchema(strict);
25
9
  }
26
10
  function zodInputSchema(schema, target) {
@@ -111,10 +95,50 @@ function zodInputSchema(schema, target) {
111
95
  }
112
96
  return closed;
113
97
  }
98
+ function isSchemaRecord(value) {
99
+ return typeof value === "object" && value !== null && !Array.isArray(value);
100
+ }
101
+ function strictSchemaNode(schema, nested, operand) {
102
+ const { $ref, additionalProperties, allOf, anyOf, oneOf, properties } = schema;
103
+ const hasConditional = "if" in schema && schema.if !== void 0;
104
+ const hasComposition = Boolean(
105
+ $ref || allOf || anyOf || oneOf || hasConditional
106
+ );
107
+ const isObjectSchema = nested ? schema.type === "object" : schema.type === void 0 || schema.type === "object";
108
+ const keepsAdditionalProperties = Object.keys(_nullishCoalesce(properties, () => ( {}))).length === 0 && (typeof additionalProperties === "object" || additionalProperties === true || nested && additionalProperties === void 0 && !properties);
109
+ const closesNode = !operand && !hasComposition && isObjectSchema && !keepsAdditionalProperties;
110
+ const next = {
111
+ ...schema,
112
+ ...closesNode ? { additionalProperties: false } : {}
113
+ };
114
+ if (properties) {
115
+ next.properties = Object.fromEntries(
116
+ Object.entries(properties).map(([key, value]) => [
117
+ key,
118
+ isSchemaRecord(value) ? strictSchemaNode(value, true, false) : value
119
+ ])
120
+ );
121
+ }
122
+ for (const keyword of ["allOf", "anyOf", "oneOf"]) {
123
+ const branches = schema[keyword];
124
+ if (Array.isArray(branches)) {
125
+ next[keyword] = branches.map(
126
+ (branch) => isSchemaRecord(branch) ? strictSchemaNode(branch, true, true) : branch
127
+ );
128
+ }
129
+ }
130
+ for (const keyword of ["else", "then"]) {
131
+ const branch = schema[keyword];
132
+ if (isSchemaRecord(branch)) {
133
+ next[keyword] = strictSchemaNode(branch, true, true);
134
+ }
135
+ }
136
+ return next;
137
+ }
114
138
 
115
139
 
116
140
 
117
141
 
118
142
 
119
143
  exports.objectRootSchema = objectRootSchema; exports.strictInputSchema = strictInputSchema; exports.zodInputSchema = zodInputSchema;
120
- //# sourceMappingURL=chunk-2NZFMD6I.cjs.map
144
+ //# sourceMappingURL=chunk-OCCYKYIM.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/fastmcp/fastmcp/dist/chunk-OCCYKYIM.cjs","../src/strictInputSchema.ts"],"names":[],"mappings":"AAAA;ACEA,0BAAkB;AAUX,SAAS,gBAAA,CAAiB,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AAA;AAEN,MAAA;AACF,IAAA;AACO,IAAA;AACT,EAAA;AAEsC,EAAA;AACf,EAAA;AACI,IAAA;AACE,MAAA;AACtB,MAAA;AACL,IAAA;AACF,EAAA;AACO,EAAA;AACT;AAE6D;AACb,EAAA;AAChD;AAMc;AACsC,EAAA;AAEF,EAAA;AACzB,EAAA;AACc,IAAA;AACrC,EAAA;AAEoB,EAAA;AAIN,EAAA;AAMmB,EAAA;AAEK,EAAA;AACjC,IAAA;AAC4C,IAAA;AACjD,EAAA;AAEgB,EAAA;AACW,IAAA;AACoB,MAAA;AACzC,QAAA;AACyC,QAAA;AAC1C,MAAA;AACH,IAAA;AACF,EAAA;AAEgD,EAAA;AACc,IAAA;AAC/B,IAAA;AACF,MAAA;AACE,QAAA;AAC3B,MAAA;AACF,IAAA;AACF,EAAA;AAEiD,EAAA;AACW,IAAA;AAC9B,IAAA;AACe,MAAA;AAC3C,IAAA;AACF,EAAA;AAEO,EAAA;AACT;ADrGoD;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/fastmcp/fastmcp/dist/chunk-OCCYKYIM.cjs","sourcesContent":[null,"import type { JsonSchema } from \"xsschema\";\n\nimport { z } from \"zod\";\n\n/**\n * Gives a tool's input or output schema the `type: \"object\"` MCP requires at\n * its root, unless it states a type of its own. A union of objects converts to\n * a bare `anyOf` or `oneOf`, and the SDK client rejects a whole `tools/list`\n * that contains one, so a single such tool would hide every other. Arguments\n * and structured content are always objects, so this only rules out values a\n * tool can never be sent or return.\n */\nexport function objectRootSchema(schema: JsonSchema): JsonSchema {\n return schema.type === undefined ? { ...schema, type: \"object\" } : schema;\n}\n\n/**\n * Closes tool input objects to undeclared keys, like xsschema's\n * `strictJsonSchema`, except for objects made only of additional properties.\n * Closing one of those advertises an object that accepts nothing but `{}`,\n * while the tool's own validation still takes any key, so it keeps whatever\n * `additionalProperties` it declared — or none:\n *\n * - a dictionary, whose `additionalProperties` is a schema (`z.record()`, an\n * OpenAPI map), keeps its value schema;\n * - a free-form object, which declares `additionalProperties: true`, or, as an\n * argument, is a bare `{ type: \"object\" }` (OpenAPI's usual spelling), stays\n * open.\n *\n * A plain object that declares an empty `properties`, or a bare one at the\n * top of the input, is still closed: that is how a schema says \"no keys\" —\n * `z.object({})`, or a tool without arguments. An object with `allOf`,\n * `anyOf`, `oneOf`, `$ref`, or `if`, at the root or nested, keeps its own\n * `additionalProperties` as declared, as do the branches of a composition and\n * the `then` and `else` of a condition: `additionalProperties` only sees\n * adjacent properties, so adding it would reject keys declared by a branch,\n * reference target, or condition. The ordinary objects among their\n * `properties` are closed like any other.\n *\n * The root is given an object type (see `objectRootSchema`).\n *\n * Shared by both runtimes, so a tool's advertised input schema does not depend\n * on whether it is served by `FastMCP` or `EdgeFastMCP`.\n */\nexport function strictInputSchema(\n schema: JsonSchema,\n nested = false,\n): JsonSchema {\n const strict = strictSchemaNode(schema, nested, false);\n return nested ? strict : objectRootSchema(strict);\n}\n\n/**\n * Converts Zod 4 tool parameters by what a call may send (`io: \"input\"`), so a\n * transformed field advertises the type it parses and a defaulted one is\n * optional. Close ordinary object occurrences after conversion, but leave\n * intersection operands open to each other's keys. Child values start a new\n * closure context; explicit catchalls, including .strict(), stay as declared.\n */\nexport function zodInputSchema(\n schema: z.ZodType,\n target?: \"draft-7\",\n): JsonSchema {\n const jsonSchema = z.toJSONSchema(schema, {\n io: \"input\",\n target,\n }) as Record<string, unknown>;\n const definitionsKey = target === \"draft-7\" ? \"definitions\" : \"$defs\";\n const definitions: Record<string, unknown> = {};\n const operands = new Map<string, string>();\n\n const closeObjects = (value: unknown, operand = false): unknown => {\n if (!value || typeof value !== \"object\") return value;\n const result = { ...(value as Record<string, unknown>) };\n\n if (\n operand &&\n typeof result.$ref === \"string\" &&\n (result.$ref === \"#\" || result.$ref.startsWith(\"#/\"))\n ) {\n const reference = result.$ref;\n let name = operands.get(reference);\n if (!name) {\n const path = decodeURIComponent(reference.slice(1)).split(\"/\").slice(1);\n const referenced = path.reduce<unknown>(\n (node, key) =>\n node && typeof node === \"object\"\n ? (node as Record<string, unknown>)[\n key.replace(/~1/g, \"/\").replace(/~0/g, \"~\")\n ]\n : undefined,\n jsonSchema,\n );\n if (referenced && typeof referenced === \"object\") {\n name = `__fastmcp_operand_${operands.size}`;\n const existing = jsonSchema[definitionsKey] as object | undefined;\n while (\n Object.hasOwn(existing ?? {}, name) ||\n Object.hasOwn(definitions, name)\n )\n name += \"_\";\n // Reserve the reference before descending, including through child values.\n operands.set(reference, name);\n const copy = { ...(referenced as Record<string, unknown>) };\n delete copy.$schema;\n delete copy.$defs;\n delete copy.definitions;\n definitions[name] = closeObjects(copy, true);\n }\n }\n if (name) result.$ref = `#/${definitionsKey}/${name}`;\n }\n\n if (\n !operand &&\n result.type === \"object\" &&\n result.properties !== undefined &&\n result.additionalProperties === undefined\n ) {\n result.additionalProperties = false;\n }\n\n for (const keyword of [\"allOf\", \"anyOf\", \"oneOf\"]) {\n const branches = result[keyword];\n if (Array.isArray(branches)) {\n // A single allOf branch is Zod's draft-7 reference wrapper, not\n // an intersection. Only intersections introduce a new exemption.\n result[keyword] = branches.map((branch) =>\n closeObjects(\n branch,\n operand || (keyword === \"allOf\" && branches.length > 1),\n ),\n );\n }\n }\n\n for (const keyword of [\n \"$defs\",\n \"definitions\",\n \"patternProperties\",\n \"properties\",\n ]) {\n const children = result[keyword];\n if (children && typeof children === \"object\") {\n result[keyword] = Object.fromEntries(\n Object.entries(children).map(([key, child]) => [\n key,\n closeObjects(child),\n ]),\n );\n }\n }\n for (const keyword of [\n \"additionalItems\",\n \"additionalProperties\",\n \"items\",\n \"prefixItems\",\n \"propertyNames\",\n ]) {\n const child = result[keyword];\n if (child !== undefined) {\n result[keyword] = Array.isArray(child)\n ? child.map((item) => closeObjects(item))\n : closeObjects(child);\n }\n }\n return result;\n };\n\n const closed = closeObjects(jsonSchema) as Record<string, unknown>;\n if (operands.size > 0) {\n closed[definitionsKey] = {\n ...(closed[definitionsKey] as Record<string, unknown>),\n ...definitions,\n };\n }\n return closed as JsonSchema;\n}\n\nfunction isSchemaRecord(value: unknown): value is JsonSchema {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction strictSchemaNode(\n schema: JsonSchema,\n nested: boolean,\n operand: boolean,\n): JsonSchema {\n const { $ref, additionalProperties, allOf, anyOf, oneOf, properties } =\n schema;\n const hasConditional = \"if\" in schema && schema.if !== undefined;\n const hasComposition = Boolean(\n $ref || allOf || anyOf || oneOf || hasConditional,\n );\n const isObjectSchema = nested\n ? schema.type === \"object\"\n : schema.type === undefined || schema.type === \"object\";\n\n const keepsAdditionalProperties =\n Object.keys(properties ?? {}).length === 0 &&\n (typeof additionalProperties === \"object\" ||\n additionalProperties === true ||\n (nested && additionalProperties === undefined && !properties));\n\n const closesNode =\n !operand && !hasComposition && isObjectSchema && !keepsAdditionalProperties;\n\n const next: Record<string, unknown> = {\n ...schema,\n ...(closesNode ? { additionalProperties: false } : {}),\n };\n\n if (properties) {\n next.properties = Object.fromEntries(\n Object.entries(properties).map(([key, value]) => [\n key,\n isSchemaRecord(value) ? strictSchemaNode(value, true, false) : value,\n ]),\n );\n }\n\n for (const keyword of [\"allOf\", \"anyOf\", \"oneOf\"] as const) {\n const branches = (schema as Record<string, unknown>)[keyword];\n if (Array.isArray(branches)) {\n next[keyword] = branches.map((branch) =>\n isSchemaRecord(branch) ? strictSchemaNode(branch, true, true) : branch,\n );\n }\n }\n\n for (const keyword of [\"else\", \"then\"] as const) {\n const branch = (schema as Record<string, unknown>)[keyword];\n if (isSchemaRecord(branch)) {\n next[keyword] = strictSchemaNode(branch, true, true);\n }\n }\n\n return next as JsonSchema;\n}\n"]}
@@ -1,11 +1,11 @@
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 _chunkHZJE6ZGHcjs = require('./chunk-HZJE6ZGH.cjs');
3
+ var _chunkA2TZVOOYcjs = require('./chunk-A2TZVOOY.cjs');
4
4
 
5
5
 
6
6
 
7
7
 
8
- var _chunk2NZFMD6Icjs = require('./chunk-2NZFMD6I.cjs');
8
+ var _chunkOCCYKYIMcjs = require('./chunk-OCCYKYIM.cjs');
9
9
 
10
10
  // src/FastMCP.ts
11
11
  var _indexjs = require('@modelcontextprotocol/sdk/server/index.js');
@@ -141,7 +141,7 @@ var DiscoveryDocumentCache = class {
141
141
  throw error;
142
142
  }
143
143
  if (!res.ok) {
144
- await _chunkHZJE6ZGHcjs.cancelResponseBody.call(void 0, res);
144
+ await _chunkA2TZVOOYcjs.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 _chunkHZJE6ZGHcjs.cancelResponseBody.call(void 0, response);
261
+ await _chunkA2TZVOOYcjs.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 _chunkHZJE6ZGHcjs.cancelResponseBody.call(void 0, response);
343
+ await _chunkA2TZVOOYcjs.cancelResponseBody.call(void 0, response);
344
344
  throw new Error(
345
345
  `Server responded with status: ${response.status} - ${response.statusText}`
346
346
  );
@@ -1191,7 +1191,7 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
1191
1191
  return () => {
1192
1192
  };
1193
1193
  }
1194
- const intervalMs = config.intervalMs && config.intervalMs > 0 ? config.intervalMs : STREAM_KEEPALIVE_DEFAULT_INTERVAL_MS;
1194
+ const intervalMs = config.intervalMs && config.intervalMs >= 1 ? config.intervalMs : STREAM_KEEPALIVE_DEFAULT_INTERVAL_MS;
1195
1195
  const timer = setInterval(() => {
1196
1196
  extra.sendNotification({
1197
1197
  method: "notifications/message",
@@ -1655,8 +1655,8 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
1655
1655
  tools.map(async (tool) => {
1656
1656
  let inputSchema;
1657
1657
  try {
1658
- inputSchema = tool.parameters ? _chunk2NZFMD6Icjs.strictInputSchema.call(void 0,
1659
- tool.parameters["~standard"].vendor === "zod" && "_zod" in tool.parameters ? _chunk2NZFMD6Icjs.zodInputSchema.call(void 0, tool.parameters, "draft-7") : await _xsschema.toJsonSchema.call(void 0, tool.parameters)
1658
+ inputSchema = tool.parameters ? _chunkOCCYKYIMcjs.strictInputSchema.call(void 0,
1659
+ tool.parameters["~standard"].vendor === "zod" && "_zod" in tool.parameters ? _chunkOCCYKYIMcjs.zodInputSchema.call(void 0, tool.parameters, "draft-7") : await _xsschema.toJsonSchema.call(void 0, tool.parameters)
1660
1660
  ) : {
1661
1661
  additionalProperties: false,
1662
1662
  properties: {},
@@ -1672,7 +1672,7 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
1672
1672
  let outputSchema;
1673
1673
  if (tool.outputSchema) {
1674
1674
  try {
1675
- outputSchema = _chunk2NZFMD6Icjs.objectRootSchema.call(void 0,
1675
+ outputSchema = _chunkOCCYKYIMcjs.objectRootSchema.call(void 0,
1676
1676
  await _xsschema.toJsonSchema.call(void 0, tool.outputSchema)
1677
1677
  );
1678
1678
  } catch (error) {
@@ -1763,9 +1763,10 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
1763
1763
  }
1764
1764
  }
1765
1765
  };
1766
+ let toolSettled = false;
1766
1767
  try {
1767
1768
  const reportProgress = async (progress) => {
1768
- if (progressToken === void 0) {
1769
+ if (toolSettled || progressToken === void 0) {
1769
1770
  return;
1770
1771
  }
1771
1772
  try {
@@ -1788,6 +1789,9 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
1788
1789
  };
1789
1790
  const log = this.#createLog(sendNotification);
1790
1791
  const streamContent = async (content) => {
1792
+ if (toolSettled) {
1793
+ return;
1794
+ }
1791
1795
  const contentArray = Array.isArray(content) ? content : [content];
1792
1796
  try {
1793
1797
  await sendNotification({
@@ -1856,6 +1860,7 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
1856
1860
  executeToolPromise,
1857
1861
  aborted
1858
1862
  ]).finally(() => {
1863
+ toolSettled = true;
1859
1864
  clearTimeout(timeoutId);
1860
1865
  stopWaitingForAbort();
1861
1866
  stopStreamKeepalive();
@@ -1906,6 +1911,7 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
1906
1911
  );
1907
1912
  }
1908
1913
  } catch (error) {
1914
+ toolSettled = true;
1909
1915
  if (error instanceof UserError) {
1910
1916
  let structuredContent = error.extras;
1911
1917
  if (structuredContent && tool.outputSchema) {
@@ -3706,4 +3712,4 @@ var FastMCP = class extends FastMCPEventEmitter {
3706
3712
 
3707
3713
 
3708
3714
  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;
3709
- //# sourceMappingURL=chunk-GW5MENCI.cjs.map
3715
+ //# sourceMappingURL=chunk-SQS3SIW7.cjs.map