n8n-mcp 2.63.2 → 2.65.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/.env.example +8 -0
- package/README.md +13 -3
- package/data/nodes.db +0 -0
- package/dist/config/n8n-api.d.ts +2 -0
- package/dist/config/n8n-api.d.ts.map +1 -1
- package/dist/config/n8n-api.js +6 -0
- package/dist/config/n8n-api.js.map +1 -1
- package/dist/mcp/handlers-n8n-manager.d.ts +3 -0
- package/dist/mcp/handlers-n8n-manager.d.ts.map +1 -1
- package/dist/mcp/handlers-n8n-manager.js +121 -0
- package/dist/mcp/handlers-n8n-manager.js.map +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +31 -0
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tool-docs/index.d.ts.map +1 -1
- package/dist/mcp/tool-docs/index.js +1 -0
- package/dist/mcp/tool-docs/index.js.map +1 -1
- package/dist/mcp/tool-docs/workflow_management/index.d.ts +1 -0
- package/dist/mcp/tool-docs/workflow_management/index.d.ts.map +1 -1
- package/dist/mcp/tool-docs/workflow_management/index.js +3 -1
- package/dist/mcp/tool-docs/workflow_management/index.js.map +1 -1
- package/dist/mcp/tool-docs/workflow_management/n8n-evaluations.d.ts +3 -0
- package/dist/mcp/tool-docs/workflow_management/n8n-evaluations.d.ts.map +1 -0
- package/dist/mcp/tool-docs/workflow_management/n8n-evaluations.js +73 -0
- package/dist/mcp/tool-docs/workflow_management/n8n-evaluations.js.map +1 -0
- package/dist/mcp/tools-documentation.d.ts.map +1 -1
- package/dist/mcp/tools-documentation.js +1 -0
- package/dist/mcp/tools-documentation.js.map +1 -1
- package/dist/mcp/tools-n8n-manager.d.ts.map +1 -1
- package/dist/mcp/tools-n8n-manager.js +43 -0
- package/dist/mcp/tools-n8n-manager.js.map +1 -1
- package/dist/services/n8n-api-client.d.ts +11 -1
- package/dist/services/n8n-api-client.d.ts.map +1 -1
- package/dist/services/n8n-api-client.js +66 -6
- package/dist/services/n8n-api-client.js.map +1 -1
- package/dist/services/n8n-version.d.ts +4 -1
- package/dist/services/n8n-version.d.ts.map +1 -1
- package/dist/services/n8n-version.js +3 -1
- package/dist/services/n8n-version.js.map +1 -1
- package/dist/types/n8n-api.d.ts +45 -0
- package/dist/types/n8n-api.d.ts.map +1 -1
- package/package.json +1 -1
package/.env.example
CHANGED
|
@@ -188,6 +188,14 @@ ENABLE_MULTI_TENANT=false
|
|
|
188
188
|
# Maximum number of API request retries (default: 3)
|
|
189
189
|
# N8N_API_MAX_RETRIES=3
|
|
190
190
|
|
|
191
|
+
# Cloudflare Access (Zero Trust) service token — set both if your n8n instance
|
|
192
|
+
# sits behind Cloudflare Access. Sent as CF-Access-Client-Id / CF-Access-Client-Secret
|
|
193
|
+
# on n8n API requests, version/health probes, and webhook executions.
|
|
194
|
+
# The token is confined to the N8N_API_URL origin: webhook calls to a different
|
|
195
|
+
# host (e.g. a split WEBHOOK_URL origin) do NOT receive it, to avoid leaking the token.
|
|
196
|
+
# N8N_CF_CLIENT_ID=
|
|
197
|
+
# N8N_CF_CLIENT_SECRET=
|
|
198
|
+
|
|
191
199
|
# =========================
|
|
192
200
|
# CACHE CONFIGURATION
|
|
193
201
|
# =========================
|
package/README.md
CHANGED
|
@@ -5,17 +5,17 @@
|
|
|
5
5
|
[](https://www.npmjs.com/package/n8n-mcp)
|
|
6
6
|
[](https://codecov.io/gh/czlonkowski/n8n-mcp)
|
|
7
7
|
[](https://github.com/czlonkowski/n8n-mcp/actions)
|
|
8
|
-
[](https://github.com/n8n-io/n8n)
|
|
9
9
|
[](https://github.com/czlonkowski/n8n-mcp/pkgs/container/n8n-mcp)
|
|
10
10
|
[](https://railway.com/deploy/n8n-mcp?referralCode=n8n-mcp)
|
|
11
11
|
|
|
12
|
-
A Model Context Protocol (MCP) server that provides AI assistants with comprehensive access to n8n node documentation, properties, and operations. Deploy in minutes to give Claude and other AI assistants deep knowledge about n8n's 2,
|
|
12
|
+
A Model Context Protocol (MCP) server that provides AI assistants with comprehensive access to n8n node documentation, properties, and operations. Deploy in minutes to give Claude and other AI assistants deep knowledge about n8n's 2,174 workflow automation nodes (826 core + 1,348 community).
|
|
13
13
|
|
|
14
14
|
## Overview
|
|
15
15
|
|
|
16
16
|
n8n-MCP serves as a bridge between n8n's workflow automation platform and AI models, enabling them to understand and work with n8n nodes effectively. It provides structured access to:
|
|
17
17
|
|
|
18
|
-
- **2,
|
|
18
|
+
- **2,174 n8n nodes** - 826 core nodes + 1,348 community nodes (1,195 verified)
|
|
19
19
|
- **Node properties** - 99% coverage with detailed schemas
|
|
20
20
|
- **Node operations** - 63.6% coverage of available actions
|
|
21
21
|
- **Documentation** - 87% coverage from official n8n docs (including AI nodes)
|
|
@@ -67,6 +67,15 @@ Want to use n8n-MCP with your n8n instance? Check out our comprehensive [n8n Dep
|
|
|
67
67
|
- Cloud deployment on Hetzner, AWS, and other providers
|
|
68
68
|
- Troubleshooting and security best practices
|
|
69
69
|
|
|
70
|
+
### Cloudflare Access Authentication
|
|
71
|
+
|
|
72
|
+
If your n8n instance sits behind Cloudflare Access (Zero Trust), provide your service token so n8n-MCP can authenticate:
|
|
73
|
+
|
|
74
|
+
- `N8N_CF_CLIENT_ID` - Cloudflare Access Client ID
|
|
75
|
+
- `N8N_CF_CLIENT_SECRET` - Cloudflare Access Client Secret
|
|
76
|
+
|
|
77
|
+
When set, these are sent as `CF-Access-Client-Id` / `CF-Access-Client-Secret` headers on n8n API requests, version/health probes, and webhook executions. The token is confined to the `N8N_API_URL` origin — webhook calls to a different host (e.g. a split `WEBHOOK_URL` origin) do not receive it, to avoid leaking the token.
|
|
78
|
+
|
|
70
79
|
## Connect your IDE
|
|
71
80
|
|
|
72
81
|
n8n-MCP works with multiple AI-powered IDEs and tools:
|
|
@@ -379,6 +388,7 @@ These tools require `N8N_API_URL` and `N8N_API_KEY` in your configuration.
|
|
|
379
388
|
#### Execution Management
|
|
380
389
|
- **`n8n_test_workflow`** - Test/trigger workflow execution (webhook, form, chat)
|
|
381
390
|
- **`n8n_executions`** - Unified execution management (list, get, delete)
|
|
391
|
+
- **`n8n_evaluations`** - Read evaluation test runs (list runs, aggregated metrics, per-case results; n8n 2.30+)
|
|
382
392
|
|
|
383
393
|
#### Data Table Management
|
|
384
394
|
- **`n8n_manage_datatable`** - Manage n8n data tables and rows (list, get, create, update, delete)
|
package/data/nodes.db
CHANGED
|
Binary file
|
package/dist/config/n8n-api.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ export declare function getN8nApiConfig(): {
|
|
|
3
3
|
apiKey: string;
|
|
4
4
|
timeout: number;
|
|
5
5
|
maxRetries: number;
|
|
6
|
+
cfClientId: string | undefined;
|
|
7
|
+
cfClientSecret: string | undefined;
|
|
6
8
|
} | null;
|
|
7
9
|
export declare function isN8nApiConfigured(): boolean;
|
|
8
10
|
export declare function getN8nApiConfigFromContext(context: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"n8n-api.d.ts","sourceRoot":"","sources":["../../src/config/n8n-api.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"n8n-api.d.ts","sourceRoot":"","sources":["../../src/config/n8n-api.ts"],"names":[],"mappings":"AAoBA,wBAAgB,eAAe;;;;;;;SA4B9B;AAGD,wBAAgB,kBAAkB,IAAI,OAAO,CAG5C;AAMD,wBAAgB,0BAA0B,CAAC,OAAO,EAAE;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,GAAG,YAAY,GAAG,IAAI,CAgBtB;AAGD,MAAM,MAAM,YAAY,GAAG,WAAW,CAAC,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC,CAAC"}
|
package/dist/config/n8n-api.js
CHANGED
|
@@ -13,6 +13,8 @@ const n8nApiConfigSchema = zod_1.z.object({
|
|
|
13
13
|
N8N_API_KEY: zod_1.z.string().min(1).optional(),
|
|
14
14
|
N8N_API_TIMEOUT: zod_1.z.coerce.number().positive().default(30000),
|
|
15
15
|
N8N_API_MAX_RETRIES: zod_1.z.coerce.number().positive().default(3),
|
|
16
|
+
N8N_CF_CLIENT_ID: zod_1.z.string().trim().optional(),
|
|
17
|
+
N8N_CF_CLIENT_SECRET: zod_1.z.string().trim().optional(),
|
|
16
18
|
});
|
|
17
19
|
let envLoaded = false;
|
|
18
20
|
function getN8nApiConfig() {
|
|
@@ -33,6 +35,8 @@ function getN8nApiConfig() {
|
|
|
33
35
|
apiKey: config.N8N_API_KEY,
|
|
34
36
|
timeout: config.N8N_API_TIMEOUT,
|
|
35
37
|
maxRetries: config.N8N_API_MAX_RETRIES,
|
|
38
|
+
cfClientId: config.N8N_CF_CLIENT_ID,
|
|
39
|
+
cfClientSecret: config.N8N_CF_CLIENT_SECRET,
|
|
36
40
|
};
|
|
37
41
|
}
|
|
38
42
|
function isN8nApiConfigured() {
|
|
@@ -48,6 +52,8 @@ function getN8nApiConfigFromContext(context) {
|
|
|
48
52
|
apiKey: context.n8nApiKey,
|
|
49
53
|
timeout: context.n8nApiTimeout ?? 30000,
|
|
50
54
|
maxRetries: context.n8nApiMaxRetries ?? 3,
|
|
55
|
+
cfClientId: undefined,
|
|
56
|
+
cfClientSecret: undefined,
|
|
51
57
|
};
|
|
52
58
|
}
|
|
53
59
|
//# sourceMappingURL=n8n-api.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"n8n-api.js","sourceRoot":"","sources":["../../src/config/n8n-api.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"n8n-api.js","sourceRoot":"","sources":["../../src/config/n8n-api.ts"],"names":[],"mappings":";;;;;AAoBA,0CA4BC;AAGD,gDAGC;AAMD,gEAqBC;AAjFD,6BAAwB;AACxB,oDAA4B;AAI5B,MAAM,kBAAkB,GAAG,OAAC,CAAC,MAAM,CAAC;IACl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EAAE,MAAM,CAAC,gBAAgB;QACnC,cAAc,EAAE,MAAM,CAAC,oBAAoB;KAC5C,CAAC;AACJ,CAAC;AAGD,SAAgB,kBAAkB;IAChC,MAAM,MAAM,GAAG,eAAe,EAAE,CAAC;IACjC,OAAO,MAAM,KAAK,IAAI,CAAC;AACzB,CAAC;AAMD,SAAgB,0BAA0B,CAAC,OAK1C;IACC,IAAI,CAAC,OAAO,CAAC,SAAS,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;QAC7C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO;QACL,OAAO,EAAE,OAAO,CAAC,SAAS;QAC1B,MAAM,EAAE,OAAO,CAAC,SAAS;QACzB,OAAO,EAAE,OAAO,CAAC,aAAa,IAAI,KAAK;QACvC,UAAU,EAAE,OAAO,CAAC,gBAAgB,IAAI,CAAC;QAIzC,UAAU,EAAE,SAAS;QACrB,cAAc,EAAE,SAAS;KAC1B,CAAC;AACJ,CAAC"}
|
|
@@ -24,6 +24,9 @@ export declare function handleTestWorkflow(args: unknown, context?: InstanceCont
|
|
|
24
24
|
export declare function handleGetExecution(args: unknown, context?: InstanceContext): Promise<McpToolResponse>;
|
|
25
25
|
export declare function handleListExecutions(args: unknown, context?: InstanceContext): Promise<McpToolResponse>;
|
|
26
26
|
export declare function handleDeleteExecution(args: unknown, context?: InstanceContext): Promise<McpToolResponse>;
|
|
27
|
+
export declare function handleListTestRuns(args: unknown, context?: InstanceContext): Promise<McpToolResponse>;
|
|
28
|
+
export declare function handleGetTestRun(args: unknown, context?: InstanceContext): Promise<McpToolResponse>;
|
|
29
|
+
export declare function handleListTestCases(args: unknown, context?: InstanceContext): Promise<McpToolResponse>;
|
|
27
30
|
export declare function handleHealthCheck(context?: InstanceContext): Promise<McpToolResponse>;
|
|
28
31
|
export declare function handleDiagnostic(request: any, context?: InstanceContext): Promise<McpToolResponse>;
|
|
29
32
|
export declare function handleWorkflowVersions(args: unknown, repository: NodeRepository, context?: InstanceContext): Promise<McpToolResponse>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handlers-n8n-manager.d.ts","sourceRoot":"","sources":["../../src/mcp/handlers-n8n-manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAI1D,OAAO,EAML,eAAe,
|
|
1
|
+
{"version":3,"file":"handlers-n8n-manager.d.ts","sourceRoot":"","sources":["../../src/mcp/handlers-n8n-manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAI1D,OAAO,EAML,eAAe,EAKhB,MAAM,kBAAkB,CAAC;AAkB1B,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAA+C,MAAM,2BAA2B,CAAC;AAOzG,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AA0NhE,wBAAgB,0BAA0B,IAAI,MAAM,CAEnD;AAMD,wBAAgB,uBAAuB,gDAEtC;AAKD,wBAAgB,kBAAkB,IAAI,IAAI,CAIzC;AAED,wBAAgB,eAAe,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,YAAY,GAAG,IAAI,CAwF9E;AA0CD,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAGlD;AAiJD,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CA8F7G;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAiC1G;AAED,wBAAsB,wBAAwB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAoDjH;AAED,wBAAsB,0BAA0B,CAAC,IAAI,EAAE,OAAO,EAAE,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AAO,CAAC,eAAe,CAAC,CAkD9G;AAED,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CA4C5G;AAmDD,wBAAsB,sBAAsB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAgB/G;AAED,wBAAsB,sBAAsB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAsC/G;AAED,wBAAsB,sBAAsB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAa/G;AAED,wBAAsB,yBAAyB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAalH;AAeD,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAwG5G"}
|
|
@@ -54,6 +54,9 @@ exports.handleTestWorkflow = handleTestWorkflow;
|
|
|
54
54
|
exports.handleGetExecution = handleGetExecution;
|
|
55
55
|
exports.handleListExecutions = handleListExecutions;
|
|
56
56
|
exports.handleDeleteExecution = handleDeleteExecution;
|
|
57
|
+
exports.handleListTestRuns = handleListTestRuns;
|
|
58
|
+
exports.handleGetTestRun = handleGetTestRun;
|
|
59
|
+
exports.handleListTestCases = handleListTestCases;
|
|
57
60
|
exports.handleHealthCheck = handleHealthCheck;
|
|
58
61
|
exports.handleDiagnostic = handleDiagnostic;
|
|
59
62
|
exports.handleWorkflowVersions = handleWorkflowVersions;
|
|
@@ -298,6 +301,22 @@ const listExecutionsSchema = zod_1.z.object({
|
|
|
298
301
|
status: optionalEmptyAware(zod_1.z.enum(['success', 'error', 'waiting'])),
|
|
299
302
|
includeData: zod_1.z.boolean().optional(),
|
|
300
303
|
});
|
|
304
|
+
const listTestRunsSchema = zod_1.z.object({
|
|
305
|
+
workflowId: zod_1.z.string(),
|
|
306
|
+
status: optionalEmptyAware(zod_1.z.enum(['new', 'running', 'completed', 'error', 'cancelled'])),
|
|
307
|
+
limit: zod_1.z.number().min(1).max(250).optional(),
|
|
308
|
+
cursor: optionalEmptyAware(zod_1.z.string()),
|
|
309
|
+
});
|
|
310
|
+
const getTestRunSchema = zod_1.z.object({
|
|
311
|
+
workflowId: zod_1.z.string(),
|
|
312
|
+
runId: zod_1.z.string(),
|
|
313
|
+
});
|
|
314
|
+
const listTestCasesSchema = zod_1.z.object({
|
|
315
|
+
workflowId: zod_1.z.string(),
|
|
316
|
+
runId: zod_1.z.string(),
|
|
317
|
+
limit: zod_1.z.number().min(1).max(250).optional(),
|
|
318
|
+
cursor: optionalEmptyAware(zod_1.z.string()),
|
|
319
|
+
});
|
|
301
320
|
const workflowVersionsSchema = zod_1.z.object({
|
|
302
321
|
mode: zod_1.z.enum(['list', 'get', 'rollback', 'delete', 'prune']),
|
|
303
322
|
workflowId: zod_1.z.string().optional(),
|
|
@@ -1383,6 +1402,108 @@ async function handleDeleteExecution(args, context) {
|
|
|
1383
1402
|
};
|
|
1384
1403
|
}
|
|
1385
1404
|
}
|
|
1405
|
+
const TEST_RUN_SCOPE_HINT = 'n8n rejected the request (403). The API key lacks testRun scopes - keys created before n8n 2.30 do not have them; re-create the API key on n8n 2.30+. Other causes: evaluations not licensed on this plan, or the key\'s owner lacks access to this workflow.';
|
|
1406
|
+
async function handleTestRunError(error, context) {
|
|
1407
|
+
if (error instanceof zod_1.z.ZodError) {
|
|
1408
|
+
return { success: false, error: 'Invalid input', details: { errors: error.errors } };
|
|
1409
|
+
}
|
|
1410
|
+
if (error instanceof n8n_errors_1.N8nApiError) {
|
|
1411
|
+
if (error.statusCode === 403) {
|
|
1412
|
+
return { success: false, error: TEST_RUN_SCOPE_HINT, code: error.code };
|
|
1413
|
+
}
|
|
1414
|
+
if (error.statusCode === 404) {
|
|
1415
|
+
const client = getN8nApiClient(context);
|
|
1416
|
+
let version = client?.getCachedVersionInfo() ?? null;
|
|
1417
|
+
if (!version && client) {
|
|
1418
|
+
version = await client.getVersion().catch(() => null);
|
|
1419
|
+
}
|
|
1420
|
+
if (version && (version.major < 2 || (version.major === 2 && version.minor < 30))) {
|
|
1421
|
+
return {
|
|
1422
|
+
success: false,
|
|
1423
|
+
error: `The evaluation API requires n8n 2.30 or later; this instance runs ${version.version}. Upgrade the instance to read test runs.`,
|
|
1424
|
+
code: error.code,
|
|
1425
|
+
};
|
|
1426
|
+
}
|
|
1427
|
+
return {
|
|
1428
|
+
success: false,
|
|
1429
|
+
error: 'Workflow or test run not found. A runId must belong to the given workflowId; check both ids.',
|
|
1430
|
+
code: error.code,
|
|
1431
|
+
};
|
|
1432
|
+
}
|
|
1433
|
+
return { success: false, error: (0, n8n_errors_1.getUserFriendlyErrorMessage)(error), code: error.code };
|
|
1434
|
+
}
|
|
1435
|
+
return { success: false, error: error instanceof Error ? error.message : 'Unknown error occurred' };
|
|
1436
|
+
}
|
|
1437
|
+
async function handleListTestRuns(args, context) {
|
|
1438
|
+
try {
|
|
1439
|
+
const client = ensureApiConfigured(context);
|
|
1440
|
+
const input = listTestRunsSchema.parse(args || {});
|
|
1441
|
+
const response = await client.listTestRuns(input.workflowId, {
|
|
1442
|
+
status: input.status,
|
|
1443
|
+
limit: input.limit,
|
|
1444
|
+
cursor: input.cursor,
|
|
1445
|
+
});
|
|
1446
|
+
const note = response.data.length === 0
|
|
1447
|
+
? (input.status
|
|
1448
|
+
? `No test runs with status '${input.status}' for this workflow.`
|
|
1449
|
+
: 'No test runs. Runs exist only for workflows with an evaluation trigger that have been executed at least once.')
|
|
1450
|
+
: response.nextCursor
|
|
1451
|
+
? 'More test runs available. Use cursor to get next page.'
|
|
1452
|
+
: undefined;
|
|
1453
|
+
return {
|
|
1454
|
+
success: true,
|
|
1455
|
+
data: {
|
|
1456
|
+
testRuns: response.data,
|
|
1457
|
+
returned: response.data.length,
|
|
1458
|
+
nextCursor: response.nextCursor,
|
|
1459
|
+
hasMore: !!response.nextCursor,
|
|
1460
|
+
...(note ? { _note: note } : {})
|
|
1461
|
+
}
|
|
1462
|
+
};
|
|
1463
|
+
}
|
|
1464
|
+
catch (error) {
|
|
1465
|
+
return handleTestRunError(error, context);
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1468
|
+
async function handleGetTestRun(args, context) {
|
|
1469
|
+
try {
|
|
1470
|
+
const client = ensureApiConfigured(context);
|
|
1471
|
+
const input = getTestRunSchema.parse(args || {});
|
|
1472
|
+
const response = await client.getTestRun(input.workflowId, input.runId);
|
|
1473
|
+
return {
|
|
1474
|
+
success: true,
|
|
1475
|
+
data: response
|
|
1476
|
+
};
|
|
1477
|
+
}
|
|
1478
|
+
catch (error) {
|
|
1479
|
+
return handleTestRunError(error, context);
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
async function handleListTestCases(args, context) {
|
|
1483
|
+
try {
|
|
1484
|
+
const client = ensureApiConfigured(context);
|
|
1485
|
+
const input = listTestCasesSchema.parse(args || {});
|
|
1486
|
+
const response = await client.listTestCases(input.workflowId, input.runId, {
|
|
1487
|
+
limit: input.limit || 20,
|
|
1488
|
+
cursor: input.cursor,
|
|
1489
|
+
});
|
|
1490
|
+
return {
|
|
1491
|
+
success: true,
|
|
1492
|
+
data: {
|
|
1493
|
+
testCases: response.data,
|
|
1494
|
+
returned: response.data.length,
|
|
1495
|
+
nextCursor: response.nextCursor,
|
|
1496
|
+
hasMore: !!response.nextCursor,
|
|
1497
|
+
...(response.nextCursor ? {
|
|
1498
|
+
_note: 'More test cases available. Paginate rather than raising limit - per-case inputs/outputs can be large.'
|
|
1499
|
+
} : {})
|
|
1500
|
+
}
|
|
1501
|
+
};
|
|
1502
|
+
}
|
|
1503
|
+
catch (error) {
|
|
1504
|
+
return handleTestRunError(error, context);
|
|
1505
|
+
}
|
|
1506
|
+
}
|
|
1386
1507
|
async function handleHealthCheck(context) {
|
|
1387
1508
|
const startTime = Date.now();
|
|
1388
1509
|
try {
|