fastmcp 4.22.4 → 4.22.6
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/README.md +4 -2
- package/dist/FastMCP.cjs +3 -3
- package/dist/FastMCP.js +2 -2
- package/dist/auth/index.cjs +2 -2
- package/dist/auth/index.js +1 -1
- package/dist/{chunk-XPKMA7DH.js → chunk-ISYL7EKR.js} +5 -2
- package/dist/{chunk-XPKMA7DH.js.map → chunk-ISYL7EKR.js.map} +1 -1
- package/dist/{chunk-TFX7BV4K.js → chunk-OAM6AYJY.js} +28 -10
- package/dist/chunk-OAM6AYJY.js.map +1 -0
- package/dist/{chunk-V37MCHBL.cjs → chunk-QJIFKZYZ.cjs} +31 -13
- package/dist/chunk-QJIFKZYZ.cjs.map +1 -0
- package/dist/{chunk-YOBCXNFP.cjs → chunk-YLLBANV4.cjs} +5 -2
- package/dist/chunk-YLLBANV4.cjs.map +1 -0
- package/dist/examples/custom-routes.cjs +3 -3
- package/dist/examples/custom-routes.js +2 -2
- package/dist/openapi/index.cjs +29 -17
- package/dist/openapi/index.cjs.map +1 -1
- package/dist/openapi/index.js +15 -3
- package/dist/openapi/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-TFX7BV4K.js.map +0 -1
- package/dist/chunk-V37MCHBL.cjs.map +0 -1
- package/dist/chunk-YOBCXNFP.cjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
cancelResponseBody
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ISYL7EKR.js";
|
|
4
4
|
import {
|
|
5
5
|
strictInputSchema
|
|
6
6
|
} from "./chunk-UMDUIBFW.js";
|
|
@@ -1048,9 +1048,11 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
1048
1048
|
return parsed.value;
|
|
1049
1049
|
}
|
|
1050
1050
|
addPrompt(inputPrompt) {
|
|
1051
|
-
const completers =
|
|
1052
|
-
|
|
1053
|
-
|
|
1051
|
+
const completers = /* @__PURE__ */ Object.create(
|
|
1052
|
+
null
|
|
1053
|
+
);
|
|
1054
|
+
const enums = /* @__PURE__ */ Object.create(null);
|
|
1055
|
+
const fuseInstances = /* @__PURE__ */ Object.create(null);
|
|
1054
1056
|
for (const argument of inputPrompt.arguments ?? []) {
|
|
1055
1057
|
if (argument.complete) {
|
|
1056
1058
|
completers[argument.name] = argument.complete;
|
|
@@ -1098,7 +1100,9 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
1098
1100
|
this.#resources.set(inputResource.uri, inputResource);
|
|
1099
1101
|
}
|
|
1100
1102
|
addResourceTemplate(inputResourceTemplate) {
|
|
1101
|
-
const completers =
|
|
1103
|
+
const completers = /* @__PURE__ */ Object.create(
|
|
1104
|
+
null
|
|
1105
|
+
);
|
|
1102
1106
|
for (const argument of inputResourceTemplate.arguments ?? []) {
|
|
1103
1107
|
if (argument.complete) {
|
|
1104
1108
|
completers[argument.name] = argument.complete;
|
|
@@ -1233,7 +1237,7 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
1233
1237
|
}
|
|
1234
1238
|
const args = request.params.arguments;
|
|
1235
1239
|
for (const arg of prompt.arguments ?? []) {
|
|
1236
|
-
if (arg.required && !(args && arg.name
|
|
1240
|
+
if (arg.required && !(args && Object.hasOwn(args, arg.name))) {
|
|
1237
1241
|
throw new McpError(
|
|
1238
1242
|
ErrorCode.InvalidParams,
|
|
1239
1243
|
`Prompt '${request.params.name}' requires argument '${arg.name}': ${arg.description || "No description provided"}`
|
|
@@ -1302,7 +1306,7 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
1302
1306
|
const uriTemplate = parseURITemplate(
|
|
1303
1307
|
resourceTemplate.uriTemplate
|
|
1304
1308
|
);
|
|
1305
|
-
const match = uriTemplate
|
|
1309
|
+
const match = matchUriTemplate(uriTemplate, request.params.uri);
|
|
1306
1310
|
if (!match) {
|
|
1307
1311
|
continue;
|
|
1308
1312
|
}
|
|
@@ -1666,6 +1670,20 @@ function convertObjectToSnakeCase(obj) {
|
|
|
1666
1670
|
function joinPaths(basePath, path) {
|
|
1667
1671
|
return `${basePath}${normalizePath(path)}`;
|
|
1668
1672
|
}
|
|
1673
|
+
function matchUriTemplate(template, uri) {
|
|
1674
|
+
const match = template.fromUri(uri);
|
|
1675
|
+
if (!match) {
|
|
1676
|
+
return void 0;
|
|
1677
|
+
}
|
|
1678
|
+
const checksQuery = !/\{[?&]/.test(template.template);
|
|
1679
|
+
const checksFragment = !template.template.includes("{#");
|
|
1680
|
+
const shape = (value) => [
|
|
1681
|
+
value.split(/[?#]/, 1)[0].split("/").length,
|
|
1682
|
+
checksQuery && value.includes("?"),
|
|
1683
|
+
checksFragment && value.includes("#")
|
|
1684
|
+
].join();
|
|
1685
|
+
return shape(template.fill(match)) === shape(uri) ? match : void 0;
|
|
1686
|
+
}
|
|
1669
1687
|
function normalizeBasePath(path) {
|
|
1670
1688
|
if (!path || path === "/") {
|
|
1671
1689
|
return "";
|
|
@@ -1946,7 +1964,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
1946
1964
|
}
|
|
1947
1965
|
for (const template of this.#resourcesTemplates) {
|
|
1948
1966
|
const parsedTemplate = parseURITemplate(template.uriTemplate);
|
|
1949
|
-
const params = parsedTemplate
|
|
1967
|
+
const params = matchUriTemplate(parsedTemplate, uri);
|
|
1950
1968
|
if (!params) {
|
|
1951
1969
|
continue;
|
|
1952
1970
|
}
|
|
@@ -2922,7 +2940,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2922
2940
|
overrides?.httpStream?.basePath || basePathArg || envBasePath
|
|
2923
2941
|
);
|
|
2924
2942
|
const enableJsonResponse = overrides?.httpStream?.enableJsonResponse || false;
|
|
2925
|
-
const stateless = overrides?.httpStream?.stateless
|
|
2943
|
+
const stateless = overrides?.httpStream?.stateless ?? (statelessArg !== void 0 ? statelessArg === "true" : envStateless === "true");
|
|
2926
2944
|
const cors = overrides?.httpStream?.cors;
|
|
2927
2945
|
const eventStore = overrides?.httpStream?.eventStore;
|
|
2928
2946
|
const sslCa = overrides?.httpStream?.sslCa;
|
|
@@ -3048,4 +3066,4 @@ export {
|
|
|
3048
3066
|
FastMCPSession,
|
|
3049
3067
|
FastMCP
|
|
3050
3068
|
};
|
|
3051
|
-
//# sourceMappingURL=chunk-
|
|
3069
|
+
//# sourceMappingURL=chunk-OAM6AYJY.js.map
|