@kizunajs/mcp 2.0.0-beta.16 → 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 CHANGED
@@ -152,7 +152,7 @@ const buildMcpTools = (routes) => {
152
152
  origin: "route"
153
153
  })));
154
154
  const definitions = [];
155
- for (const { routeKey, route, routeTags } of selected) {
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
- tags: routeTags
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 tags = contract?.tags?.tags;
177
- if (tags !== void 0) {
178
- const exposed = new Set(definitions.flatMap((definition) => definition.tags));
179
- const groups = Object.entries(tags).filter(([key]) => exposed.has(key)).map(([, tag]) => tag.description ? `- ${tag.title}: ${tag.description}` : `- ${tag.title}`);
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
- * contract's tags.
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
- * contract's tags. Use it for what belongs to no single route: the order
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
- tags: string[];
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
- * contract's tags. Use it for what belongs to no single route: the order
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
- tags: string[];
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, routeTags } of selected) {
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
- tags: routeTags
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 tags = contract?.tags?.tags;
176
- if (tags !== void 0) {
177
- const exposed = new Set(definitions.flatMap((definition) => definition.tags));
178
- const groups = Object.entries(tags).filter(([key]) => exposed.has(key)).map(([, tag]) => tag.description ? `- ${tag.title}: ${tag.description}` : `- ${tag.title}`);
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
- * contract's tags.
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.16",
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,13 +60,13 @@
60
60
  "@modelcontextprotocol/server": "^2.0.0"
61
61
  },
62
62
  "peerDependencies": {
63
- "kizunajs": "2.0.0-beta.16",
63
+ "kizunajs": "2.0.0-beta.17",
64
64
  "zod": "^4.0.0"
65
65
  },
66
66
  "devDependencies": {
67
67
  "@modelcontextprotocol/client": "^2.0.0",
68
- "kizunajs": "2.0.0-beta.16",
69
- "@kizunajs/express": "2.0.0-beta.16",
68
+ "kizunajs": "2.0.0-beta.17",
69
+ "@kizunajs/express": "2.0.0-beta.17",
70
70
  "@types/express": "^5.0.0",
71
71
  "express": "^5.0.0",
72
72
  "tsdown": "^0.21.0",