@kizunajs/mcp 2.0.0-beta.15 → 2.0.0-beta.17
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/dist/index.cjs +10 -7
- package/dist/index.d.cts +5 -2
- package/dist/index.d.mts +5 -2
- package/dist/index.mjs +10 -7
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -152,7 +152,7 @@ const buildMcpTools = (routes) => {
|
|
|
152
152
|
origin: "route"
|
|
153
153
|
})));
|
|
154
154
|
const definitions = [];
|
|
155
|
-
for (const { routeKey, route,
|
|
155
|
+
for (const { routeKey, route, routeGroups } of selected) {
|
|
156
156
|
const name = names.get(routeKey);
|
|
157
157
|
definitions.push({
|
|
158
158
|
name,
|
|
@@ -162,7 +162,7 @@ const buildMcpTools = (routes) => {
|
|
|
162
162
|
outputSchema: buildToolOutputSchema(route),
|
|
163
163
|
route,
|
|
164
164
|
routeKey,
|
|
165
|
-
|
|
165
|
+
groups: routeGroups
|
|
166
166
|
});
|
|
167
167
|
}
|
|
168
168
|
return definitions;
|
|
@@ -173,10 +173,13 @@ const buildMcpTools = (routes) => {
|
|
|
173
173
|
const buildInstructions = (contract, definitions, authored) => {
|
|
174
174
|
const sections = [];
|
|
175
175
|
if (definitions.length > 0) sections.push("Every tool named after an HTTP route returns `{ status, body }`. A status of 400 or more means the call failed.");
|
|
176
|
-
const
|
|
177
|
-
if (
|
|
178
|
-
const exposed = new Set(definitions.flatMap((definition) => definition.
|
|
179
|
-
const groups =
|
|
176
|
+
const declared = contract?.groups?.groups;
|
|
177
|
+
if (declared !== void 0) {
|
|
178
|
+
const exposed = new Set(definitions.flatMap((definition) => definition.groups));
|
|
179
|
+
const groups = [...declared.values()].filter((group) => exposed.has(group.path)).map((group) => {
|
|
180
|
+
const name = group.lineage.map((path) => declared.get(path).title).join(" / ");
|
|
181
|
+
return group.description ? `- ${name}: ${group.description}` : `- ${name}`;
|
|
182
|
+
});
|
|
180
183
|
if (groups.length > 0) sections.push(`Groups:\n${groups.join("\n")}`);
|
|
181
184
|
}
|
|
182
185
|
if (authored) sections.push(authored);
|
|
@@ -626,7 +629,7 @@ const McpPluginOptionsSchema = zod.z.object({
|
|
|
626
629
|
version: zod.z.string().optional(),
|
|
627
630
|
/**
|
|
628
631
|
* Guidance for the model, appended to the overview built from the
|
|
629
|
-
*
|
|
632
|
+
* API's groups.
|
|
630
633
|
*/
|
|
631
634
|
instructions: zod.z.string().optional(),
|
|
632
635
|
/**
|
package/dist/index.d.cts
CHANGED
|
@@ -108,7 +108,7 @@ interface McpServerOptions {
|
|
|
108
108
|
onlyReadOnly?: boolean;
|
|
109
109
|
/**
|
|
110
110
|
* Guidance for the model, appended to the overview built from the
|
|
111
|
-
*
|
|
111
|
+
* API's groups. Use it for what belongs to no single route: the order
|
|
112
112
|
* operations happen in, the conventions every route shares.
|
|
113
113
|
*/
|
|
114
114
|
instructions?: string;
|
|
@@ -145,7 +145,10 @@ interface McpTool {
|
|
|
145
145
|
outputSchema: z.ZodType;
|
|
146
146
|
route: RouteDefinition;
|
|
147
147
|
routeKey: string;
|
|
148
|
-
|
|
148
|
+
/**
|
|
149
|
+
* The route's groups, as dotted paths.
|
|
150
|
+
*/
|
|
151
|
+
groups: string[];
|
|
149
152
|
}
|
|
150
153
|
/**
|
|
151
154
|
* What a client puts in front of the model before it picks a tool.
|
package/dist/index.d.mts
CHANGED
|
@@ -108,7 +108,7 @@ interface McpServerOptions {
|
|
|
108
108
|
onlyReadOnly?: boolean;
|
|
109
109
|
/**
|
|
110
110
|
* Guidance for the model, appended to the overview built from the
|
|
111
|
-
*
|
|
111
|
+
* API's groups. Use it for what belongs to no single route: the order
|
|
112
112
|
* operations happen in, the conventions every route shares.
|
|
113
113
|
*/
|
|
114
114
|
instructions?: string;
|
|
@@ -145,7 +145,10 @@ interface McpTool {
|
|
|
145
145
|
outputSchema: z.ZodType;
|
|
146
146
|
route: RouteDefinition;
|
|
147
147
|
routeKey: string;
|
|
148
|
-
|
|
148
|
+
/**
|
|
149
|
+
* The route's groups, as dotted paths.
|
|
150
|
+
*/
|
|
151
|
+
groups: string[];
|
|
149
152
|
}
|
|
150
153
|
/**
|
|
151
154
|
* What a client puts in front of the model before it picks a tool.
|
package/dist/index.mjs
CHANGED
|
@@ -151,7 +151,7 @@ const buildMcpTools = (routes) => {
|
|
|
151
151
|
origin: "route"
|
|
152
152
|
})));
|
|
153
153
|
const definitions = [];
|
|
154
|
-
for (const { routeKey, route,
|
|
154
|
+
for (const { routeKey, route, routeGroups } of selected) {
|
|
155
155
|
const name = names.get(routeKey);
|
|
156
156
|
definitions.push({
|
|
157
157
|
name,
|
|
@@ -161,7 +161,7 @@ const buildMcpTools = (routes) => {
|
|
|
161
161
|
outputSchema: buildToolOutputSchema(route),
|
|
162
162
|
route,
|
|
163
163
|
routeKey,
|
|
164
|
-
|
|
164
|
+
groups: routeGroups
|
|
165
165
|
});
|
|
166
166
|
}
|
|
167
167
|
return definitions;
|
|
@@ -172,10 +172,13 @@ const buildMcpTools = (routes) => {
|
|
|
172
172
|
const buildInstructions = (contract, definitions, authored) => {
|
|
173
173
|
const sections = [];
|
|
174
174
|
if (definitions.length > 0) sections.push("Every tool named after an HTTP route returns `{ status, body }`. A status of 400 or more means the call failed.");
|
|
175
|
-
const
|
|
176
|
-
if (
|
|
177
|
-
const exposed = new Set(definitions.flatMap((definition) => definition.
|
|
178
|
-
const groups =
|
|
175
|
+
const declared = contract?.groups?.groups;
|
|
176
|
+
if (declared !== void 0) {
|
|
177
|
+
const exposed = new Set(definitions.flatMap((definition) => definition.groups));
|
|
178
|
+
const groups = [...declared.values()].filter((group) => exposed.has(group.path)).map((group) => {
|
|
179
|
+
const name = group.lineage.map((path) => declared.get(path).title).join(" / ");
|
|
180
|
+
return group.description ? `- ${name}: ${group.description}` : `- ${name}`;
|
|
181
|
+
});
|
|
179
182
|
if (groups.length > 0) sections.push(`Groups:\n${groups.join("\n")}`);
|
|
180
183
|
}
|
|
181
184
|
if (authored) sections.push(authored);
|
|
@@ -641,7 +644,7 @@ const mcpPlugin = definePlugin({
|
|
|
641
644
|
version: z.string().optional(),
|
|
642
645
|
/**
|
|
643
646
|
* Guidance for the model, appended to the overview built from the
|
|
644
|
-
*
|
|
647
|
+
* API's groups.
|
|
645
648
|
*/
|
|
646
649
|
instructions: z.string().optional(),
|
|
647
650
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kizunajs/mcp",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.17",
|
|
4
4
|
"description": "MCP endpoint for Kizuna.js, so AI assistants can call your routes",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"kizunajs",
|
|
@@ -60,18 +60,18 @@
|
|
|
60
60
|
"@modelcontextprotocol/server": "^2.0.0"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
|
-
"
|
|
64
|
-
"
|
|
63
|
+
"kizunajs": "2.0.0-beta.17",
|
|
64
|
+
"zod": "^4.0.0"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@modelcontextprotocol/client": "^2.0.0",
|
|
68
|
+
"kizunajs": "2.0.0-beta.17",
|
|
69
|
+
"@kizunajs/express": "2.0.0-beta.17",
|
|
68
70
|
"@types/express": "^5.0.0",
|
|
69
71
|
"express": "^5.0.0",
|
|
70
72
|
"tsdown": "^0.21.0",
|
|
71
73
|
"typescript": "^6.0.3",
|
|
72
|
-
"zod": "^4.0.0"
|
|
73
|
-
"@kizunajs/express": "2.0.0-beta.15",
|
|
74
|
-
"kizunajs": "2.0.0-beta.15"
|
|
74
|
+
"zod": "^4.0.0"
|
|
75
75
|
},
|
|
76
76
|
"scripts": {
|
|
77
77
|
"build": "tsdown src/index.ts --format esm,cjs --dts --clean --external kizunajs --external zod --external @modelcontextprotocol/sdk",
|