@qualitas-id/mcp 1.0.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/LICENSE +21 -0
- package/README.md +262 -0
- package/dist/constants.d.ts +18 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +18 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +82 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas/common.d.ts +20 -0
- package/dist/schemas/common.d.ts.map +1 -0
- package/dist/schemas/common.js +10 -0
- package/dist/schemas/common.js.map +1 -0
- package/dist/schemas/flow.d.ts +358 -0
- package/dist/schemas/flow.d.ts.map +1 -0
- package/dist/schemas/flow.js +72 -0
- package/dist/schemas/flow.js.map +1 -0
- package/dist/schemas/project.d.ts +70 -0
- package/dist/schemas/project.d.ts.map +1 -0
- package/dist/schemas/project.js +26 -0
- package/dist/schemas/project.js.map +1 -0
- package/dist/schemas/run.d.ts +54 -0
- package/dist/schemas/run.d.ts.map +1 -0
- package/dist/schemas/run.js +20 -0
- package/dist/schemas/run.js.map +1 -0
- package/dist/schemas/variable.d.ts +91 -0
- package/dist/schemas/variable.d.ts.map +1 -0
- package/dist/schemas/variable.js +30 -0
- package/dist/schemas/variable.js.map +1 -0
- package/dist/services/api-client.d.ts +101 -0
- package/dist/services/api-client.d.ts.map +1 -0
- package/dist/services/api-client.js +184 -0
- package/dist/services/api-client.js.map +1 -0
- package/dist/services/flow-generator.d.ts +31 -0
- package/dist/services/flow-generator.d.ts.map +1 -0
- package/dist/services/flow-generator.js +638 -0
- package/dist/services/flow-generator.js.map +1 -0
- package/dist/shared-types.d.ts +579 -0
- package/dist/shared-types.d.ts.map +1 -0
- package/dist/shared-types.js +12 -0
- package/dist/shared-types.js.map +1 -0
- package/dist/tools/flows.d.ts +13 -0
- package/dist/tools/flows.d.ts.map +1 -0
- package/dist/tools/flows.js +458 -0
- package/dist/tools/flows.js.map +1 -0
- package/dist/tools/projects.d.ts +13 -0
- package/dist/tools/projects.d.ts.map +1 -0
- package/dist/tools/projects.js +381 -0
- package/dist/tools/projects.js.map +1 -0
- package/dist/tools/runs.d.ts +9 -0
- package/dist/tools/runs.d.ts.map +1 -0
- package/dist/tools/runs.js +342 -0
- package/dist/tools/runs.js.map +1 -0
- package/dist/tools/utils.d.ts +12 -0
- package/dist/tools/utils.d.ts.map +1 -0
- package/dist/tools/utils.js +144 -0
- package/dist/tools/utils.js.map +1 -0
- package/dist/tools/variables.d.ts +9 -0
- package/dist/tools/variables.d.ts.map +1 -0
- package/dist/tools/variables.js +316 -0
- package/dist/tools/variables.js.map +1 -0
- package/dist/types.d.ts +117 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/flow-layout.d.ts +34 -0
- package/dist/utils/flow-layout.d.ts.map +1 -0
- package/dist/utils/flow-layout.js +109 -0
- package/dist/utils/flow-layout.js.map +1 -0
- package/dist/utils/flow-validation.d.ts +74 -0
- package/dist/utils/flow-validation.d.ts.map +1 -0
- package/dist/utils/flow-validation.js +386 -0
- package/dist/utils/flow-validation.js.map +1 -0
- package/dist/utils/ocr.d.ts +25 -0
- package/dist/utils/ocr.d.ts.map +1 -0
- package/dist/utils/ocr.js +88 -0
- package/dist/utils/ocr.js.map +1 -0
- package/package.json +65 -0
- package/skills/qualitas.md +253 -0
|
@@ -0,0 +1,458 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flow Tools
|
|
3
|
+
*
|
|
4
|
+
* Registers all flow-related MCP tools with the server.
|
|
5
|
+
* Covers CRUD operations and the AI-powered scenario-to-flow generator.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
import { handleApiError } from "../services/api-client.js";
|
|
9
|
+
import { generateFlowFromScenario, NODE_REFERENCE } from "../services/flow-generator.js";
|
|
10
|
+
import { beautifyFlowLayout } from "../utils/flow-layout.js";
|
|
11
|
+
import { validateFlow } from "../utils/flow-validation.js";
|
|
12
|
+
import { APP_URL } from "../constants.js";
|
|
13
|
+
import { ListFlowsSchema, GetFlowSchema, CreateFlowSchema, UpdateFlowSchema, DeleteFlowSchema, GenerateFlowSchema, } from "../schemas/flow.js";
|
|
14
|
+
/**
|
|
15
|
+
* Register all flow-related tools with the MCP server.
|
|
16
|
+
*/
|
|
17
|
+
export function registerFlowTools(server, apiClient) {
|
|
18
|
+
// ===========================================
|
|
19
|
+
// 1. qualitas_list_flows
|
|
20
|
+
// ===========================================
|
|
21
|
+
server.tool("list_flows", "List all flows in a project. Returns flow IDs, names, status, and metadata. Use this to discover existing flows before getting details or running them.", ListFlowsSchema.shape, async (params) => {
|
|
22
|
+
try {
|
|
23
|
+
const response = await apiClient.listFlows(params.project_id, {
|
|
24
|
+
page: params.offset ? Math.floor(params.offset / params.limit) + 1 : 1,
|
|
25
|
+
limit: params.limit,
|
|
26
|
+
search: params.search,
|
|
27
|
+
status: params.status,
|
|
28
|
+
});
|
|
29
|
+
const flows = response.data;
|
|
30
|
+
const meta = response.meta;
|
|
31
|
+
if (params.response_format === "json") {
|
|
32
|
+
return {
|
|
33
|
+
content: [{ type: "text", text: JSON.stringify({ flows, meta }, null, 2) }],
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
// Markdown format
|
|
37
|
+
if (!flows || flows.length === 0) {
|
|
38
|
+
return {
|
|
39
|
+
content: [{ type: "text", text: "No flows found in this project." }],
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
const lines = [`# Flows (${meta?.total ?? flows.length} total)\n`];
|
|
43
|
+
for (const flow of flows) {
|
|
44
|
+
const statusIcon = flow.status === "passing" ? "PASS" :
|
|
45
|
+
flow.status === "failing" ? "FAIL" :
|
|
46
|
+
flow.status === "running" ? "RUN" : "NEW";
|
|
47
|
+
lines.push(`- **${flow.name}** [${statusIcon}]`);
|
|
48
|
+
lines.push(` - ID: \`${flow.id}\``);
|
|
49
|
+
if (flow.description)
|
|
50
|
+
lines.push(` - Description: ${flow.description}`);
|
|
51
|
+
if (flow.environment)
|
|
52
|
+
lines.push(` - Environment: ${flow.environment}`);
|
|
53
|
+
lines.push(` - Nodes: ${flow.nodes?.length ?? 0}, Edges: ${flow.edges?.length ?? 0}`);
|
|
54
|
+
lines.push(` - Updated: ${flow.updated_at}`);
|
|
55
|
+
lines.push("");
|
|
56
|
+
}
|
|
57
|
+
if (meta && meta.total > meta.limit) {
|
|
58
|
+
lines.push(`_Showing ${flows.length} of ${meta.total} flows. Use offset to paginate._`);
|
|
59
|
+
}
|
|
60
|
+
return { content: [{ type: "text", text: lines.join("\n") }] };
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
return {
|
|
64
|
+
content: [{ type: "text", text: handleApiError(error) }],
|
|
65
|
+
isError: true,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
// ===========================================
|
|
70
|
+
// 2. qualitas_get_flow
|
|
71
|
+
// ===========================================
|
|
72
|
+
server.tool("get_flow", "Get full details of a specific flow including its nodes, edges, and variables. Use this to inspect a flow's structure before modifying or running it.", GetFlowSchema.shape, async (params) => {
|
|
73
|
+
try {
|
|
74
|
+
const response = await apiClient.getFlow(params.project_id, params.flow_id);
|
|
75
|
+
const flow = response.data;
|
|
76
|
+
if (params.response_format === "json") {
|
|
77
|
+
return {
|
|
78
|
+
content: [{ type: "text", text: JSON.stringify(flow, null, 2) }],
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
// Markdown format
|
|
82
|
+
const lines = [
|
|
83
|
+
`# Flow: ${flow.name}`,
|
|
84
|
+
"",
|
|
85
|
+
`**ID:** \`${flow.id}\``,
|
|
86
|
+
`**Status:** ${flow.status}`,
|
|
87
|
+
`**Environment:** ${flow.environment || "dev"}`,
|
|
88
|
+
];
|
|
89
|
+
if (flow.description) {
|
|
90
|
+
lines.push(`**Description:** ${flow.description}`);
|
|
91
|
+
}
|
|
92
|
+
lines.push(`**Created:** ${flow.created_at}`);
|
|
93
|
+
lines.push(`**Updated:** ${flow.updated_at}`);
|
|
94
|
+
lines.push("");
|
|
95
|
+
// Nodes summary
|
|
96
|
+
lines.push(`## Nodes (${flow.nodes?.length ?? 0})\n`);
|
|
97
|
+
if (flow.nodes && flow.nodes.length > 0) {
|
|
98
|
+
for (const node of flow.nodes) {
|
|
99
|
+
const data = node.data || {};
|
|
100
|
+
const desc = data.description || data.label || data.selector || data.url || "";
|
|
101
|
+
lines.push(`- \`${node.id}\` **${node.type}**${desc ? ` — ${desc}` : ""}`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
lines.push("");
|
|
105
|
+
// Edges summary
|
|
106
|
+
lines.push(`## Edges (${flow.edges?.length ?? 0})\n`);
|
|
107
|
+
if (flow.edges && flow.edges.length > 0) {
|
|
108
|
+
for (const edge of flow.edges) {
|
|
109
|
+
lines.push(`- \`${edge.source}\` → \`${edge.target}\``);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
lines.push("");
|
|
113
|
+
// Variables
|
|
114
|
+
if (flow.variables && flow.variables.length > 0) {
|
|
115
|
+
lines.push(`## Variables (${flow.variables.length})\n`);
|
|
116
|
+
for (const v of flow.variables) {
|
|
117
|
+
lines.push(`- **${v.name}**: dev=\`${v.values?.dev || ""}\` staging=\`${v.values?.staging || ""}\` prod=\`${v.values?.prod || ""}\``);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
// Deep link
|
|
121
|
+
lines.push("");
|
|
122
|
+
lines.push(`[Open in Flow Builder](${APP_URL}/projects/${params.project_id}/flows/${flow.id})`);
|
|
123
|
+
return { content: [{ type: "text", text: lines.join("\n") }] };
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
return {
|
|
127
|
+
content: [{ type: "text", text: handleApiError(error) }],
|
|
128
|
+
isError: true,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
// ===========================================
|
|
133
|
+
// 3. qualitas_create_flow
|
|
134
|
+
// ===========================================
|
|
135
|
+
server.tool("create_flow", `Create a new flow or fragment with explicit nodes, edges, and variables.
|
|
136
|
+
|
|
137
|
+
**Fragment Rules (type="fragment"):**
|
|
138
|
+
- MUST NOT have a "start" node - fragment nodes are inlined into the calling flow
|
|
139
|
+
- First node should be the actual action (navigate, fill, etc.)
|
|
140
|
+
- Use descriptive names: "Login Fragment", "Register Fragment"
|
|
141
|
+
|
|
142
|
+
**Best Practices:**
|
|
143
|
+
- Use "press" Enter instead of "click" for form submission (more reliable)
|
|
144
|
+
- Use generic selectors: "h1" instead of "h1:has-text('Sign In')"
|
|
145
|
+
- Use HTTPS URLs (HTTP redirects cause timeouts)
|
|
146
|
+
- Use waitUntil: "load" not "networkidle"
|
|
147
|
+
- Add 3s wait after API calls before assertions`, CreateFlowSchema.shape, async (params) => {
|
|
148
|
+
try {
|
|
149
|
+
// Validate flow structure before creating
|
|
150
|
+
const validation = validateFlow(params.nodes, params.edges, params.type || "flow");
|
|
151
|
+
if (!validation.isValid) {
|
|
152
|
+
return {
|
|
153
|
+
content: [
|
|
154
|
+
{
|
|
155
|
+
type: "text",
|
|
156
|
+
text: [
|
|
157
|
+
`# Validation Failed`,
|
|
158
|
+
"",
|
|
159
|
+
`The flow has the following errors:`,
|
|
160
|
+
"",
|
|
161
|
+
...validation.errors.map((e) => `- ${e}`),
|
|
162
|
+
"",
|
|
163
|
+
`Please fix these issues and try again.`,
|
|
164
|
+
].join("\n"),
|
|
165
|
+
},
|
|
166
|
+
],
|
|
167
|
+
isError: true,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
const response = await apiClient.createFlow(params.project_id, {
|
|
171
|
+
name: params.name,
|
|
172
|
+
description: params.description,
|
|
173
|
+
type: params.type,
|
|
174
|
+
environment: params.environment,
|
|
175
|
+
nodes: beautifyFlowLayout(params.nodes, params.edges),
|
|
176
|
+
edges: params.edges,
|
|
177
|
+
variables: params.variables,
|
|
178
|
+
});
|
|
179
|
+
const flow = response.data;
|
|
180
|
+
return {
|
|
181
|
+
content: [
|
|
182
|
+
{
|
|
183
|
+
type: "text",
|
|
184
|
+
text: [
|
|
185
|
+
`# Flow Created Successfully`,
|
|
186
|
+
"",
|
|
187
|
+
`**Name:** ${flow.name}`,
|
|
188
|
+
`**ID:** \`${flow.id}\``,
|
|
189
|
+
`**Environment:** ${flow.environment || params.environment}`,
|
|
190
|
+
`**Nodes:** ${flow.nodes?.length ?? params.nodes.length}`,
|
|
191
|
+
`**Edges:** ${flow.edges?.length ?? params.edges.length}`,
|
|
192
|
+
`**Variables:** ${flow.variables?.length ?? params.variables?.length ?? 0}`,
|
|
193
|
+
"",
|
|
194
|
+
`[Open in Flow Builder](${APP_URL}/projects/${params.project_id}/flows/${flow.id})`,
|
|
195
|
+
].join("\n"),
|
|
196
|
+
},
|
|
197
|
+
],
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
catch (error) {
|
|
201
|
+
return {
|
|
202
|
+
content: [{ type: "text", text: handleApiError(error) }],
|
|
203
|
+
isError: true,
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
// ===========================================
|
|
208
|
+
// 4. qualitas_update_flow
|
|
209
|
+
// ===========================================
|
|
210
|
+
server.tool("update_flow", "Update an existing flow. You can update the name, description, environment, nodes, edges, and variables. Only provide the fields you want to change.", UpdateFlowSchema.shape, async (params) => {
|
|
211
|
+
try {
|
|
212
|
+
const updateData = {};
|
|
213
|
+
if (params.name !== undefined)
|
|
214
|
+
updateData.name = params.name;
|
|
215
|
+
if (params.description !== undefined)
|
|
216
|
+
updateData.description = params.description;
|
|
217
|
+
if (params.environment !== undefined)
|
|
218
|
+
updateData.environment = params.environment;
|
|
219
|
+
// Validate when nodes or edges are updated
|
|
220
|
+
if (params.nodes !== undefined || params.edges !== undefined) {
|
|
221
|
+
// Fetch current flow to get full nodes/edges for validation
|
|
222
|
+
const currentFlow = await apiClient.getFlow(params.project_id, params.flow_id);
|
|
223
|
+
const nodes = (params.nodes ?? currentFlow.data.nodes ?? []);
|
|
224
|
+
const edges = (params.edges ?? currentFlow.data.edges ?? []);
|
|
225
|
+
const flowType = currentFlow.data.type || "flow";
|
|
226
|
+
// Run validation
|
|
227
|
+
const validation = validateFlow(nodes, edges, flowType);
|
|
228
|
+
if (!validation.isValid) {
|
|
229
|
+
return {
|
|
230
|
+
content: [
|
|
231
|
+
{
|
|
232
|
+
type: "text",
|
|
233
|
+
text: [
|
|
234
|
+
`# Validation Failed`,
|
|
235
|
+
"",
|
|
236
|
+
`The flow has the following errors:`,
|
|
237
|
+
"",
|
|
238
|
+
...validation.errors.map((e) => `- ${e}`),
|
|
239
|
+
"",
|
|
240
|
+
`Please fix these issues and try again.`,
|
|
241
|
+
].join("\n"),
|
|
242
|
+
},
|
|
243
|
+
],
|
|
244
|
+
isError: true,
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
// Auto-beautify layout when nodes are updated
|
|
248
|
+
updateData.nodes = beautifyFlowLayout(nodes, edges);
|
|
249
|
+
}
|
|
250
|
+
if (params.edges !== undefined)
|
|
251
|
+
updateData.edges = params.edges;
|
|
252
|
+
if (params.variables !== undefined)
|
|
253
|
+
updateData.variables = params.variables;
|
|
254
|
+
const response = await apiClient.updateFlow(params.project_id, params.flow_id, updateData);
|
|
255
|
+
const flow = response.data;
|
|
256
|
+
return {
|
|
257
|
+
content: [
|
|
258
|
+
{
|
|
259
|
+
type: "text",
|
|
260
|
+
text: [
|
|
261
|
+
`# Flow Updated Successfully`,
|
|
262
|
+
"",
|
|
263
|
+
`**Name:** ${flow.name}`,
|
|
264
|
+
`**ID:** \`${flow.id}\``,
|
|
265
|
+
`**Environment:** ${flow.environment || "dev"}`,
|
|
266
|
+
`**Nodes:** ${flow.nodes?.length ?? 0}`,
|
|
267
|
+
`**Edges:** ${flow.edges?.length ?? 0}`,
|
|
268
|
+
"",
|
|
269
|
+
`[Open in Flow Builder](${APP_URL}/projects/${params.project_id}/flows/${flow.id})`,
|
|
270
|
+
].join("\n"),
|
|
271
|
+
},
|
|
272
|
+
],
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
catch (error) {
|
|
276
|
+
return {
|
|
277
|
+
content: [{ type: "text", text: handleApiError(error) }],
|
|
278
|
+
isError: true,
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
// ===========================================
|
|
283
|
+
// 5. qualitas_delete_flow
|
|
284
|
+
// ===========================================
|
|
285
|
+
server.tool("delete_flow", "Permanently delete a flow. This action cannot be undone. All associated run history will also be removed.", DeleteFlowSchema.shape, async (params) => {
|
|
286
|
+
try {
|
|
287
|
+
await apiClient.deleteFlow(params.project_id, params.flow_id);
|
|
288
|
+
return {
|
|
289
|
+
content: [
|
|
290
|
+
{
|
|
291
|
+
type: "text",
|
|
292
|
+
text: `Flow \`${params.flow_id}\` has been permanently deleted.`,
|
|
293
|
+
},
|
|
294
|
+
],
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
catch (error) {
|
|
298
|
+
return {
|
|
299
|
+
content: [{ type: "text", text: handleApiError(error) }],
|
|
300
|
+
isError: true,
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
// ===========================================
|
|
305
|
+
// 5b. publish_flow
|
|
306
|
+
// ===========================================
|
|
307
|
+
const PublishFlowSchema = z.object({
|
|
308
|
+
project_id: z.string().uuid("Invalid project ID").describe("The project ID"),
|
|
309
|
+
flow_id: z.string().uuid("Invalid flow ID").describe("The flow or fragment ID to publish"),
|
|
310
|
+
}).strict();
|
|
311
|
+
server.tool("publish_flow", "Publish a flow or fragment to make it active. This changes the status from 'draft' to 'active'.", PublishFlowSchema.shape, async (params) => {
|
|
312
|
+
try {
|
|
313
|
+
const response = await apiClient.publishFlow(params.project_id, params.flow_id);
|
|
314
|
+
const result = response.data;
|
|
315
|
+
const flow = result.flow;
|
|
316
|
+
return {
|
|
317
|
+
content: [
|
|
318
|
+
{
|
|
319
|
+
type: "text",
|
|
320
|
+
text: [
|
|
321
|
+
`# Flow Published Successfully`,
|
|
322
|
+
"",
|
|
323
|
+
`**Name:** ${flow.name}`,
|
|
324
|
+
`**ID:** \`${flow.id}\``,
|
|
325
|
+
`**Status:** ${flow.status}`,
|
|
326
|
+
`**Type:** ${flow.type || "flow"}`,
|
|
327
|
+
`**Version Created:** ${result.createdVersion ? "Yes" : "No"}`,
|
|
328
|
+
"",
|
|
329
|
+
`[Open in Flow Builder](${APP_URL}/projects/${params.project_id}/flows/${flow.id})`,
|
|
330
|
+
].join("\n"),
|
|
331
|
+
},
|
|
332
|
+
],
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
catch (error) {
|
|
336
|
+
return {
|
|
337
|
+
content: [{ type: "text", text: handleApiError(error) }],
|
|
338
|
+
isError: true,
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
// ===========================================
|
|
343
|
+
// 6. qualitas_generate_flow_from_scenario
|
|
344
|
+
// ===========================================
|
|
345
|
+
server.tool("generate_flow_from_scenario", `Generate and create a complete test flow from a natural language scenario description.
|
|
346
|
+
|
|
347
|
+
${NODE_REFERENCE}
|
|
348
|
+
|
|
349
|
+
## Best Practices (CRITICAL)
|
|
350
|
+
|
|
351
|
+
1. **Use "press" Enter** instead of "click" for form submission (more reliable)
|
|
352
|
+
2. **Use generic selectors**: "h1" instead of "h1:has-text('Sign In')" (works across languages)
|
|
353
|
+
3. **Use HTTPS URLs**: HTTP redirects cause timeouts
|
|
354
|
+
4. **Use waitUntil: "load"** not "networkidle" (timeout on SPA pages)
|
|
355
|
+
5. **Add 3s wait** after form submission before assertions
|
|
356
|
+
6. **Use assertUrl** to verify navigation success (not assertVisible state=hidden)
|
|
357
|
+
|
|
358
|
+
## How to write a good scenario
|
|
359
|
+
|
|
360
|
+
1. **Be specific** about selectors: Use CSS selectors (\`#email\`, \`input#password\`) or generic tags (\`h1\`, \`button[type=submit]\`)
|
|
361
|
+
2. **Include URLs** when navigating: \`Navigate to https://example.com/login\`
|
|
362
|
+
3. **Use variable references** for dynamic values: \`{{flow.PASSWORD}}\`, \`{{project.BASE_URL}}\`
|
|
363
|
+
4. **Structure with steps**: Use numbered steps (1. 2. 3.), bullet points (- ), or newlines
|
|
364
|
+
5. **Be explicit about assertions**: "Verify URL changed to dashboard"
|
|
365
|
+
|
|
366
|
+
## Example scenarios
|
|
367
|
+
|
|
368
|
+
**Login:**
|
|
369
|
+
"1. Navigate to https://example.com/login 2. Fill #email with 'user@example.com' 3. Fill #password with {{flow.PASSWORD}} 4. Press Enter to submit 5. Wait 3 seconds 6. Verify URL is dashboard"
|
|
370
|
+
|
|
371
|
+
**E-commerce checkout:**
|
|
372
|
+
"1. Navigate to {{project.BASE_URL}} 2. Click 'Add to Cart' on the product 3. Click the cart icon 4. Verify cart shows '1 item' 5. Click 'Checkout' 6. Fill shipping form 7. Press Enter to submit 8. Wait 3 seconds 9. Verify URL is confirmation page"`, GenerateFlowSchema.shape, async (params) => {
|
|
373
|
+
try {
|
|
374
|
+
// Step 1: Generate the flow structure from the scenario
|
|
375
|
+
const generated = generateFlowFromScenario({
|
|
376
|
+
scenario: params.scenario,
|
|
377
|
+
name: params.name,
|
|
378
|
+
environment: params.environment,
|
|
379
|
+
});
|
|
380
|
+
// Step 2: Validate the generated flow
|
|
381
|
+
const validation = validateFlow(generated.nodes, generated.edges, "flow");
|
|
382
|
+
if (!validation.isValid) {
|
|
383
|
+
return {
|
|
384
|
+
content: [
|
|
385
|
+
{
|
|
386
|
+
type: "text",
|
|
387
|
+
text: [
|
|
388
|
+
`# Generated Flow Has Validation Errors`,
|
|
389
|
+
"",
|
|
390
|
+
`The auto-generated flow has the following issues:`,
|
|
391
|
+
"",
|
|
392
|
+
...validation.errors.map((e) => `- ${e}`),
|
|
393
|
+
"",
|
|
394
|
+
`Try rephrasing your scenario or providing more details.`,
|
|
395
|
+
].join("\n"),
|
|
396
|
+
},
|
|
397
|
+
],
|
|
398
|
+
isError: true,
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
// Step 3: Create the flow via the API (auto-beautify layout)
|
|
402
|
+
const response = await apiClient.createFlow(params.project_id, {
|
|
403
|
+
name: generated.name,
|
|
404
|
+
environment: params.environment,
|
|
405
|
+
nodes: beautifyFlowLayout(generated.nodes, generated.edges),
|
|
406
|
+
edges: generated.edges,
|
|
407
|
+
variables: generated.variables,
|
|
408
|
+
});
|
|
409
|
+
const flow = response.data;
|
|
410
|
+
// Step 3: Return the created flow info + deep-link
|
|
411
|
+
return {
|
|
412
|
+
content: [
|
|
413
|
+
{
|
|
414
|
+
type: "text",
|
|
415
|
+
text: [
|
|
416
|
+
`# Flow Generated and Created`,
|
|
417
|
+
"",
|
|
418
|
+
`**Name:** ${flow.name}`,
|
|
419
|
+
`**ID:** \`${flow.id}\``,
|
|
420
|
+
`**Environment:** ${flow.environment || params.environment}`,
|
|
421
|
+
`**Nodes:** ${generated.nodes.length}`,
|
|
422
|
+
`**Edges:** ${generated.edges.length}`,
|
|
423
|
+
`**Variables:** ${generated.variables.length}`,
|
|
424
|
+
"",
|
|
425
|
+
`## Generated Nodes`,
|
|
426
|
+
"",
|
|
427
|
+
...generated.nodes.map((node, i) => {
|
|
428
|
+
const data = node.data;
|
|
429
|
+
const details = Object.entries(data)
|
|
430
|
+
.filter(([k]) => k !== "description")
|
|
431
|
+
.map(([k, v]) => `${k}=${JSON.stringify(v)}`)
|
|
432
|
+
.join(", ");
|
|
433
|
+
return `${i + 1}. **${node.type}**${details ? ` (${details})` : ""}${data.description ? ` — ${data.description}` : ""}`;
|
|
434
|
+
}),
|
|
435
|
+
"",
|
|
436
|
+
generated.variables.length > 0
|
|
437
|
+
? [
|
|
438
|
+
`## Variables`,
|
|
439
|
+
"",
|
|
440
|
+
...generated.variables.map((v) => `- **${v.name}** (${v.scope}) — set values for dev/staging/prod`),
|
|
441
|
+
"",
|
|
442
|
+
].join("\n")
|
|
443
|
+
: "",
|
|
444
|
+
`[Open in Flow Builder](${APP_URL}/projects/${params.project_id}/flows/${flow.id})`,
|
|
445
|
+
].join("\n"),
|
|
446
|
+
},
|
|
447
|
+
],
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
catch (error) {
|
|
451
|
+
return {
|
|
452
|
+
content: [{ type: "text", text: handleApiError(error) }],
|
|
453
|
+
isError: true,
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
//# sourceMappingURL=flows.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flows.js","sourceRoot":"","sources":["../../src/tools/flows.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,wBAAwB,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACzF,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EACL,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,oBAAoB,CAAC;AAE5B;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAC/B,MAAiB,EACjB,SAA4B;IAE5B,8CAA8C;IAC9C,yBAAyB;IACzB,8CAA8C;IAC9C,MAAM,CAAC,IAAI,CACT,YAAY,EACZ,yJAAyJ,EACzJ,eAAe,CAAC,KAAK,EACrB,KAAK,EAAE,MAAM,EAAE,EAAE;QACf,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,EAAE;gBAC5D,IAAI,EAAE,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+
* - qualitas_create_project
|
|
8
|
+
* - qualitas_update_project
|
|
9
|
+
*/
|
|
10
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
11
|
+
import type { QualitasApiClient } from "../services/api-client.js";
|
|
12
|
+
export declare function registerProjectTools(server: McpServer, apiClient: QualitasApiClient): void;
|
|
13
|
+
//# sourceMappingURL=projects.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projects.d.ts","sourceRoot":"","sources":["../../src/tools/projects.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAuGnE,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,SAAS,EACjB,SAAS,EAAE,iBAAiB,GAC3B,IAAI,CAwWN"}
|