@daxaur/ctrl-mcp 0.1.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.
@@ -0,0 +1,80 @@
1
+ /**
2
+ * ctrl_get_execution_logs — read recent workflow executions.
3
+ *
4
+ * Returns each fire with its trigger, status, tx hash (if onchain), gas, and
5
+ * timing. Use to confirm a workflow is firing as expected or to debug failures.
6
+ */
7
+ import { z } from 'zod';
8
+ import { ctrlFetch } from '../client.js';
9
+ const GetLogsInputSchema = z.object({
10
+ workflowId: z.string().min(1).optional(),
11
+ limit: z.number().int().min(1).max(100).default(10),
12
+ });
13
+ export const GET_EXECUTION_LOGS_TOOL = {
14
+ name: 'ctrl_get_execution_logs',
15
+ description: 'Fetch recent executions of a CTRL workflow. Each log shows the trigger that fired, the status (success/failed/pending), the BaseScan tx hash if onchain, gas used, and timing. Use to confirm the keeper is executing the workflow, debug failures, or surface results back to the user. Without workflowId, returns the user\'s most recent executions across all workflows.',
16
+ inputSchema: {
17
+ type: 'object',
18
+ properties: {
19
+ workflowId: {
20
+ type: 'string',
21
+ description: 'Filter to one workflow. Omit to see recent executions across all the user\'s workflows.',
22
+ },
23
+ limit: {
24
+ type: 'number',
25
+ description: 'Max logs to return. Default 10, max 100.',
26
+ default: 10,
27
+ },
28
+ },
29
+ },
30
+ };
31
+ export async function handleGetExecutionLogs(rawInput) {
32
+ const input = GetLogsInputSchema.parse(rawInput);
33
+ const res = await ctrlFetch('/api/mcp/execution-logs', {
34
+ query: {
35
+ workflow_id: input.workflowId,
36
+ limit: input.limit,
37
+ offset: 0,
38
+ },
39
+ });
40
+ if (res.logs.length === 0) {
41
+ return {
42
+ content: [
43
+ {
44
+ type: 'text',
45
+ text: input.workflowId
46
+ ? `No executions yet for workflow ${input.workflowId}. Either the trigger hasn\'t fired or the workflow isn\'t active yet.`
47
+ : 'No executions found.',
48
+ },
49
+ ],
50
+ structuredContent: { logs: [], count: 0 },
51
+ };
52
+ }
53
+ const summary = res.logs
54
+ .map((log) => {
55
+ const statusIcon = log.status === 'success' ? '✓' : log.status === 'failed' ? '✗' : '…';
56
+ const txInfo = log.transaction_hash
57
+ ? ` — https://basescan.org/tx/${log.transaction_hash}`
58
+ : '';
59
+ const error = log.error_message ? ` (${log.error_message})` : '';
60
+ return `${statusIcon} ${log.started_at} — ${log.trigger_type} — ${log.status}${txInfo}${error}`;
61
+ })
62
+ .join('\n');
63
+ return {
64
+ content: [
65
+ {
66
+ type: 'text',
67
+ text: [
68
+ `${res.logs.length} execution${res.logs.length === 1 ? '' : 's'}:`,
69
+ '',
70
+ summary,
71
+ ].join('\n'),
72
+ },
73
+ ],
74
+ structuredContent: {
75
+ logs: res.logs,
76
+ count: res.logs.length,
77
+ },
78
+ };
79
+ }
80
+ //# sourceMappingURL=get-execution-logs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-execution-logs.js","sourceRoot":"","sources":["../../src/tools/get-execution-logs.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACxC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;CACpD,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,IAAI,EAAE,yBAAyB;IAC/B,WAAW,EACT,+WAA+W;IACjX,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,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G,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC,EAAE,CAAA;QAChE,OAAO,GAAG,UAAU,IAAI,GAAG,CAAC,UAAU,MAAM,GAAG,CAAC,YAAY,MAAM,GAAG,CAAC,MAAM,GAAG,MAAM,GAAG,KAAK,EAAE,CAAA;IACjG,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAA;IAEb,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAe;gBACrB,IAAI,EAAE;oBACJ,GAAG,GAAG,CAAC,IAAI,CAAC,MAAM,aAAa,GAAG,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG;oBAClE,EAAE;oBACF,OAAO;iBACR,CAAC,IAAI,CAAC,IAAI,CAAC;aACb;SACF;QACD,iBAAiB,EAAE;YACjB,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,KAAK,EAAE,GAAG,CAAC,IAAI,CAAC,MAAM;SACvB;KACF,CAAA;AACH,CAAC"}
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "@daxaur/ctrl-mcp",
3
+ "version": "0.1.0",
4
+ "description": "Base MCP plugin for CTRL — turn natural language into onchain workflow automations on Base. Sign once, trade forever.",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "bin": {
8
+ "ctrl-mcp": "dist/index.js",
9
+ "daxaur-ctrl-mcp": "dist/index.js"
10
+ },
11
+ "files": [
12
+ "dist",
13
+ "README.md"
14
+ ],
15
+ "scripts": {
16
+ "build": "tsc",
17
+ "dev": "tsx watch src/index.ts",
18
+ "start": "node dist/index.js",
19
+ "prepublishOnly": "npm run build"
20
+ },
21
+ "keywords": [
22
+ "mcp",
23
+ "model-context-protocol",
24
+ "base",
25
+ "base-mcp",
26
+ "ctrl",
27
+ "automation",
28
+ "defi",
29
+ "agent",
30
+ "claude",
31
+ "cursor"
32
+ ],
33
+ "author": "CTRL Labs",
34
+ "license": "MIT",
35
+ "homepage": "https://ctrl.build/mcp",
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "https://github.com/ctrl-build/ctrl"
39
+ },
40
+ "dependencies": {
41
+ "@modelcontextprotocol/sdk": "^1.0.0",
42
+ "viem": "^2.21.0",
43
+ "zod": "^3.23.0"
44
+ },
45
+ "devDependencies": {
46
+ "@types/node": "^22.0.0",
47
+ "tsx": "^4.19.0",
48
+ "typescript": "^5.6.0"
49
+ },
50
+ "engines": {
51
+ "node": ">=18.0.0"
52
+ }
53
+ }