@secondlayer/mcp 1.0.2 → 1.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.
- package/README.md +3 -3
- package/dist/bin-http.js +307 -5
- package/dist/bin-http.js.map +7 -6
- package/dist/bin.js +307 -5
- package/dist/bin.js.map +7 -6
- package/dist/index.js +307 -5
- package/dist/index.js.map +7 -6
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -88,11 +88,26 @@ function registerResources(server) {
|
|
|
88
88
|
// src/lib/client.ts
|
|
89
89
|
import { SecondLayer } from "@secondlayer/sdk";
|
|
90
90
|
var instance = null;
|
|
91
|
+
var legacyEnvWarned = false;
|
|
92
|
+
function readServiceKey() {
|
|
93
|
+
const canonical = process.env.SL_SERVICE_KEY;
|
|
94
|
+
if (canonical)
|
|
95
|
+
return canonical;
|
|
96
|
+
const legacy = process.env.SECONDLAYER_API_KEY;
|
|
97
|
+
if (legacy) {
|
|
98
|
+
if (!legacyEnvWarned) {
|
|
99
|
+
legacyEnvWarned = true;
|
|
100
|
+
console.error("[mcp] SECONDLAYER_API_KEY is deprecated — use SL_SERVICE_KEY going forward.");
|
|
101
|
+
}
|
|
102
|
+
return legacy;
|
|
103
|
+
}
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
91
106
|
function getClient() {
|
|
92
107
|
if (!instance) {
|
|
93
|
-
const apiKey =
|
|
108
|
+
const apiKey = readServiceKey();
|
|
94
109
|
if (!apiKey) {
|
|
95
|
-
throw new Error("
|
|
110
|
+
throw new Error("SL_SERVICE_KEY environment variable is required. " + "Get your key from `sl instance info` or the dashboard.");
|
|
96
111
|
}
|
|
97
112
|
const baseUrl = process.env.SECONDLAYER_API_URL;
|
|
98
113
|
instance = new SecondLayer({
|
|
@@ -104,9 +119,9 @@ function getClient() {
|
|
|
104
119
|
return instance;
|
|
105
120
|
}
|
|
106
121
|
async function apiRequest(method, path, body) {
|
|
107
|
-
const apiKey =
|
|
122
|
+
const apiKey = readServiceKey();
|
|
108
123
|
if (!apiKey)
|
|
109
|
-
throw new Error("
|
|
124
|
+
throw new Error("SL_SERVICE_KEY required");
|
|
110
125
|
const baseUrl = process.env.SECONDLAYER_API_URL || "https://api.secondlayer.tools";
|
|
111
126
|
const res = await fetch(`${baseUrl}${path}`, {
|
|
112
127
|
method,
|
|
@@ -334,6 +349,292 @@ function registerSubgraphTools(server) {
|
|
|
334
349
|
});
|
|
335
350
|
}
|
|
336
351
|
|
|
352
|
+
// src/tools/workflows.ts
|
|
353
|
+
import { bundleWorkflowCode } from "@secondlayer/bundler";
|
|
354
|
+
import {
|
|
355
|
+
generateWorkflowCode
|
|
356
|
+
} from "@secondlayer/scaffold";
|
|
357
|
+
import { VersionConflictError } from "@secondlayer/sdk";
|
|
358
|
+
import { createPatch } from "diff";
|
|
359
|
+
import { z as z3 } from "zod/v4";
|
|
360
|
+
function registerWorkflowTools(server) {
|
|
361
|
+
defineTool(server, "workflows_list", "List all workflows. Returns summary fields only.", {}, async () => {
|
|
362
|
+
const { workflows } = await getClient().workflows.list();
|
|
363
|
+
return {
|
|
364
|
+
content: [
|
|
365
|
+
{
|
|
366
|
+
type: "text",
|
|
367
|
+
text: JSON.stringify(workflows, null, 2)
|
|
368
|
+
}
|
|
369
|
+
]
|
|
370
|
+
};
|
|
371
|
+
});
|
|
372
|
+
defineTool(server, "workflows_get", "Get full details of a workflow by name.", { name: z3.string().describe("Workflow name") }, async ({ name }) => {
|
|
373
|
+
const detail = await getClient().workflows.get(name);
|
|
374
|
+
return {
|
|
375
|
+
content: [{ type: "text", text: JSON.stringify(detail, null, 2) }]
|
|
376
|
+
};
|
|
377
|
+
});
|
|
378
|
+
defineTool(server, "workflows_get_definition", "Return the deployed TypeScript source of a workflow plus its stored version. Returns `sourceCode: null` + `readOnly: true` for workflows deployed before source capture.", { name: z3.string().describe("Workflow name") }, async ({ name }) => {
|
|
379
|
+
const source = await getClient().workflows.getSource(name);
|
|
380
|
+
return {
|
|
381
|
+
content: [{ type: "text", text: JSON.stringify(source, null, 2) }]
|
|
382
|
+
};
|
|
383
|
+
});
|
|
384
|
+
defineTool(server, "workflows_propose_edit", "Validate a proposed edit WITHOUT deploying. Fetches the current stored source, bundles the proposed source, computes a unified diff, and returns everything for review. Use this when you want to show the user a diff before committing — pair it with workflows_deploy(expectedVersion=...) to persist.", {
|
|
385
|
+
name: z3.string().describe("Workflow name"),
|
|
386
|
+
proposedCode: z3.string().describe("New TypeScript source — must compile and validate."),
|
|
387
|
+
expectedVersion: z3.string().regex(/^\d+\.\d+\.\d+$/).optional().describe("Version the proposer is editing from (for audit).")
|
|
388
|
+
}, async ({ name, proposedCode, expectedVersion }) => {
|
|
389
|
+
const current = await getClient().workflows.getSource(name);
|
|
390
|
+
if (current.sourceCode === null) {
|
|
391
|
+
return {
|
|
392
|
+
isError: true,
|
|
393
|
+
content: [
|
|
394
|
+
{
|
|
395
|
+
type: "text",
|
|
396
|
+
text: JSON.stringify({
|
|
397
|
+
error: "Workflow has no stored source. Redeploy via CLI first.",
|
|
398
|
+
readOnly: true,
|
|
399
|
+
version: current.version
|
|
400
|
+
}, null, 2)
|
|
401
|
+
}
|
|
402
|
+
]
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
let bundleValid = false;
|
|
406
|
+
let validation;
|
|
407
|
+
let bundleSize = 0;
|
|
408
|
+
try {
|
|
409
|
+
const bundled = await bundleWorkflowCode(proposedCode);
|
|
410
|
+
bundleValid = true;
|
|
411
|
+
bundleSize = Buffer.byteLength(bundled.handlerCode, "utf8");
|
|
412
|
+
validation = {
|
|
413
|
+
name: bundled.name,
|
|
414
|
+
triggerType: bundled.trigger.type
|
|
415
|
+
};
|
|
416
|
+
} catch (err) {
|
|
417
|
+
validation = {
|
|
418
|
+
error: err instanceof Error ? err.message : String(err)
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
const diffText = createPatch(`${name}.ts`, current.sourceCode, proposedCode, `v${current.version}`, "proposed");
|
|
422
|
+
return {
|
|
423
|
+
content: [
|
|
424
|
+
{
|
|
425
|
+
type: "text",
|
|
426
|
+
text: JSON.stringify({
|
|
427
|
+
currentVersion: current.version,
|
|
428
|
+
expectedVersion,
|
|
429
|
+
currentSource: current.sourceCode,
|
|
430
|
+
proposedSource: proposedCode,
|
|
431
|
+
diffText,
|
|
432
|
+
bundleValid,
|
|
433
|
+
validation,
|
|
434
|
+
bundleSize
|
|
435
|
+
}, null, 2)
|
|
436
|
+
}
|
|
437
|
+
]
|
|
438
|
+
};
|
|
439
|
+
});
|
|
440
|
+
defineTool(server, "workflows_tail_run", "Tail a workflow run via SSE and return a compacted log. Resolves as soon as the run completes, `limit` events are collected, or `timeoutMs` elapses (default 60s). MCP is not streaming-first — use this for short-lived follow-ups, not long tails.", {
|
|
441
|
+
name: z3.string().describe("Workflow name"),
|
|
442
|
+
runId: z3.string().describe("Run id"),
|
|
443
|
+
limit: z3.number().int().positive().max(200).optional().describe("Max step events to collect (default 50)"),
|
|
444
|
+
timeoutMs: z3.number().int().positive().max(5 * 60 * 1000).optional().describe("Hard timeout in ms (default 60000, max 300000)")
|
|
445
|
+
}, async ({ name, runId, limit, timeoutMs }) => {
|
|
446
|
+
const cap = limit ?? 50;
|
|
447
|
+
const deadline = timeoutMs ?? 60000;
|
|
448
|
+
const events = [];
|
|
449
|
+
let finalStatus = null;
|
|
450
|
+
let stoppedBy = "timeout";
|
|
451
|
+
const controller = new AbortController;
|
|
452
|
+
const timer = setTimeout(() => {
|
|
453
|
+
stoppedBy = "timeout";
|
|
454
|
+
controller.abort();
|
|
455
|
+
}, deadline);
|
|
456
|
+
try {
|
|
457
|
+
await getClient().workflows.streamRun(name, runId, (event) => {
|
|
458
|
+
if (event.type === "step") {
|
|
459
|
+
events.push(event.step);
|
|
460
|
+
if (events.length >= cap) {
|
|
461
|
+
stoppedBy = "limit";
|
|
462
|
+
controller.abort();
|
|
463
|
+
}
|
|
464
|
+
} else if (event.type === "done") {
|
|
465
|
+
finalStatus = event.done.status;
|
|
466
|
+
stoppedBy = "done";
|
|
467
|
+
}
|
|
468
|
+
}, controller.signal);
|
|
469
|
+
} catch (err) {
|
|
470
|
+
if (!(err instanceof Error) || err.name !== "AbortError") {
|
|
471
|
+
throw err;
|
|
472
|
+
}
|
|
473
|
+
} finally {
|
|
474
|
+
clearTimeout(timer);
|
|
475
|
+
}
|
|
476
|
+
return {
|
|
477
|
+
content: [
|
|
478
|
+
{
|
|
479
|
+
type: "text",
|
|
480
|
+
text: JSON.stringify({
|
|
481
|
+
runId,
|
|
482
|
+
finalStatus,
|
|
483
|
+
stoppedBy,
|
|
484
|
+
eventCount: events.length,
|
|
485
|
+
events
|
|
486
|
+
}, null, 2)
|
|
487
|
+
}
|
|
488
|
+
]
|
|
489
|
+
};
|
|
490
|
+
});
|
|
491
|
+
defineTool(server, "workflows_pause_all", "Pause ALL active workflows for the authenticated account. Irreversible only by calling pause/resume per workflow. Returns the list of affected workflows.", {}, async () => {
|
|
492
|
+
const result = await getClient().workflows.pauseAll();
|
|
493
|
+
return {
|
|
494
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
495
|
+
};
|
|
496
|
+
});
|
|
497
|
+
defineTool(server, "workflows_cancel_run", "Cancel an in-flight workflow run. Marks the run as cancelled and removes any pending queue entry. No-ops if the run is already terminal.", { runId: z3.string().describe("Run id to cancel") }, async ({ runId }) => {
|
|
498
|
+
const result = await getClient().workflows.cancelRun(runId);
|
|
499
|
+
return {
|
|
500
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
501
|
+
};
|
|
502
|
+
});
|
|
503
|
+
defineTool(server, "workflows_rollback", "Roll a workflow back to a prior version. The restored handler is re-published as a NEW version (audit trail), so no history is lost. Pass toVersion to pick a specific bundle; omit to roll back to the immediate previous version on disk. Last 3 versions are retained.", {
|
|
504
|
+
name: z3.string().describe("Workflow name"),
|
|
505
|
+
toVersion: z3.string().regex(/^\d+\.\d+\.\d+$/).optional().describe("Target version to restore. Must be one of the retained bundles on disk.")
|
|
506
|
+
}, async ({ name, toVersion }) => {
|
|
507
|
+
const result = await getClient().workflows.rollback(name, toVersion);
|
|
508
|
+
return {
|
|
509
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
510
|
+
};
|
|
511
|
+
});
|
|
512
|
+
defineTool(server, "workflows_delete", "Delete a workflow permanently.", { name: z3.string().describe("Workflow name") }, async ({ name }) => {
|
|
513
|
+
await getClient().workflows.delete(name);
|
|
514
|
+
return {
|
|
515
|
+
content: [{ type: "text", text: `Deleted workflow "${name}"` }]
|
|
516
|
+
};
|
|
517
|
+
});
|
|
518
|
+
defineTool(server, "workflows_trigger", "Trigger a workflow run. Optionally pass input as a JSON string.", {
|
|
519
|
+
name: z3.string().describe("Workflow name"),
|
|
520
|
+
input: z3.string().optional().describe("Input as JSON string")
|
|
521
|
+
}, async ({ name, input }) => {
|
|
522
|
+
const parsed = input ? JSON.parse(input) : undefined;
|
|
523
|
+
const result = await getClient().workflows.trigger(name, parsed);
|
|
524
|
+
return {
|
|
525
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
526
|
+
};
|
|
527
|
+
});
|
|
528
|
+
defineTool(server, "workflows_pause", "Pause a running workflow.", { name: z3.string().describe("Workflow name") }, async ({ name }) => {
|
|
529
|
+
await getClient().workflows.pause(name);
|
|
530
|
+
return {
|
|
531
|
+
content: [{ type: "text", text: `Paused workflow "${name}"` }]
|
|
532
|
+
};
|
|
533
|
+
});
|
|
534
|
+
defineTool(server, "workflows_resume", "Resume a paused workflow.", { name: z3.string().describe("Workflow name") }, async ({ name }) => {
|
|
535
|
+
await getClient().workflows.resume(name);
|
|
536
|
+
return {
|
|
537
|
+
content: [{ type: "text", text: `Resumed workflow "${name}"` }]
|
|
538
|
+
};
|
|
539
|
+
});
|
|
540
|
+
defineTool(server, "workflows_scaffold", "Generate a compilable defineWorkflow() skeleton from a typed intent. Returns the TypeScript source; pass it to workflows_deploy to persist. Placeholders inside the source must be filled in before running a real workflow.", {
|
|
541
|
+
name: z3.string().regex(/^[a-z][a-z0-9-]*$/).describe("Workflow name (lowercase, hyphens)"),
|
|
542
|
+
trigger: z3.discriminatedUnion("type", [
|
|
543
|
+
z3.object({
|
|
544
|
+
type: z3.literal("event"),
|
|
545
|
+
filterType: z3.string().optional()
|
|
546
|
+
}),
|
|
547
|
+
z3.object({
|
|
548
|
+
type: z3.literal("schedule"),
|
|
549
|
+
cron: z3.string().min(1),
|
|
550
|
+
timezone: z3.string().optional()
|
|
551
|
+
}),
|
|
552
|
+
z3.object({ type: z3.literal("manual") })
|
|
553
|
+
]).describe("Trigger shape"),
|
|
554
|
+
steps: z3.array(z3.enum(["run", "query", "ai", "deliver"])).describe("Ordered list of step kinds to include in the handler"),
|
|
555
|
+
deliveryTarget: z3.enum(["webhook", "slack", "email", "discord", "telegram"]).optional().describe("Delivery target used when steps includes `deliver`")
|
|
556
|
+
}, async ({ name, trigger, steps, deliveryTarget }) => {
|
|
557
|
+
const code = generateWorkflowCode({
|
|
558
|
+
name,
|
|
559
|
+
trigger,
|
|
560
|
+
steps,
|
|
561
|
+
deliveryTarget
|
|
562
|
+
});
|
|
563
|
+
return { content: [{ type: "text", text: code }] };
|
|
564
|
+
});
|
|
565
|
+
defineTool(server, "workflows_deploy", "Deploy a workflow from TypeScript source. Pass the full defineWorkflow() source — it will be bundled, validated, and deployed. Use expectedVersion for optimistic concurrency, or dryRun to validate without persisting.", {
|
|
566
|
+
code: z3.string().describe("TypeScript source code containing a defineWorkflow() call"),
|
|
567
|
+
expectedVersion: z3.string().regex(/^\d+\.\d+\.\d+$/).optional().describe("Stored version the client expects (major.minor.patch). Server returns 409 on mismatch."),
|
|
568
|
+
dryRun: z3.boolean().optional().describe("If true, validate and bundle only — do not persist.")
|
|
569
|
+
}, async ({ code, expectedVersion, dryRun }) => {
|
|
570
|
+
let bundled;
|
|
571
|
+
try {
|
|
572
|
+
bundled = await bundleWorkflowCode(code);
|
|
573
|
+
} catch (err) {
|
|
574
|
+
return {
|
|
575
|
+
isError: true,
|
|
576
|
+
content: [
|
|
577
|
+
{
|
|
578
|
+
type: "text",
|
|
579
|
+
text: err instanceof Error ? err.message : String(err)
|
|
580
|
+
}
|
|
581
|
+
]
|
|
582
|
+
};
|
|
583
|
+
}
|
|
584
|
+
const base = {
|
|
585
|
+
name: bundled.name,
|
|
586
|
+
trigger: bundled.trigger,
|
|
587
|
+
handlerCode: bundled.handlerCode,
|
|
588
|
+
sourceCode: bundled.sourceCode,
|
|
589
|
+
retries: bundled.retries,
|
|
590
|
+
timeout: bundled.timeout,
|
|
591
|
+
expectedVersion
|
|
592
|
+
};
|
|
593
|
+
try {
|
|
594
|
+
const result = dryRun ? await getClient().workflows.deploy({ ...base, dryRun: true }) : await getClient().workflows.deploy(base);
|
|
595
|
+
return {
|
|
596
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
597
|
+
};
|
|
598
|
+
} catch (err) {
|
|
599
|
+
if (err instanceof VersionConflictError) {
|
|
600
|
+
return {
|
|
601
|
+
isError: true,
|
|
602
|
+
content: [
|
|
603
|
+
{
|
|
604
|
+
type: "text",
|
|
605
|
+
text: JSON.stringify({
|
|
606
|
+
error: err.message,
|
|
607
|
+
code: "VERSION_CONFLICT",
|
|
608
|
+
currentVersion: err.currentVersion,
|
|
609
|
+
expectedVersion: err.expectedVersion
|
|
610
|
+
}, null, 2)
|
|
611
|
+
}
|
|
612
|
+
]
|
|
613
|
+
};
|
|
614
|
+
}
|
|
615
|
+
throw err;
|
|
616
|
+
}
|
|
617
|
+
});
|
|
618
|
+
defineTool(server, "workflows_runs", "List runs for a workflow. Optionally filter by status and limit results.", {
|
|
619
|
+
name: z3.string().describe("Workflow name"),
|
|
620
|
+
status: z3.enum(["running", "completed", "failed", "cancelled"]).optional().describe("Filter by run status"),
|
|
621
|
+
limit: z3.number().optional().describe("Max runs to return (default 20)")
|
|
622
|
+
}, async ({ name, status, limit }) => {
|
|
623
|
+
const { runs } = await getClient().workflows.listRuns(name, {
|
|
624
|
+
status,
|
|
625
|
+
limit
|
|
626
|
+
});
|
|
627
|
+
return {
|
|
628
|
+
content: [
|
|
629
|
+
{
|
|
630
|
+
type: "text",
|
|
631
|
+
text: JSON.stringify(runs, null, 2)
|
|
632
|
+
}
|
|
633
|
+
]
|
|
634
|
+
};
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
|
|
337
638
|
// src/server.ts
|
|
338
639
|
var __dirname2 = dirname(fileURLToPath(import.meta.url));
|
|
339
640
|
var pkg = JSON.parse(readFileSync(join(__dirname2, "../package.json"), "utf-8"));
|
|
@@ -344,6 +645,7 @@ function createServer() {
|
|
|
344
645
|
});
|
|
345
646
|
registerScaffoldTools(server);
|
|
346
647
|
registerSubgraphTools(server);
|
|
648
|
+
registerWorkflowTools(server);
|
|
347
649
|
registerAccountTools(server);
|
|
348
650
|
registerResources(server);
|
|
349
651
|
return server;
|
|
@@ -354,5 +656,5 @@ var server = createServer();
|
|
|
354
656
|
var transport = new StdioServerTransport;
|
|
355
657
|
await server.connect(transport);
|
|
356
658
|
|
|
357
|
-
//# debugId=
|
|
659
|
+
//# debugId=A34BDC5D0D801C0D64756E2164756E21
|
|
358
660
|
//# sourceMappingURL=bin.js.map
|
package/dist/bin.js.map
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/bin.ts", "../src/server.ts", "../src/resources.ts", "../src/lib/client.ts", "../src/lib/format.ts", "../src/lib/tool.ts", "../src/tools/account.ts", "../src/tools/scaffold.ts", "../src/tools/subgraphs.ts"],
|
|
3
|
+
"sources": ["../src/bin.ts", "../src/server.ts", "../src/resources.ts", "../src/lib/client.ts", "../src/lib/format.ts", "../src/lib/tool.ts", "../src/tools/account.ts", "../src/tools/scaffold.ts", "../src/tools/subgraphs.ts", "../src/tools/workflows.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"#!/usr/bin/env node\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport { createServer } from \"./server.ts\";\n\nconst server = createServer();\nconst transport = new StdioServerTransport();\nawait server.connect(transport);\n",
|
|
6
|
-
"import { readFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { registerResources } from \"./resources.ts\";\nimport { registerAccountTools } from \"./tools/account.ts\";\nimport { registerScaffoldTools } from \"./tools/scaffold.ts\";\nimport { registerSubgraphTools } from \"./tools/subgraphs.ts\";\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\nconst pkg = JSON.parse(\n\treadFileSync(join(__dirname, \"../package.json\"), \"utf-8\"),\n);\n\nexport function createServer(): McpServer {\n\tconst server = new McpServer({\n\t\tname: \"secondlayer\",\n\t\tversion: pkg.version,\n\t});\n\n\tregisterScaffoldTools(server);\n\tregisterSubgraphTools(server);\n\tregisterAccountTools(server);\n\tregisterResources(server);\n\n\treturn server;\n}\n",
|
|
6
|
+
"import { readFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { registerResources } from \"./resources.ts\";\nimport { registerAccountTools } from \"./tools/account.ts\";\nimport { registerScaffoldTools } from \"./tools/scaffold.ts\";\nimport { registerSubgraphTools } from \"./tools/subgraphs.ts\";\nimport { registerWorkflowTools } from \"./tools/workflows.ts\";\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\nconst pkg = JSON.parse(\n\treadFileSync(join(__dirname, \"../package.json\"), \"utf-8\"),\n);\n\nexport function createServer(): McpServer {\n\tconst server = new McpServer({\n\t\tname: \"secondlayer\",\n\t\tversion: pkg.version,\n\t});\n\n\tregisterScaffoldTools(server);\n\tregisterSubgraphTools(server);\n\tregisterWorkflowTools(server);\n\tregisterAccountTools(server);\n\tregisterResources(server);\n\n\treturn server;\n}\n",
|
|
7
7
|
"import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\n\n/** Filter types for blockchain events — SubgraphFilter vocabulary. */\nconst FILTERS_REFERENCE = [\n\t{\n\t\ttype: \"stx_transfer\",\n\t\tfields: [\"sender\", \"recipient\", \"minAmount\", \"maxAmount\"],\n\t},\n\t{ type: \"stx_mint\", fields: [\"recipient\", \"minAmount\"] },\n\t{ type: \"stx_burn\", fields: [\"sender\", \"minAmount\"] },\n\t{ type: \"stx_lock\", fields: [\"lockedAddress\", \"minAmount\"] },\n\t{\n\t\ttype: \"ft_transfer\",\n\t\tfields: [\n\t\t\t\"sender\",\n\t\t\t\"recipient\",\n\t\t\t\"assetIdentifier\",\n\t\t\t\"minAmount\",\n\t\t\t\"maxAmount\",\n\t\t],\n\t},\n\t{ type: \"ft_mint\", fields: [\"recipient\", \"assetIdentifier\", \"minAmount\"] },\n\t{ type: \"ft_burn\", fields: [\"sender\", \"assetIdentifier\", \"minAmount\"] },\n\t{\n\t\ttype: \"nft_transfer\",\n\t\tfields: [\"sender\", \"recipient\", \"assetIdentifier\", \"tokenId\"],\n\t},\n\t{ type: \"nft_mint\", fields: [\"recipient\", \"assetIdentifier\", \"tokenId\"] },\n\t{ type: \"nft_burn\", fields: [\"sender\", \"assetIdentifier\", \"tokenId\"] },\n\t{ type: \"contract_call\", fields: [\"contract\", \"function\"] },\n\t{ type: \"contract_deploy\", fields: [\"contract\"] },\n\t{ type: \"print_event\", fields: [\"contract\", \"event\", \"contains\"] },\n];\n\nconst COLUMN_TYPES = [\n\t{\n\t\ttype: \"uint\",\n\t\tsqlType: \"bigint\",\n\t\tdescription: \"Unsigned integer (Clarity uint)\",\n\t},\n\t{\n\t\ttype: \"int\",\n\t\tsqlType: \"bigint\",\n\t\tdescription: \"Signed integer (Clarity int)\",\n\t},\n\t{ type: \"text\", sqlType: \"text\", description: \"UTF-8 string\" },\n\t{\n\t\ttype: \"principal\",\n\t\tsqlType: \"text\",\n\t\tdescription: \"Stacks address (standard or contract)\",\n\t},\n\t{ type: \"bool\", sqlType: \"boolean\", description: \"Boolean value\" },\n\t{ type: \"json\", sqlType: \"jsonb\", description: \"Arbitrary JSON data\" },\n\t{\n\t\toptions: [\"nullable\", \"indexed\", \"search\"],\n\t\tdescription:\n\t\t\t\"Column options: nullable allows NULL, indexed creates a B-tree index, search enables full-text search\",\n\t},\n];\n\nexport function registerResources(server: McpServer) {\n\tserver.resource(\n\t\t\"filters\",\n\t\t\"secondlayer://filters\",\n\t\t{ description: \"Event filter types and their available fields\" },\n\t\tasync () => ({\n\t\t\tcontents: [\n\t\t\t\t{\n\t\t\t\t\turi: \"secondlayer://filters\",\n\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\ttext: JSON.stringify(FILTERS_REFERENCE, null, 2),\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t);\n\n\tserver.resource(\n\t\t\"column-types\",\n\t\t\"secondlayer://column-types\",\n\t\t{ description: \"Subgraph column types, SQL mappings, and options\" },\n\t\tasync () => ({\n\t\t\tcontents: [\n\t\t\t\t{\n\t\t\t\t\turi: \"secondlayer://column-types\",\n\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\ttext: JSON.stringify(COLUMN_TYPES, null, 2),\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t);\n}\n",
|
|
8
|
-
"import { SecondLayer } from \"@secondlayer/sdk\";\n\nlet instance: SecondLayer | null = null;\n\n/** Lazy SDK singleton from SECONDLAYER_API_KEY env var. */\nexport function getClient(): SecondLayer {\n\tif (!instance) {\n\t\tconst apiKey =
|
|
8
|
+
"import { SecondLayer } from \"@secondlayer/sdk\";\n\nlet instance: SecondLayer | null = null;\nlet legacyEnvWarned = false;\n\n/**\n * Read the tenant service key from env. `SL_SERVICE_KEY` is canonical;\n * `SECONDLAYER_API_KEY` is accepted as a deprecated alias and logs once\n * per process so users notice without breaking their setup.\n */\nfunction readServiceKey(): string | undefined {\n\tconst canonical = process.env.SL_SERVICE_KEY;\n\tif (canonical) return canonical;\n\tconst legacy = process.env.SECONDLAYER_API_KEY;\n\tif (legacy) {\n\t\tif (!legacyEnvWarned) {\n\t\t\tlegacyEnvWarned = true;\n\t\t\tconsole.error(\n\t\t\t\t\"[mcp] SECONDLAYER_API_KEY is deprecated — use SL_SERVICE_KEY going forward.\",\n\t\t\t);\n\t\t}\n\t\treturn legacy;\n\t}\n\treturn undefined;\n}\n\n/** Lazy SDK singleton from SL_SERVICE_KEY (or SECONDLAYER_API_KEY) env var. */\nexport function getClient(): SecondLayer {\n\tif (!instance) {\n\t\tconst apiKey = readServiceKey();\n\t\tif (!apiKey) {\n\t\t\tthrow new Error(\n\t\t\t\t\"SL_SERVICE_KEY environment variable is required. \" +\n\t\t\t\t\t\"Get your key from `sl instance info` or the dashboard.\",\n\t\t\t);\n\t\t}\n\t\tconst baseUrl = process.env.SECONDLAYER_API_URL;\n\t\tinstance = new SecondLayer({\n\t\t\tapiKey,\n\t\t\torigin: \"mcp\",\n\t\t\t...(baseUrl ? { baseUrl } : {}),\n\t\t});\n\t}\n\treturn instance;\n}\n\n/** Raw fetch helper for API endpoints not covered by the SDK. */\nexport async function apiRequest<T>(\n\tmethod: string,\n\tpath: string,\n\tbody?: unknown,\n): Promise<T> {\n\tconst apiKey = readServiceKey();\n\tif (!apiKey) throw new Error(\"SL_SERVICE_KEY required\");\n\tconst baseUrl =\n\t\tprocess.env.SECONDLAYER_API_URL || \"https://api.secondlayer.tools\";\n\tconst res = await fetch(`${baseUrl}${path}`, {\n\t\tmethod,\n\t\theaders: {\n\t\t\t\"Content-Type\": \"application/json\",\n\t\t\tAuthorization: `Bearer ${apiKey}`,\n\t\t},\n\t\tbody: body ? JSON.stringify(body) : undefined,\n\t});\n\tif (!res.ok) {\n\t\tconst text = await res.text().catch(() => \"\");\n\t\tthrow Object.assign(new Error(text || `HTTP ${res.status}`), {\n\t\t\tstatus: res.status,\n\t\t});\n\t}\n\tif (res.status === 204) return undefined as T;\n\treturn res.json() as Promise<T>;\n}\n",
|
|
9
9
|
"/** Summarize a subgraph for list responses. */\nexport function formatSubgraphSummary(s: {\n\tname: string;\n\tstatus: string;\n\ttables: string[] | Record<string, unknown>;\n\tlastProcessedBlock: number;\n}) {\n\treturn {\n\t\tname: s.name,\n\t\tstatus: s.status,\n\t\ttables: Array.isArray(s.tables) ? s.tables : Object.keys(s.tables),\n\t\tlastProcessedBlock: s.lastProcessedBlock,\n\t};\n}\n\n/** Cap array length and return truncation metadata. */\nexport function withCap<T>(\n\titems: T[],\n\tcap: number,\n): { items: T[]; truncated: boolean; total: number } {\n\treturn {\n\t\titems: items.slice(0, cap),\n\t\ttruncated: items.length > cap,\n\t\ttotal: items.length,\n\t};\n}\n\n/** Build MCP text response with JSON-serialized payload. */\nexport function jsonResponse(\n\tdata: unknown,\n\tisError?: boolean,\n): { content: Array<{ type: \"text\"; text: string }>; isError?: boolean } {\n\treturn {\n\t\tcontent: [{ type: \"text\", text: JSON.stringify(data, null, 2) }],\n\t\t...(isError && { isError: true }),\n\t};\n}\n\n/** Build MCP text response with plain text payload. */\nexport function textResponse(\n\ttext: string,\n\tisError?: boolean,\n): { content: Array<{ type: \"text\"; text: string }>; isError?: boolean } {\n\treturn {\n\t\tcontent: [{ type: \"text\", text }],\n\t\t...(isError && { isError: true }),\n\t};\n}\n",
|
|
10
10
|
"import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\n\ninterface ToolResult {\n\tcontent: Array<{ type: \"text\"; text: string }>;\n\tisError?: boolean;\n}\n\n/**\n * Type-safe wrapper around McpServer.tool() that avoids TS2589.\n *\n * The MCP SDK's Zod-generic `tool()` signature recurses past TypeScript's\n * instantiation depth limit when schemas contain discriminated unions or\n * nested optionals. This helper isolates the boundary cast to one place\n * so tool files stay fully typed via the explicit `T` generic.\n *\n * Schema is typed as Record<string, unknown> to prevent TypeScript from\n * resolving the deeply recursive ZodRawShapeCompat constraint. Zod still\n * validates at runtime.\n */\nexport function defineTool<T>(\n\tserver: McpServer,\n\tname: string,\n\tdescription: string,\n\tschema: Record<string, unknown>,\n\thandler: (args: T) => Promise<ToolResult> | ToolResult,\n): void {\n\tconst wrappedHandler = async (args: T): Promise<ToolResult> => {\n\t\ttry {\n\t\t\treturn await handler(args);\n\t\t} catch (err: unknown) {\n\t\t\tconst message = err instanceof Error ? err.message : String(err);\n\t\t\tconst status =\n\t\t\t\terr instanceof Error && \"status\" in err ? (err as any).status : 0;\n\t\t\tconst type =\n\t\t\t\tstatus === 401\n\t\t\t\t\t? \"unauthorized\"\n\t\t\t\t\t: status === 404\n\t\t\t\t\t\t? \"not_found\"\n\t\t\t\t\t\t: status === 429\n\t\t\t\t\t\t\t? \"rate_limited\"\n\t\t\t\t\t\t\t: status >= 500\n\t\t\t\t\t\t\t\t? \"server_error\"\n\t\t\t\t\t\t\t\t: \"error\";\n\t\t\treturn {\n\t\t\t\tcontent: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\ttext: JSON.stringify({ error: { type, status, message } }),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tisError: true,\n\t\t\t};\n\t\t}\n\t};\n\t(server.tool as Function)(name, description, schema, wrappedHandler);\n}\n",
|
|
11
11
|
"import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { apiRequest } from \"../lib/client.ts\";\nimport { jsonResponse } from \"../lib/format.ts\";\nimport { defineTool } from \"../lib/tool.ts\";\n\nexport function registerAccountTools(server: McpServer) {\n\tdefineTool<Record<string, never>>(\n\t\tserver,\n\t\t\"account_whoami\",\n\t\t\"Show the authenticated account's email and plan.\",\n\t\t{},\n\t\tasync () => {\n\t\t\tconst result = await apiRequest<{ email: string; plan: string }>(\n\t\t\t\t\"GET\",\n\t\t\t\t\"/api/accounts/me\",\n\t\t\t);\n\t\t\treturn jsonResponse(result);\n\t\t},\n\t);\n}\n",
|
|
12
12
|
"import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { generateSubgraphCode } from \"@secondlayer/scaffold\";\nimport type { AbiFunction, AbiMap } from \"@secondlayer/scaffold\";\nimport { z } from \"zod/v4\";\nimport { defineTool } from \"../lib/tool.ts\";\n\nconst API_BASE =\n\tprocess.env.SECONDLAYER_API_URL || \"https://api.secondlayer.tools\";\n\nasync function fetchAbi(\n\tcontractId: string,\n): Promise<{ functions: AbiFunction[]; maps: AbiMap[] }> {\n\tconst res = await fetch(`${API_BASE}/api/node/contracts/${contractId}/abi`, {\n\t\tsignal: AbortSignal.timeout(10_000),\n\t});\n\tif (!res.ok) {\n\t\tif (res.status === 404)\n\t\t\tthrow new Error(`Contract not found: ${contractId}`);\n\t\tthrow new Error(`Failed to fetch ABI: HTTP ${res.status}`);\n\t}\n\tconst abi = (await res.json()) as {\n\t\tfunctions?: AbiFunction[];\n\t\tmaps?: AbiMap[];\n\t};\n\treturn {\n\t\tfunctions: abi.functions ?? [],\n\t\tmaps: abi.maps ?? [],\n\t};\n}\n\nexport function registerScaffoldTools(server: McpServer) {\n\tdefineTool<{ contractId: string; subgraphName?: string }>(\n\t\tserver,\n\t\t\"scaffold_from_contract\",\n\t\t\"Generate a subgraph scaffold from a deployed Stacks contract. Fetches the ABI automatically.\",\n\t\t{\n\t\t\tcontractId: z\n\t\t\t\t.string()\n\t\t\t\t.describe(\n\t\t\t\t\t\"Fully qualified contract ID (e.g. SP102V8P0F7JX67ARQ77WEA3D3CFB5XW39REDT0AM.amm-pool-v2-01)\",\n\t\t\t\t),\n\t\t\tsubgraphName: z\n\t\t\t\t.string()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Override the subgraph name (defaults to contract name)\"),\n\t\t},\n\t\tasync ({ contractId, subgraphName }) => {\n\t\t\tconst { functions, maps } = await fetchAbi(contractId);\n\t\t\tconst code = generateSubgraphCode(\n\t\t\t\tcontractId,\n\t\t\t\tfunctions,\n\t\t\t\tsubgraphName,\n\t\t\t\tmaps,\n\t\t\t);\n\t\t\treturn { content: [{ type: \"text\", text: code }] };\n\t\t},\n\t);\n\n\tdefineTool<{ abi: string; contractId: string; subgraphName?: string }>(\n\t\tserver,\n\t\t\"scaffold_from_abi\",\n\t\t\"Generate a subgraph scaffold from a provided ABI JSON. Use when you already have the ABI.\",\n\t\t{\n\t\t\tabi: z\n\t\t\t\t.string()\n\t\t\t\t.describe(\"ABI JSON string (the full contract ABI object)\"),\n\t\t\tcontractId: z.string().describe(\"Fully qualified contract ID\"),\n\t\t\tsubgraphName: z\n\t\t\t\t.string()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Override the subgraph name\"),\n\t\t},\n\t\tasync ({ abi, contractId, subgraphName }) => {\n\t\t\tlet parsed: { functions?: AbiFunction[]; maps?: AbiMap[] };\n\t\t\ttry {\n\t\t\t\tparsed = JSON.parse(abi);\n\t\t\t} catch {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\", text: \"Invalid ABI JSON\" }],\n\t\t\t\t\tisError: true,\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst code = generateSubgraphCode(\n\t\t\t\tcontractId,\n\t\t\t\tparsed.functions ?? [],\n\t\t\t\tsubgraphName,\n\t\t\t\tparsed.maps ?? [],\n\t\t\t);\n\t\t\treturn { content: [{ type: \"text\", text: code }] };\n\t\t},\n\t);\n}\n",
|
|
13
|
-
"import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { bundleSubgraphCode } from \"@secondlayer/bundler\";\nimport { z } from \"zod/v4\";\nimport { getClient } from \"../lib/client.ts\";\nimport { formatSubgraphSummary, withCap } from \"../lib/format.ts\";\nimport { defineTool } from \"../lib/tool.ts\";\n\nexport function registerSubgraphTools(server: McpServer) {\n\tdefineTool<Record<string, never>>(\n\t\tserver,\n\t\t\"subgraphs_list\",\n\t\t\"List all deployed subgraphs. Returns summary fields only.\",\n\t\t{},\n\t\tasync () => {\n\t\t\tconst { data } = await getClient().subgraphs.list();\n\t\t\treturn {\n\t\t\t\tcontent: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\ttext: JSON.stringify(data.map(formatSubgraphSummary), null, 2),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{ name: string }>(\n\t\tserver,\n\t\t\"subgraphs_get\",\n\t\t\"Get full details of a subgraph including schema, health, and table columns.\",\n\t\t{ name: z.string().describe(\"Subgraph name\") },\n\t\tasync ({ name }) => {\n\t\t\tconst detail = await getClient().subgraphs.get(name);\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: JSON.stringify(detail, null, 2) }],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{\n\t\tname: string;\n\t\ttable: string;\n\t\tfilters?: Record<string, string>;\n\t\tsort?: string;\n\t\torder?: string;\n\t\tlimit?: number;\n\t\toffset?: number;\n\t\tfields?: string;\n\t\tcount?: boolean;\n\t}>(\n\t\tserver,\n\t\t\"subgraphs_query\",\n\t\t'Query rows from a subgraph table (max 200 rows). Filters support operators: \"amount.gte\": \"1000\", \"sender.neq\": \"SP...\", \"name.like\": \"%token%\". Available operators: eq, neq, gt, gte, lt, lte, like.',\n\t\t{\n\t\t\tname: z.string().describe(\"Subgraph name\"),\n\t\t\ttable: z.string().describe(\"Table name\"),\n\t\t\tfilters: z\n\t\t\t\t.record(z.string(), z.string())\n\t\t\t\t.optional()\n\t\t\t\t.describe(\n\t\t\t\t\t'Column filters — plain values or with operators (e.g. {\"amount.gte\": \"1000\", \"sender\": \"SP...\"})',\n\t\t\t\t),\n\t\t\tsort: z.string().optional().describe(\"Column to sort by\"),\n\t\t\torder: z.enum([\"asc\", \"desc\"]).optional().describe(\"Sort order\"),\n\t\t\tlimit: z\n\t\t\t\t.number()\n\t\t\t\t.max(200)\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Max rows (default 50, max 200)\"),\n\t\t\toffset: z.number().optional().describe(\"Offset for pagination\"),\n\t\t\tfields: z\n\t\t\t\t.string()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\n\t\t\t\t\t'Comma-separated column list to return (e.g. \"sender,amount\")',\n\t\t\t\t),\n\t\t\tcount: z\n\t\t\t\t.boolean()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"If true, return row count instead of rows\"),\n\t\t},\n\t\tasync ({\n\t\t\tname,\n\t\t\ttable,\n\t\t\tfilters,\n\t\t\tsort,\n\t\t\torder,\n\t\t\tlimit,\n\t\t\toffset,\n\t\t\tfields,\n\t\t\tcount,\n\t\t}) => {\n\t\t\tif (count) {\n\t\t\t\tconst result = await getClient().subgraphs.queryTableCount(\n\t\t\t\t\tname,\n\t\t\t\t\ttable,\n\t\t\t\t\t{ filters, sort, order },\n\t\t\t\t);\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\", text: JSON.stringify(result, null, 2) }],\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst rows = await getClient().subgraphs.queryTable(name, table, {\n\t\t\t\tfilters,\n\t\t\t\tsort,\n\t\t\t\torder,\n\t\t\t\tlimit: limit ?? 50,\n\t\t\t\toffset,\n\t\t\t\tfields,\n\t\t\t});\n\t\t\tconst cap = limit ?? 50;\n\t\t\tconst result = withCap(\n\t\t\t\trows as Record<string, unknown>[],\n\t\t\t\tcap > 200 ? 200 : cap,\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: JSON.stringify(result, null, 2) }],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{ name: string; fromBlock?: number; toBlock?: number }>(\n\t\tserver,\n\t\t\"subgraphs_reindex\",\n\t\t\"Reindex a subgraph from a specific block range.\",\n\t\t{\n\t\t\tname: z.string().describe(\"Subgraph name\"),\n\t\t\tfromBlock: z\n\t\t\t\t.number()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Start block (defaults to beginning)\"),\n\t\t\ttoBlock: z.number().optional().describe(\"End block (defaults to latest)\"),\n\t\t},\n\t\tasync ({ name, fromBlock, toBlock }) => {\n\t\t\tconst result = await getClient().subgraphs.reindex(name, {\n\t\t\t\tfromBlock,\n\t\t\t\ttoBlock,\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: JSON.stringify(result, null, 2) }],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{ name: string }>(\n\t\tserver,\n\t\t\"subgraphs_delete\",\n\t\t\"Delete a subgraph permanently.\",\n\t\t{ name: z.string().describe(\"Subgraph name\") },\n\t\tasync ({ name }) => {\n\t\t\tconst result = await getClient().subgraphs.delete(name);\n\t\t\treturn { content: [{ type: \"text\", text: result.message }] };\n\t\t},\n\t);\n\n\tdefineTool<{ code: string; reindex?: boolean }>(\n\t\tserver,\n\t\t\"subgraphs_deploy\",\n\t\t\"Deploy a subgraph from TypeScript code. Pass the full defineSubgraph() source — it will be bundled, validated, and deployed.\",\n\t\t{\n\t\t\tcode: z\n\t\t\t\t.string()\n\t\t\t\t.describe(\"TypeScript source code containing a defineSubgraph() call\"),\n\t\t\treindex: z\n\t\t\t\t.boolean()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\n\t\t\t\t\t\"Force reindex on breaking schema change (drops and rebuilds all data)\",\n\t\t\t\t),\n\t\t},\n\t\tasync ({ code, reindex }) => {\n\t\t\tconst bundled = await bundleSubgraphCode(code);\n\t\t\tconst result = await getClient().subgraphs.deploy({\n\t\t\t\tname: bundled.name,\n\t\t\t\tversion: bundled.version,\n\t\t\t\tdescription: bundled.description,\n\t\t\t\tsources: bundled.sources,\n\t\t\t\tschema: bundled.schema,\n\t\t\t\thandlerCode: bundled.handlerCode,\n\t\t\t\tsourceCode: code,\n\t\t\t\treindex,\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: JSON.stringify(result, null, 2) }],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{ name: string }>(\n\t\tserver,\n\t\t\"subgraphs_read_source\",\n\t\t\"Fetch the deployed TypeScript source of a subgraph (plus its stored version). Returns a readOnly payload for subgraphs deployed before source capture — in that case the caller should redeploy via CLI before editing.\",\n\t\t{ name: z.string().describe(\"Subgraph name\") },\n\t\tasync ({ name }) => {\n\t\t\tconst source = await getClient().subgraphs.getSource(name);\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: JSON.stringify(source, null, 2) }],\n\t\t\t};\n\t\t},\n\t);\n}\n"
|
|
13
|
+
"import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { bundleSubgraphCode } from \"@secondlayer/bundler\";\nimport { z } from \"zod/v4\";\nimport { getClient } from \"../lib/client.ts\";\nimport { formatSubgraphSummary, withCap } from \"../lib/format.ts\";\nimport { defineTool } from \"../lib/tool.ts\";\n\nexport function registerSubgraphTools(server: McpServer) {\n\tdefineTool<Record<string, never>>(\n\t\tserver,\n\t\t\"subgraphs_list\",\n\t\t\"List all deployed subgraphs. Returns summary fields only.\",\n\t\t{},\n\t\tasync () => {\n\t\t\tconst { data } = await getClient().subgraphs.list();\n\t\t\treturn {\n\t\t\t\tcontent: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\ttext: JSON.stringify(data.map(formatSubgraphSummary), null, 2),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{ name: string }>(\n\t\tserver,\n\t\t\"subgraphs_get\",\n\t\t\"Get full details of a subgraph including schema, health, and table columns.\",\n\t\t{ name: z.string().describe(\"Subgraph name\") },\n\t\tasync ({ name }) => {\n\t\t\tconst detail = await getClient().subgraphs.get(name);\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: JSON.stringify(detail, null, 2) }],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{\n\t\tname: string;\n\t\ttable: string;\n\t\tfilters?: Record<string, string>;\n\t\tsort?: string;\n\t\torder?: string;\n\t\tlimit?: number;\n\t\toffset?: number;\n\t\tfields?: string;\n\t\tcount?: boolean;\n\t}>(\n\t\tserver,\n\t\t\"subgraphs_query\",\n\t\t'Query rows from a subgraph table (max 200 rows). Filters support operators: \"amount.gte\": \"1000\", \"sender.neq\": \"SP...\", \"name.like\": \"%token%\". Available operators: eq, neq, gt, gte, lt, lte, like.',\n\t\t{\n\t\t\tname: z.string().describe(\"Subgraph name\"),\n\t\t\ttable: z.string().describe(\"Table name\"),\n\t\t\tfilters: z\n\t\t\t\t.record(z.string(), z.string())\n\t\t\t\t.optional()\n\t\t\t\t.describe(\n\t\t\t\t\t'Column filters — plain values or with operators (e.g. {\"amount.gte\": \"1000\", \"sender\": \"SP...\"})',\n\t\t\t\t),\n\t\t\tsort: z.string().optional().describe(\"Column to sort by\"),\n\t\t\torder: z.enum([\"asc\", \"desc\"]).optional().describe(\"Sort order\"),\n\t\t\tlimit: z\n\t\t\t\t.number()\n\t\t\t\t.max(200)\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Max rows (default 50, max 200)\"),\n\t\t\toffset: z.number().optional().describe(\"Offset for pagination\"),\n\t\t\tfields: z\n\t\t\t\t.string()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\n\t\t\t\t\t'Comma-separated column list to return (e.g. \"sender,amount\")',\n\t\t\t\t),\n\t\t\tcount: z\n\t\t\t\t.boolean()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"If true, return row count instead of rows\"),\n\t\t},\n\t\tasync ({\n\t\t\tname,\n\t\t\ttable,\n\t\t\tfilters,\n\t\t\tsort,\n\t\t\torder,\n\t\t\tlimit,\n\t\t\toffset,\n\t\t\tfields,\n\t\t\tcount,\n\t\t}) => {\n\t\t\tif (count) {\n\t\t\t\tconst result = await getClient().subgraphs.queryTableCount(\n\t\t\t\t\tname,\n\t\t\t\t\ttable,\n\t\t\t\t\t{ filters, sort, order },\n\t\t\t\t);\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\", text: JSON.stringify(result, null, 2) }],\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst rows = await getClient().subgraphs.queryTable(name, table, {\n\t\t\t\tfilters,\n\t\t\t\tsort,\n\t\t\t\torder,\n\t\t\t\tlimit: limit ?? 50,\n\t\t\t\toffset,\n\t\t\t\tfields,\n\t\t\t});\n\t\t\tconst cap = limit ?? 50;\n\t\t\tconst result = withCap(\n\t\t\t\trows as Record<string, unknown>[],\n\t\t\t\tcap > 200 ? 200 : cap,\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: JSON.stringify(result, null, 2) }],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{ name: string; fromBlock?: number; toBlock?: number }>(\n\t\tserver,\n\t\t\"subgraphs_reindex\",\n\t\t\"Reindex a subgraph from a specific block range.\",\n\t\t{\n\t\t\tname: z.string().describe(\"Subgraph name\"),\n\t\t\tfromBlock: z\n\t\t\t\t.number()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Start block (defaults to beginning)\"),\n\t\t\ttoBlock: z.number().optional().describe(\"End block (defaults to latest)\"),\n\t\t},\n\t\tasync ({ name, fromBlock, toBlock }) => {\n\t\t\tconst result = await getClient().subgraphs.reindex(name, {\n\t\t\t\tfromBlock,\n\t\t\t\ttoBlock,\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: JSON.stringify(result, null, 2) }],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{ name: string }>(\n\t\tserver,\n\t\t\"subgraphs_delete\",\n\t\t\"Delete a subgraph permanently.\",\n\t\t{ name: z.string().describe(\"Subgraph name\") },\n\t\tasync ({ name }) => {\n\t\t\tconst result = await getClient().subgraphs.delete(name);\n\t\t\treturn { content: [{ type: \"text\", text: result.message }] };\n\t\t},\n\t);\n\n\tdefineTool<{ code: string; reindex?: boolean }>(\n\t\tserver,\n\t\t\"subgraphs_deploy\",\n\t\t\"Deploy a subgraph from TypeScript code. Pass the full defineSubgraph() source — it will be bundled, validated, and deployed.\",\n\t\t{\n\t\t\tcode: z\n\t\t\t\t.string()\n\t\t\t\t.describe(\"TypeScript source code containing a defineSubgraph() call\"),\n\t\t\treindex: z\n\t\t\t\t.boolean()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\n\t\t\t\t\t\"Force reindex on breaking schema change (drops and rebuilds all data)\",\n\t\t\t\t),\n\t\t},\n\t\tasync ({ code, reindex }) => {\n\t\t\tconst bundled = await bundleSubgraphCode(code);\n\t\t\tconst result = await getClient().subgraphs.deploy({\n\t\t\t\tname: bundled.name,\n\t\t\t\tversion: bundled.version,\n\t\t\t\tdescription: bundled.description,\n\t\t\t\tsources: bundled.sources,\n\t\t\t\tschema: bundled.schema,\n\t\t\t\thandlerCode: bundled.handlerCode,\n\t\t\t\tsourceCode: code,\n\t\t\t\treindex,\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: JSON.stringify(result, null, 2) }],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{ name: string }>(\n\t\tserver,\n\t\t\"subgraphs_read_source\",\n\t\t\"Fetch the deployed TypeScript source of a subgraph (plus its stored version). Returns a readOnly payload for subgraphs deployed before source capture — in that case the caller should redeploy via CLI before editing.\",\n\t\t{ name: z.string().describe(\"Subgraph name\") },\n\t\tasync ({ name }) => {\n\t\t\tconst source = await getClient().subgraphs.getSource(name);\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: JSON.stringify(source, null, 2) }],\n\t\t\t};\n\t\t},\n\t);\n}\n",
|
|
14
|
+
"import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { bundleWorkflowCode } from \"@secondlayer/bundler\";\nimport {\n\ttype ScaffoldDeliveryTarget,\n\ttype ScaffoldStepKind,\n\tgenerateWorkflowCode,\n} from \"@secondlayer/scaffold\";\nimport { VersionConflictError } from \"@secondlayer/sdk\";\nimport { createPatch } from \"diff\";\nimport { z } from \"zod/v4\";\nimport { getClient } from \"../lib/client.ts\";\nimport { defineTool } from \"../lib/tool.ts\";\n\nexport function registerWorkflowTools(server: McpServer) {\n\tdefineTool<Record<string, never>>(\n\t\tserver,\n\t\t\"workflows_list\",\n\t\t\"List all workflows. Returns summary fields only.\",\n\t\t{},\n\t\tasync () => {\n\t\t\tconst { workflows } = await getClient().workflows.list();\n\t\t\treturn {\n\t\t\t\tcontent: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\ttext: JSON.stringify(workflows, null, 2),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{ name: string }>(\n\t\tserver,\n\t\t\"workflows_get\",\n\t\t\"Get full details of a workflow by name.\",\n\t\t{ name: z.string().describe(\"Workflow name\") },\n\t\tasync ({ name }) => {\n\t\t\tconst detail = await getClient().workflows.get(name);\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: JSON.stringify(detail, null, 2) }],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{ name: string }>(\n\t\tserver,\n\t\t\"workflows_get_definition\",\n\t\t\"Return the deployed TypeScript source of a workflow plus its stored version. Returns `sourceCode: null` + `readOnly: true` for workflows deployed before source capture.\",\n\t\t{ name: z.string().describe(\"Workflow name\") },\n\t\tasync ({ name }) => {\n\t\t\tconst source = await getClient().workflows.getSource(name);\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: JSON.stringify(source, null, 2) }],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{\n\t\tname: string;\n\t\tproposedCode: string;\n\t\texpectedVersion?: string;\n\t}>(\n\t\tserver,\n\t\t\"workflows_propose_edit\",\n\t\t\"Validate a proposed edit WITHOUT deploying. Fetches the current stored source, bundles the proposed source, computes a unified diff, and returns everything for review. Use this when you want to show the user a diff before committing — pair it with workflows_deploy(expectedVersion=...) to persist.\",\n\t\t{\n\t\t\tname: z.string().describe(\"Workflow name\"),\n\t\t\tproposedCode: z\n\t\t\t\t.string()\n\t\t\t\t.describe(\"New TypeScript source — must compile and validate.\"),\n\t\t\texpectedVersion: z\n\t\t\t\t.string()\n\t\t\t\t.regex(/^\\d+\\.\\d+\\.\\d+$/)\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Version the proposer is editing from (for audit).\"),\n\t\t},\n\t\tasync ({ name, proposedCode, expectedVersion }) => {\n\t\t\tconst current = await getClient().workflows.getSource(name);\n\t\t\tif (current.sourceCode === null) {\n\t\t\t\treturn {\n\t\t\t\t\tisError: true,\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\ttext: JSON.stringify(\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\terror:\n\t\t\t\t\t\t\t\t\t\t\"Workflow has no stored source. Redeploy via CLI first.\",\n\t\t\t\t\t\t\t\t\treadOnly: true,\n\t\t\t\t\t\t\t\t\tversion: current.version,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t\t2,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tlet bundleValid = false;\n\t\t\tlet validation: { name: string; triggerType: string } | { error: string };\n\t\t\tlet bundleSize = 0;\n\t\t\ttry {\n\t\t\t\tconst bundled = await bundleWorkflowCode(proposedCode);\n\t\t\t\tbundleValid = true;\n\t\t\t\tbundleSize = Buffer.byteLength(bundled.handlerCode, \"utf8\");\n\t\t\t\tvalidation = {\n\t\t\t\t\tname: bundled.name,\n\t\t\t\t\ttriggerType: bundled.trigger.type,\n\t\t\t\t};\n\t\t\t} catch (err) {\n\t\t\t\tvalidation = {\n\t\t\t\t\terror: err instanceof Error ? err.message : String(err),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst diffText = createPatch(\n\t\t\t\t`${name}.ts`,\n\t\t\t\tcurrent.sourceCode,\n\t\t\t\tproposedCode,\n\t\t\t\t`v${current.version}`,\n\t\t\t\t\"proposed\",\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tcontent: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\ttext: JSON.stringify(\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcurrentVersion: current.version,\n\t\t\t\t\t\t\t\texpectedVersion,\n\t\t\t\t\t\t\t\tcurrentSource: current.sourceCode,\n\t\t\t\t\t\t\t\tproposedSource: proposedCode,\n\t\t\t\t\t\t\t\tdiffText,\n\t\t\t\t\t\t\t\tbundleValid,\n\t\t\t\t\t\t\t\tvalidation,\n\t\t\t\t\t\t\t\tbundleSize,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t2,\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{\n\t\tname: string;\n\t\trunId: string;\n\t\tlimit?: number;\n\t\ttimeoutMs?: number;\n\t}>(\n\t\tserver,\n\t\t\"workflows_tail_run\",\n\t\t\"Tail a workflow run via SSE and return a compacted log. Resolves as soon as the run completes, `limit` events are collected, or `timeoutMs` elapses (default 60s). MCP is not streaming-first — use this for short-lived follow-ups, not long tails.\",\n\t\t{\n\t\t\tname: z.string().describe(\"Workflow name\"),\n\t\t\trunId: z.string().describe(\"Run id\"),\n\t\t\tlimit: z\n\t\t\t\t.number()\n\t\t\t\t.int()\n\t\t\t\t.positive()\n\t\t\t\t.max(200)\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Max step events to collect (default 50)\"),\n\t\t\ttimeoutMs: z\n\t\t\t\t.number()\n\t\t\t\t.int()\n\t\t\t\t.positive()\n\t\t\t\t.max(5 * 60 * 1000)\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Hard timeout in ms (default 60000, max 300000)\"),\n\t\t},\n\t\tasync ({ name, runId, limit, timeoutMs }) => {\n\t\t\tconst cap = limit ?? 50;\n\t\t\tconst deadline = timeoutMs ?? 60_000;\n\n\t\t\tconst events: Array<Record<string, unknown>> = [];\n\t\t\tlet finalStatus: string | null = null;\n\t\t\tlet stoppedBy: \"done\" | \"limit\" | \"timeout\" = \"timeout\";\n\n\t\t\tconst controller = new AbortController();\n\t\t\tconst timer = setTimeout(() => {\n\t\t\t\tstoppedBy = \"timeout\";\n\t\t\t\tcontroller.abort();\n\t\t\t}, deadline);\n\n\t\t\ttry {\n\t\t\t\tawait getClient().workflows.streamRun(\n\t\t\t\t\tname,\n\t\t\t\t\trunId,\n\t\t\t\t\t(event) => {\n\t\t\t\t\t\tif (event.type === \"step\") {\n\t\t\t\t\t\t\tevents.push(event.step as unknown as Record<string, unknown>);\n\t\t\t\t\t\t\tif (events.length >= cap) {\n\t\t\t\t\t\t\t\tstoppedBy = \"limit\";\n\t\t\t\t\t\t\t\tcontroller.abort();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else if (event.type === \"done\") {\n\t\t\t\t\t\t\tfinalStatus = event.done.status;\n\t\t\t\t\t\t\tstoppedBy = \"done\";\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tcontroller.signal,\n\t\t\t\t);\n\t\t\t} catch (err) {\n\t\t\t\tif (!(err instanceof Error) || err.name !== \"AbortError\") {\n\t\t\t\t\tthrow err;\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tclearTimeout(timer);\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tcontent: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\ttext: JSON.stringify(\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\trunId,\n\t\t\t\t\t\t\t\tfinalStatus,\n\t\t\t\t\t\t\t\tstoppedBy,\n\t\t\t\t\t\t\t\teventCount: events.length,\n\t\t\t\t\t\t\t\tevents,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t2,\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<Record<string, never>>(\n\t\tserver,\n\t\t\"workflows_pause_all\",\n\t\t\"Pause ALL active workflows for the authenticated account. Irreversible only by calling pause/resume per workflow. Returns the list of affected workflows.\",\n\t\t{},\n\t\tasync () => {\n\t\t\tconst result = await getClient().workflows.pauseAll();\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: JSON.stringify(result, null, 2) }],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{ runId: string }>(\n\t\tserver,\n\t\t\"workflows_cancel_run\",\n\t\t\"Cancel an in-flight workflow run. Marks the run as cancelled and removes any pending queue entry. No-ops if the run is already terminal.\",\n\t\t{ runId: z.string().describe(\"Run id to cancel\") },\n\t\tasync ({ runId }) => {\n\t\t\tconst result = await getClient().workflows.cancelRun(runId);\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: JSON.stringify(result, null, 2) }],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{ name: string; toVersion?: string }>(\n\t\tserver,\n\t\t\"workflows_rollback\",\n\t\t\"Roll a workflow back to a prior version. The restored handler is re-published as a NEW version (audit trail), so no history is lost. Pass toVersion to pick a specific bundle; omit to roll back to the immediate previous version on disk. Last 3 versions are retained.\",\n\t\t{\n\t\t\tname: z.string().describe(\"Workflow name\"),\n\t\t\ttoVersion: z\n\t\t\t\t.string()\n\t\t\t\t.regex(/^\\d+\\.\\d+\\.\\d+$/)\n\t\t\t\t.optional()\n\t\t\t\t.describe(\n\t\t\t\t\t\"Target version to restore. Must be one of the retained bundles on disk.\",\n\t\t\t\t),\n\t\t},\n\t\tasync ({ name, toVersion }) => {\n\t\t\tconst result = await getClient().workflows.rollback(name, toVersion);\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: JSON.stringify(result, null, 2) }],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{ name: string }>(\n\t\tserver,\n\t\t\"workflows_delete\",\n\t\t\"Delete a workflow permanently.\",\n\t\t{ name: z.string().describe(\"Workflow name\") },\n\t\tasync ({ name }) => {\n\t\t\tawait getClient().workflows.delete(name);\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: `Deleted workflow \"${name}\"` }],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{ name: string; input?: string }>(\n\t\tserver,\n\t\t\"workflows_trigger\",\n\t\t\"Trigger a workflow run. Optionally pass input as a JSON string.\",\n\t\t{\n\t\t\tname: z.string().describe(\"Workflow name\"),\n\t\t\tinput: z.string().optional().describe(\"Input as JSON string\"),\n\t\t},\n\t\tasync ({ name, input }) => {\n\t\t\tconst parsed = input ? JSON.parse(input) : undefined;\n\t\t\tconst result = await getClient().workflows.trigger(name, parsed);\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: JSON.stringify(result, null, 2) }],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{ name: string }>(\n\t\tserver,\n\t\t\"workflows_pause\",\n\t\t\"Pause a running workflow.\",\n\t\t{ name: z.string().describe(\"Workflow name\") },\n\t\tasync ({ name }) => {\n\t\t\tawait getClient().workflows.pause(name);\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: `Paused workflow \"${name}\"` }],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{ name: string }>(\n\t\tserver,\n\t\t\"workflows_resume\",\n\t\t\"Resume a paused workflow.\",\n\t\t{ name: z.string().describe(\"Workflow name\") },\n\t\tasync ({ name }) => {\n\t\t\tawait getClient().workflows.resume(name);\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: `Resumed workflow \"${name}\"` }],\n\t\t\t};\n\t\t},\n\t);\n\n\tdefineTool<{\n\t\tname: string;\n\t\ttrigger:\n\t\t\t| { type: \"event\"; filterType?: string }\n\t\t\t| { type: \"schedule\"; cron: string; timezone?: string }\n\t\t\t| { type: \"manual\" };\n\t\tsteps: ScaffoldStepKind[];\n\t\tdeliveryTarget?: ScaffoldDeliveryTarget;\n\t}>(\n\t\tserver,\n\t\t\"workflows_scaffold\",\n\t\t\"Generate a compilable defineWorkflow() skeleton from a typed intent. Returns the TypeScript source; pass it to workflows_deploy to persist. Placeholders inside the source must be filled in before running a real workflow.\",\n\t\t{\n\t\t\tname: z\n\t\t\t\t.string()\n\t\t\t\t.regex(/^[a-z][a-z0-9-]*$/)\n\t\t\t\t.describe(\"Workflow name (lowercase, hyphens)\"),\n\t\t\ttrigger: z\n\t\t\t\t.discriminatedUnion(\"type\", [\n\t\t\t\t\tz.object({\n\t\t\t\t\t\ttype: z.literal(\"event\"),\n\t\t\t\t\t\tfilterType: z.string().optional(),\n\t\t\t\t\t}),\n\t\t\t\t\tz.object({\n\t\t\t\t\t\ttype: z.literal(\"schedule\"),\n\t\t\t\t\t\tcron: z.string().min(1),\n\t\t\t\t\t\ttimezone: z.string().optional(),\n\t\t\t\t\t}),\n\t\t\t\t\tz.object({ type: z.literal(\"manual\") }),\n\t\t\t\t])\n\t\t\t\t.describe(\"Trigger shape\"),\n\t\t\tsteps: z\n\t\t\t\t.array(z.enum([\"run\", \"query\", \"ai\", \"deliver\"]))\n\t\t\t\t.describe(\"Ordered list of step kinds to include in the handler\"),\n\t\t\tdeliveryTarget: z\n\t\t\t\t.enum([\"webhook\", \"slack\", \"email\", \"discord\", \"telegram\"])\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Delivery target used when steps includes `deliver`\"),\n\t\t},\n\t\tasync ({ name, trigger, steps, deliveryTarget }) => {\n\t\t\tconst code = generateWorkflowCode({\n\t\t\t\tname,\n\t\t\t\ttrigger,\n\t\t\t\tsteps,\n\t\t\t\tdeliveryTarget,\n\t\t\t});\n\t\t\treturn { content: [{ type: \"text\", text: code }] };\n\t\t},\n\t);\n\n\tdefineTool<{ code: string; expectedVersion?: string; dryRun?: boolean }>(\n\t\tserver,\n\t\t\"workflows_deploy\",\n\t\t\"Deploy a workflow from TypeScript source. Pass the full defineWorkflow() source — it will be bundled, validated, and deployed. Use expectedVersion for optimistic concurrency, or dryRun to validate without persisting.\",\n\t\t{\n\t\t\tcode: z\n\t\t\t\t.string()\n\t\t\t\t.describe(\"TypeScript source code containing a defineWorkflow() call\"),\n\t\t\texpectedVersion: z\n\t\t\t\t.string()\n\t\t\t\t.regex(/^\\d+\\.\\d+\\.\\d+$/)\n\t\t\t\t.optional()\n\t\t\t\t.describe(\n\t\t\t\t\t\"Stored version the client expects (major.minor.patch). Server returns 409 on mismatch.\",\n\t\t\t\t),\n\t\t\tdryRun: z\n\t\t\t\t.boolean()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"If true, validate and bundle only — do not persist.\"),\n\t\t},\n\t\tasync ({ code, expectedVersion, dryRun }) => {\n\t\t\tlet bundled: Awaited<ReturnType<typeof bundleWorkflowCode>>;\n\t\t\ttry {\n\t\t\t\tbundled = await bundleWorkflowCode(code);\n\t\t\t} catch (err) {\n\t\t\t\treturn {\n\t\t\t\t\tisError: true,\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\ttext: err instanceof Error ? err.message : String(err),\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst base = {\n\t\t\t\tname: bundled.name,\n\t\t\t\ttrigger: bundled.trigger as unknown as Record<string, unknown>,\n\t\t\t\thandlerCode: bundled.handlerCode,\n\t\t\t\tsourceCode: bundled.sourceCode,\n\t\t\t\tretries: bundled.retries as Record<string, unknown> | undefined,\n\t\t\t\ttimeout: bundled.timeout,\n\t\t\t\texpectedVersion,\n\t\t\t};\n\t\t\ttry {\n\t\t\t\tconst result = dryRun\n\t\t\t\t\t? await getClient().workflows.deploy({ ...base, dryRun: true })\n\t\t\t\t\t: await getClient().workflows.deploy(base);\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\", text: JSON.stringify(result, null, 2) }],\n\t\t\t\t};\n\t\t\t} catch (err) {\n\t\t\t\tif (err instanceof VersionConflictError) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tisError: true,\n\t\t\t\t\t\tcontent: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\t\ttext: JSON.stringify(\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\terror: err.message,\n\t\t\t\t\t\t\t\t\t\tcode: \"VERSION_CONFLICT\",\n\t\t\t\t\t\t\t\t\t\tcurrentVersion: err.currentVersion,\n\t\t\t\t\t\t\t\t\t\texpectedVersion: err.expectedVersion,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t\t\t2,\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t},\n\t);\n\n\tdefineTool<{ name: string; status?: string; limit?: number }>(\n\t\tserver,\n\t\t\"workflows_runs\",\n\t\t\"List runs for a workflow. Optionally filter by status and limit results.\",\n\t\t{\n\t\t\tname: z.string().describe(\"Workflow name\"),\n\t\t\tstatus: z\n\t\t\t\t.enum([\"running\", \"completed\", \"failed\", \"cancelled\"])\n\t\t\t\t.optional()\n\t\t\t\t.describe(\"Filter by run status\"),\n\t\t\tlimit: z.number().optional().describe(\"Max runs to return (default 20)\"),\n\t\t},\n\t\tasync ({ name, status, limit }) => {\n\t\t\tconst { runs } = await getClient().workflows.listRuns(name, {\n\t\t\t\tstatus: status as\n\t\t\t\t\t| \"running\"\n\t\t\t\t\t| \"completed\"\n\t\t\t\t\t| \"failed\"\n\t\t\t\t\t| \"cancelled\"\n\t\t\t\t\t| undefined,\n\t\t\t\tlimit,\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tcontent: [\n\t\t\t\t\t{\n\t\t\t\t\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