@haddowg/json-api-mcp 1.3.0 → 1.4.0
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 +8 -4
- package/dist/cli.mjs +1 -1
- package/dist/{generate-BcqHRSxB.mjs → generate-yf5Kc4Yh.mjs} +4 -4
- package/dist/{generate-BcqHRSxB.mjs.map → generate-yf5Kc4Yh.mjs.map} +1 -1
- package/dist/generate.mjs +1 -1
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +5 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/generate.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as buildMcpModel, n as serialiseMcpModel, r as writeMcpModel, t as generateMcpModel } from "./generate-
|
|
1
|
+
import { i as buildMcpModel, n as serialiseMcpModel, r as writeMcpModel, t as generateMcpModel } from "./generate-yf5Kc4Yh.mjs";
|
|
2
2
|
export { buildMcpModel, generateMcpModel, serialiseMcpModel, writeMcpModel };
|
package/dist/index.cjs
CHANGED
|
@@ -4,7 +4,7 @@ let _haddowg_json_api_client = require("@haddowg/json-api-client");
|
|
|
4
4
|
/** The oldest generator contract this package reads: the baseline current servers stamp. */
|
|
5
5
|
const MINIMUM_CONTRACT = 13;
|
|
6
6
|
/** The newest generator contract this package reads. */
|
|
7
|
-
const MAXIMUM_CONTRACT =
|
|
7
|
+
const MAXIMUM_CONTRACT = 19;
|
|
8
8
|
/**
|
|
9
9
|
* Throw unless the document's `info.x-generator.contract` is in the range this package reads. A
|
|
10
10
|
* document outside it would yield tools that miss or misread what the server offers, so there is
|
|
@@ -12,9 +12,9 @@ const MAXIMUM_CONTRACT = 18;
|
|
|
12
12
|
*/
|
|
13
13
|
function assertContract(doc) {
|
|
14
14
|
const contract = doc.info?.["x-generator"]?.contract;
|
|
15
|
-
if (typeof contract !== "number") throw new Error(`The OpenAPI document declares no generator contract (info.x-generator.contract). @haddowg/json-api-mcp reads contracts 13 to
|
|
16
|
-
if (contract < 13) throw new Error(`The OpenAPI document declares generator contract ${contract}, older than this package reads (13 to
|
|
17
|
-
if (contract >
|
|
15
|
+
if (typeof contract !== "number") throw new Error(`The OpenAPI document declares no generator contract (info.x-generator.contract). @haddowg/json-api-mcp reads contracts 13 to 19; regenerate the document from a newer haddowg/json-api server.`);
|
|
16
|
+
if (contract < 13) throw new Error(`The OpenAPI document declares generator contract ${contract}, older than this package reads (13 to 19). Regenerate it from a newer haddowg/json-api server.`);
|
|
17
|
+
if (contract > 19) throw new Error(`The OpenAPI document declares generator contract ${contract}, newer than this package reads (13 to 19). Upgrade @haddowg/json-api-mcp.`);
|
|
18
18
|
return contract;
|
|
19
19
|
}
|
|
20
20
|
//#endregion
|
|
@@ -658,7 +658,7 @@ function assertModel(value) {
|
|
|
658
658
|
if (!isObject(value) || value["generator"] !== "@haddowg/json-api-mcp") throw new McpModelError(`This isn't a model written by ${MODEL_GENERATOR}. Generate one with the json-api-mcp CLI.`);
|
|
659
659
|
if (typeof value["format"] !== "number" || !READABLE_FORMATS.includes(value["format"])) throw new McpModelError(`The model is format ${String(value["format"])} and this runtime reads formats ${READABLE_FORMATS.slice(0, -1).join(", ")} and 4. Regenerate it with the same version of ${MODEL_GENERATOR} the server runs.`);
|
|
660
660
|
const contract = value["contract"];
|
|
661
|
-
if (typeof contract !== "number" || contract < 13 || contract >
|
|
661
|
+
if (typeof contract !== "number" || contract < 13 || contract > 19) throw new McpModelError(`The model was built from a document with generator contract ${String(contract)}, and this runtime reads contracts 13 to 19.`);
|
|
662
662
|
if (!isObject(value["descriptor"]) || !Array.isArray(value["tools"])) throw new McpModelError("The model has no descriptor or tools; regenerate it.");
|
|
663
663
|
const credentialSchemes = value["credentialSchemes"];
|
|
664
664
|
if (value["format"] !== 1 && (!Array.isArray(credentialSchemes) || !credentialSchemes.every((s) => typeof s === "string"))) throw new McpModelError("The model has no credentialSchemes list; regenerate it.");
|
package/dist/index.d.cts
CHANGED
|
@@ -86,7 +86,7 @@ interface OpenApiDocument {
|
|
|
86
86
|
/** The oldest generator contract this package reads: the baseline current servers stamp. */
|
|
87
87
|
declare const MINIMUM_CONTRACT = 13;
|
|
88
88
|
/** The newest generator contract this package reads. */
|
|
89
|
-
declare const MAXIMUM_CONTRACT =
|
|
89
|
+
declare const MAXIMUM_CONTRACT = 19;
|
|
90
90
|
/**
|
|
91
91
|
* Throw unless the document's `info.x-generator.contract` is in the range this package reads. A
|
|
92
92
|
* document outside it would yield tools that miss or misread what the server offers, so there is
|
package/dist/index.d.mts
CHANGED
|
@@ -86,7 +86,7 @@ interface OpenApiDocument {
|
|
|
86
86
|
/** The oldest generator contract this package reads: the baseline current servers stamp. */
|
|
87
87
|
declare const MINIMUM_CONTRACT = 13;
|
|
88
88
|
/** The newest generator contract this package reads. */
|
|
89
|
-
declare const MAXIMUM_CONTRACT =
|
|
89
|
+
declare const MAXIMUM_CONTRACT = 19;
|
|
90
90
|
/**
|
|
91
91
|
* Throw unless the document's `info.x-generator.contract` is in the range this package reads. A
|
|
92
92
|
* document outside it would yield tools that miss or misread what the server offers, so there is
|
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { JsonApiError, createClient, execute, fetchTransport, isActionLocation,
|
|
|
3
3
|
/** The oldest generator contract this package reads: the baseline current servers stamp. */
|
|
4
4
|
const MINIMUM_CONTRACT = 13;
|
|
5
5
|
/** The newest generator contract this package reads. */
|
|
6
|
-
const MAXIMUM_CONTRACT =
|
|
6
|
+
const MAXIMUM_CONTRACT = 19;
|
|
7
7
|
/**
|
|
8
8
|
* Throw unless the document's `info.x-generator.contract` is in the range this package reads. A
|
|
9
9
|
* document outside it would yield tools that miss or misread what the server offers, so there is
|
|
@@ -11,9 +11,9 @@ const MAXIMUM_CONTRACT = 18;
|
|
|
11
11
|
*/
|
|
12
12
|
function assertContract(doc) {
|
|
13
13
|
const contract = doc.info?.["x-generator"]?.contract;
|
|
14
|
-
if (typeof contract !== "number") throw new Error(`The OpenAPI document declares no generator contract (info.x-generator.contract). @haddowg/json-api-mcp reads contracts 13 to
|
|
15
|
-
if (contract < 13) throw new Error(`The OpenAPI document declares generator contract ${contract}, older than this package reads (13 to
|
|
16
|
-
if (contract >
|
|
14
|
+
if (typeof contract !== "number") throw new Error(`The OpenAPI document declares no generator contract (info.x-generator.contract). @haddowg/json-api-mcp reads contracts 13 to 19; regenerate the document from a newer haddowg/json-api server.`);
|
|
15
|
+
if (contract < 13) throw new Error(`The OpenAPI document declares generator contract ${contract}, older than this package reads (13 to 19). Regenerate it from a newer haddowg/json-api server.`);
|
|
16
|
+
if (contract > 19) throw new Error(`The OpenAPI document declares generator contract ${contract}, newer than this package reads (13 to 19). Upgrade @haddowg/json-api-mcp.`);
|
|
17
17
|
return contract;
|
|
18
18
|
}
|
|
19
19
|
//#endregion
|
|
@@ -652,7 +652,7 @@ function assertModel(value) {
|
|
|
652
652
|
if (!isObject(value) || value["generator"] !== "@haddowg/json-api-mcp") throw new McpModelError(`This isn't a model written by ${MODEL_GENERATOR}. Generate one with the json-api-mcp CLI.`);
|
|
653
653
|
if (typeof value["format"] !== "number" || !READABLE_FORMATS.includes(value["format"])) throw new McpModelError(`The model is format ${String(value["format"])} and this runtime reads formats ${READABLE_FORMATS.slice(0, -1).join(", ")} and 4. Regenerate it with the same version of ${MODEL_GENERATOR} the server runs.`);
|
|
654
654
|
const contract = value["contract"];
|
|
655
|
-
if (typeof contract !== "number" || contract < 13 || contract >
|
|
655
|
+
if (typeof contract !== "number" || contract < 13 || contract > 19) throw new McpModelError(`The model was built from a document with generator contract ${String(contract)}, and this runtime reads contracts 13 to 19.`);
|
|
656
656
|
if (!isObject(value["descriptor"]) || !Array.isArray(value["tools"])) throw new McpModelError("The model has no descriptor or tools; regenerate it.");
|
|
657
657
|
const credentialSchemes = value["credentialSchemes"];
|
|
658
658
|
if (value["format"] !== 1 && (!Array.isArray(credentialSchemes) || !credentialSchemes.every((s) => typeof s === "string"))) throw new McpModelError("The model has no credentialSchemes list; regenerate it.");
|