@secondlayer/mcp 3.8.0 → 3.10.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 +6 -2
- package/dist/bin-http.js +252 -217
- package/dist/bin-http.js.map +10 -11
- package/dist/bin.js +252 -217
- package/dist/bin.js.map +10 -11
- package/dist/index.js +252 -217
- package/dist/index.js.map +10 -11
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -10,21 +10,49 @@ import { TRAIT_STANDARDS } from "@secondlayer/stacks/clarity";
|
|
|
10
10
|
import { TYPE_MAP } from "@secondlayer/subgraphs/schema";
|
|
11
11
|
|
|
12
12
|
// src/lib/client.ts
|
|
13
|
-
import { SecondLayer } from "@secondlayer/sdk";
|
|
13
|
+
import { SecondLayer, readX402Receipt, withX402 } from "@secondlayer/sdk";
|
|
14
|
+
import { privateKeyToAccount } from "@secondlayer/stacks/accounts";
|
|
14
15
|
var instance = null;
|
|
15
16
|
function readApiKey() {
|
|
16
17
|
return process.env.SL_API_KEY;
|
|
17
18
|
}
|
|
19
|
+
function buildFetchImpl() {
|
|
20
|
+
const key = process.env.X402_PRIVATE_KEY;
|
|
21
|
+
if (!key)
|
|
22
|
+
return;
|
|
23
|
+
const account = privateKeyToAccount(key);
|
|
24
|
+
const topUpUsd = Number(process.env.X402_TOPUP_USD ?? "");
|
|
25
|
+
const paid = withX402(fetch, {
|
|
26
|
+
account,
|
|
27
|
+
...Number.isFinite(topUpUsd) && topUpUsd > 0 ? {
|
|
28
|
+
topUp: {
|
|
29
|
+
usd: topUpUsd,
|
|
30
|
+
whenBelow: Number(process.env.X402_TOPUP_WHEN_BELOW ?? "0.5")
|
|
31
|
+
}
|
|
32
|
+
} : {}
|
|
33
|
+
});
|
|
34
|
+
const wrapped = async (input, init) => {
|
|
35
|
+
const res = await paid(input, init);
|
|
36
|
+
const receipt = readX402Receipt(res);
|
|
37
|
+
if (receipt) {
|
|
38
|
+
console.error(`[x402] paid call settled tier=${receipt.state ?? "confirmed"} txid=${receipt.txid}`);
|
|
39
|
+
}
|
|
40
|
+
return res;
|
|
41
|
+
};
|
|
42
|
+
return wrapped;
|
|
43
|
+
}
|
|
18
44
|
function getClient() {
|
|
19
45
|
if (!instance) {
|
|
20
46
|
const apiKey = readApiKey();
|
|
21
47
|
const baseUrl = process.env.SECONDLAYER_API_URL;
|
|
22
48
|
const dumpsBaseUrl = process.env.SL_STREAMS_DUMPS_URL;
|
|
49
|
+
const fetchImpl = buildFetchImpl();
|
|
23
50
|
instance = new SecondLayer({
|
|
24
51
|
...apiKey ? { apiKey } : {},
|
|
25
52
|
origin: "mcp",
|
|
26
53
|
...baseUrl ? { baseUrl } : {},
|
|
27
|
-
...dumpsBaseUrl ? { dumpsBaseUrl } : {}
|
|
54
|
+
...dumpsBaseUrl ? { dumpsBaseUrl } : {},
|
|
55
|
+
...fetchImpl ? { fetchImpl } : {}
|
|
28
56
|
});
|
|
29
57
|
}
|
|
30
58
|
return instance;
|
|
@@ -53,11 +81,14 @@ async function apiRequest(method, path, body) {
|
|
|
53
81
|
|
|
54
82
|
// src/lib/format.ts
|
|
55
83
|
function formatSubgraphSummary(s) {
|
|
84
|
+
const apiUrl = process.env.SECONDLAYER_API_URL || "https://api.secondlayer.tools";
|
|
56
85
|
return {
|
|
57
86
|
name: s.name,
|
|
58
87
|
status: s.status,
|
|
59
88
|
tables: Array.isArray(s.tables) ? s.tables : Object.keys(s.tables),
|
|
60
|
-
lastProcessedBlock: s.lastProcessedBlock
|
|
89
|
+
lastProcessedBlock: s.lastProcessedBlock,
|
|
90
|
+
...s.visibility ? { visibility: s.visibility } : {},
|
|
91
|
+
...s.visibility === "public" ? { publicUrl: `${apiUrl}/v1/subgraphs/${s.name}` } : {}
|
|
61
92
|
};
|
|
62
93
|
}
|
|
63
94
|
function withCap(items, cap) {
|
|
@@ -162,7 +193,6 @@ var COLUMN_TYPES = [
|
|
|
162
193
|
}
|
|
163
194
|
];
|
|
164
195
|
var PRODUCT_BLURBS = {
|
|
165
|
-
datasets: "public foundation datasets",
|
|
166
196
|
index: "decoded L2 events, contract calls, blocks, transactions, stacking, mempool",
|
|
167
197
|
streams: "raw canonical chain event firehose",
|
|
168
198
|
contracts: "trait-based contract discovery",
|
|
@@ -173,7 +203,6 @@ var PRODUCT_BLURBS = {
|
|
|
173
203
|
scaffold: "generate typed contract clients from a deployment or ABI"
|
|
174
204
|
};
|
|
175
205
|
var PRODUCT_ORDER = [
|
|
176
|
-
"datasets",
|
|
177
206
|
"index",
|
|
178
207
|
"streams",
|
|
179
208
|
"contracts",
|
|
@@ -202,21 +231,30 @@ function buildCapabilities() {
|
|
|
202
231
|
});
|
|
203
232
|
return {
|
|
204
233
|
products,
|
|
205
|
-
discoverFirst: "Call
|
|
234
|
+
discoverFirst: "Call index_discover / contracts_find to learn what exists (and which filters each surface accepts) before querying."
|
|
206
235
|
};
|
|
207
236
|
}
|
|
237
|
+
var X402_CAPABILITY = {
|
|
238
|
+
what: "Index and Streams reads (/v1/index/*, /v1/streams/*) accept x402 v2 pay-per-call (network stacks:1, sponsored transfers — the payer holds sBTC/STX/USDCx, never gas). Index grants 1,000 free reads/day/IP before any 402; a paid Streams call opens a 500-call/1h PAYMENT-SESSION.",
|
|
239
|
+
paidWrites: "POST /v1/subgraphs (x402 $2) deploys a subgraph owned by the paying wallet — live from deploy, 7-day TTL, renewable via POST /v1/subgraphs/{name}/renew ($0.50/wk); claiming the account clears the expiry.",
|
|
240
|
+
prepaid: "POST /v1/x402/deposit?usd=N loads a prepaid tab (PAYMENT-BALANCE token, $0.25 min) — calls debit it instantly, no per-call on-chain settle. GET /v1/x402/balance reads it.",
|
|
241
|
+
discovery: "GET /v1/x402/supported on the API host for scheme, assets, prices, quotas, sessions, and prepaid metadata.",
|
|
242
|
+
autopay: "Set X402_PRIVATE_KEY (a Stacks private key holding an accepted token) and this MCP server pays 402 challenges automatically (sessions replayed). Add X402_TOPUP_USD (and optionally X402_TOPUP_WHEN_BELOW) for an autonomous prepaid tab that refills itself. Receipts are logged per paid call."
|
|
243
|
+
};
|
|
208
244
|
var READ_AUTH_TIERS = {
|
|
209
|
-
datasets: "open — no API key required",
|
|
210
245
|
index: "anonymous reads allowed; free-tier API keys are rejected (Build+ required)",
|
|
211
246
|
streams: "API key required (SL_API_KEY) — keyless calls return 401",
|
|
212
|
-
subgraphs: "
|
|
247
|
+
subgraphs: "public subgraphs anon-readable at /v1/subgraphs/<name>/<table> ({ rows, next_cursor, tip } cursor envelope); private subgraphs need the owning account's API key (anon → 404); writes require an API key"
|
|
213
248
|
};
|
|
214
249
|
async function buildContext(deps = { clientProvider: getClient }) {
|
|
215
250
|
const unavailable = "unavailable: set SL_API_KEY";
|
|
216
251
|
const orNull = (v) => v == null ? unavailable : v;
|
|
217
252
|
const snap = await deps.clientProvider().context().catch(() => null);
|
|
218
253
|
return {
|
|
219
|
-
authState: {
|
|
254
|
+
authState: {
|
|
255
|
+
apiKeySet: Boolean(process.env.SL_API_KEY),
|
|
256
|
+
x402WalletSet: Boolean(process.env.X402_PRIVATE_KEY)
|
|
257
|
+
},
|
|
220
258
|
whatExists: {
|
|
221
259
|
account: orNull(snap?.account),
|
|
222
260
|
streamsTip: orNull(snap?.streamsTip),
|
|
@@ -228,7 +266,8 @@ async function buildContext(deps = { clientProvider: getClient }) {
|
|
|
228
266
|
activeOperations: orNull(snap?.activeOperations)
|
|
229
267
|
},
|
|
230
268
|
whatYouCanDo: buildCapabilities(),
|
|
231
|
-
readAuthTiers: READ_AUTH_TIERS
|
|
269
|
+
readAuthTiers: READ_AUTH_TIERS,
|
|
270
|
+
payPerCall: X402_CAPABILITY
|
|
232
271
|
};
|
|
233
272
|
}
|
|
234
273
|
function registerResources(server) {
|
|
@@ -416,43 +455,20 @@ function registerContractTools(server, clientProvider = getClient) {
|
|
|
416
455
|
});
|
|
417
456
|
}
|
|
418
457
|
|
|
419
|
-
// src/tools/datasets.ts
|
|
420
|
-
import { z as z3 } from "zod/v4";
|
|
421
|
-
function registerDatasetTools(server, clientProvider = getClient) {
|
|
422
|
-
defineTool(server, "datasets_list", "List the Foundation Datasets catalog with freshness — the discovery endpoint for what dataset slugs exist and how current each is. Reads are public.", {}, async () => {
|
|
423
|
-
const catalog = await clientProvider().datasets.listDatasets();
|
|
424
|
-
return jsonResponse(catalog);
|
|
425
|
-
});
|
|
426
|
-
defineTool(server, "datasets_query", 'Query ANY Foundation Dataset by slug — every family returned by datasets_list is queryable, including bespoke ones (bns/resolve with {"fqn":"alice.btc"}, bns/names, bns/namespaces, network-health/summary) and any dataset added later. Accepts family ("sbtc-events") or path ("sbtc/events") slug forms. Filters are passed through as documented query params (e.g. {"sender": "SP...", "from_block": "150000"}). Returns { rows, next_cursor, tip }; single-record datasets like bns/resolve return 0-or-1 rows (empty = not found). Call datasets_list first to discover slugs and their filters.', {
|
|
427
|
-
slug: z3.string().describe("Dataset slug from datasets_list (e.g. stx-transfers)"),
|
|
428
|
-
filters: z3.record(z3.string(), z3.string()).optional().describe("Documented per-dataset query params (snake_case values)"),
|
|
429
|
-
limit: z3.number().optional().describe("Max rows for this page"),
|
|
430
|
-
cursor: z3.string().optional().describe("Opaque cursor from a prior response's next_cursor")
|
|
431
|
-
}, async ({ slug, filters, limit, cursor }) => {
|
|
432
|
-
const params = { ...filters ?? {} };
|
|
433
|
-
if (limit !== undefined)
|
|
434
|
-
params.limit = limit;
|
|
435
|
-
if (cursor !== undefined)
|
|
436
|
-
params.cursor = cursor;
|
|
437
|
-
const result = await clientProvider().datasets.get(slug, params);
|
|
438
|
-
return jsonResponse(result);
|
|
439
|
-
});
|
|
440
|
-
}
|
|
441
|
-
|
|
442
458
|
// src/tools/index.ts
|
|
443
459
|
import { DECODED_EVENT_TYPES as DECODED_EVENT_TYPES2 } from "@secondlayer/shared";
|
|
444
460
|
import {
|
|
445
461
|
INDEX_CODEGEN_TABLES,
|
|
446
462
|
generateIndexSchema
|
|
447
463
|
} from "@secondlayer/subgraphs";
|
|
448
|
-
import { z as
|
|
464
|
+
import { z as z3 } from "zod/v4";
|
|
449
465
|
var INDEX_EVENT_TYPES = DECODED_EVENT_TYPES2;
|
|
450
466
|
var rangeFilters = {
|
|
451
|
-
contractId:
|
|
452
|
-
fromHeight:
|
|
453
|
-
toHeight:
|
|
454
|
-
cursor:
|
|
455
|
-
limit:
|
|
467
|
+
contractId: z3.string().optional().describe("Filter by contract id"),
|
|
468
|
+
fromHeight: z3.number().optional().describe("Start block height (inclusive)"),
|
|
469
|
+
toHeight: z3.number().optional().describe("End block height (inclusive)"),
|
|
470
|
+
cursor: z3.string().optional().describe("Opaque cursor from a prior response's next_cursor"),
|
|
471
|
+
limit: z3.number().optional().describe("Max rows for this page")
|
|
456
472
|
};
|
|
457
473
|
var heightFilters = {
|
|
458
474
|
fromHeight: rangeFilters.fromHeight,
|
|
@@ -464,89 +480,95 @@ var notFound = (message) => jsonResponse({ error: { type: "not_found", status: 4
|
|
|
464
480
|
function registerIndexTools(server, clientProvider = getClient) {
|
|
465
481
|
defineTool(server, "index_ft_transfers", "List decoded SIP-010 fungible-token transfers from the Index (L2 decoded layer). Anonymous reads allowed (free-tier API keys are rejected — Build+ required).", {
|
|
466
482
|
...rangeFilters,
|
|
467
|
-
sender:
|
|
468
|
-
recipient:
|
|
483
|
+
sender: z3.string().optional().describe("Filter by sender principal"),
|
|
484
|
+
recipient: z3.string().optional().describe("Filter by recipient principal")
|
|
469
485
|
}, async (params) => jsonResponse(await clientProvider().index.ftTransfers.list(params)));
|
|
470
486
|
defineTool(server, "index_nft_transfers", "List decoded SIP-009 non-fungible-token transfers from the Index. Anonymous reads allowed (free-tier keys rejected).", {
|
|
471
487
|
...rangeFilters,
|
|
472
|
-
sender:
|
|
473
|
-
recipient:
|
|
474
|
-
assetIdentifier:
|
|
488
|
+
sender: z3.string().optional().describe("Filter by sender principal"),
|
|
489
|
+
recipient: z3.string().optional().describe("Filter by recipient principal"),
|
|
490
|
+
assetIdentifier: z3.string().optional().describe("Filter by asset identifier (contract::asset)")
|
|
475
491
|
}, async (params) => jsonResponse(await clientProvider().index.nftTransfers.list(params)));
|
|
476
492
|
defineTool(server, "index_events", "List decoded chain events from the Index by event type. Use this for event types without a dedicated tool (stx_*, ft_mint/burn, nft_mint/burn, print), and for trait-scoped queries: set `trait` (e.g. sip-010) to match all contracts conforming to a standard — pair with contracts_find to discover traits. For ft/nft transfers without a trait prefer index_ft_transfers / index_nft_transfers.", {
|
|
477
|
-
eventType:
|
|
493
|
+
eventType: z3.enum(INDEX_EVENT_TYPES).describe("Required. Decoded event type to list."),
|
|
478
494
|
...rangeFilters,
|
|
479
|
-
sender:
|
|
480
|
-
recipient:
|
|
481
|
-
assetIdentifier:
|
|
482
|
-
trait:
|
|
495
|
+
sender: z3.string().optional().describe("Filter by sender principal"),
|
|
496
|
+
recipient: z3.string().optional().describe("Filter by recipient principal"),
|
|
497
|
+
assetIdentifier: z3.string().optional().describe("Filter by asset identifier where applicable"),
|
|
498
|
+
trait: z3.string().optional().describe("Match contracts conforming to a trait/standard (e.g. sip-010). Mutually exclusive with contractId; contract-keyed event types only.")
|
|
483
499
|
}, async (params) => jsonResponse(await clientProvider().index.events.list(params)));
|
|
484
500
|
defineTool(server, "index_contract_calls", "List decoded contract calls from the Index (function name, args, result). Set `trait` (e.g. sip-010) to match calls to all contracts conforming to a standard. Note: contract-call cursors are a SEPARATE keyspace from event cursors — they are not interchangeable.", {
|
|
485
501
|
...rangeFilters,
|
|
486
|
-
functionName:
|
|
487
|
-
sender:
|
|
488
|
-
trait:
|
|
502
|
+
functionName: z3.string().optional().describe("Filter by called function name"),
|
|
503
|
+
sender: z3.string().optional().describe("Filter by caller principal"),
|
|
504
|
+
trait: z3.string().optional().describe("Match contracts conforming to a trait/standard (e.g. sip-010). Mutually exclusive with contractId.")
|
|
489
505
|
}, async (params) => jsonResponse(await clientProvider().index.contractCalls.list(params)));
|
|
490
506
|
defineTool(server, "index_canonical", "List the canonical Stacks block sequence from the Index (height + hash). Anonymous reads allowed (free-tier keys rejected).", { ...heightFilters }, async (params) => jsonResponse(await clientProvider().index.canonical.list(params)));
|
|
491
507
|
defineTool(server, "index_blocks", "List decoded blocks from the Index. Anonymous reads allowed (free-tier keys rejected).", { ...heightFilters }, async (params) => jsonResponse(await clientProvider().index.blocks.list(params)));
|
|
492
508
|
defineTool(server, "index_block", "Get a single block from the Index by height or block hash. Returns not_found if unknown.", {
|
|
493
|
-
ref:
|
|
509
|
+
ref: z3.string().describe("Block height (digits) or block hash (0x… string)")
|
|
494
510
|
}, async ({ ref }) => {
|
|
495
511
|
const block = await clientProvider().index.blocks.get(/^\d+$/.test(ref) ? Number(ref) : ref);
|
|
496
512
|
return block ? jsonResponse(block) : notFound(`No block for ref ${ref}`);
|
|
497
513
|
});
|
|
498
514
|
defineTool(server, "index_transactions", "List decoded transactions from the Index. Filter by type, sender, or contract. Anonymous reads allowed (free-tier keys rejected).", {
|
|
499
515
|
...rangeFilters,
|
|
500
|
-
type:
|
|
501
|
-
sender:
|
|
516
|
+
type: z3.string().optional().describe("Filter by transaction type"),
|
|
517
|
+
sender: z3.string().optional().describe("Filter by sender principal")
|
|
502
518
|
}, async (params) => jsonResponse(await clientProvider().index.transactions.list(params)));
|
|
503
|
-
defineTool(server, "index_transaction", "Get a single transaction from the Index by tx_id. Returns not_found if unknown.", { txId:
|
|
519
|
+
defineTool(server, "index_transaction", "Get a single transaction from the Index by tx_id. Returns not_found if unknown.", { txId: z3.string().describe("Transaction id (0x… hash)") }, async ({ txId }) => {
|
|
504
520
|
const tx = await clientProvider().index.transactions.get(txId);
|
|
505
521
|
return tx ? jsonResponse(tx) : notFound(`No transaction for ${txId}`);
|
|
506
522
|
});
|
|
507
|
-
defineTool(server, "index_transaction_proof", "Fetch a transaction's inclusion proof (raw tx + signed Nakamoto block header + merkle path) so it can be verified trustlessly client-side with the SDK's verifyTransactionProof. Returns not_found if the tx/block is unknown; a 503 means the proof can't be assembled on this deployment right now (PROOF_TX_SET_INCOMPLETE, or PROOF_NODE_UNAVAILABLE when the stacks-node header source isn't configured).", { txId:
|
|
523
|
+
defineTool(server, "index_transaction_proof", "Fetch a transaction's inclusion proof (raw tx + signed Nakamoto block header + merkle path) so it can be verified trustlessly client-side with the SDK's verifyTransactionProof. Returns not_found if the tx/block is unknown; a 503 means the proof can't be assembled on this deployment right now (PROOF_TX_SET_INCOMPLETE, or PROOF_NODE_UNAVAILABLE when the stacks-node header source isn't configured).", { txId: z3.string().describe("Transaction id (0x… hash)") }, async ({ txId }) => {
|
|
508
524
|
const proof = await clientProvider().index.transactions.getProof(txId);
|
|
509
525
|
return proof ? jsonResponse(proof) : notFound(`No proof available for ${txId}`);
|
|
510
526
|
});
|
|
511
527
|
defineTool(server, "index_stacking", "List decoded PoX-4 stacking actions from the Index (stack-stx, delegate-stx, etc.). Anonymous reads allowed (free-tier keys rejected).", {
|
|
512
528
|
...heightFilters,
|
|
513
|
-
functionName:
|
|
514
|
-
stacker:
|
|
515
|
-
caller:
|
|
529
|
+
functionName: z3.string().optional().describe("Filter by PoX function name"),
|
|
530
|
+
stacker: z3.string().optional().describe("Filter by stacker principal"),
|
|
531
|
+
caller: z3.string().optional().describe("Filter by caller principal")
|
|
516
532
|
}, async (params) => jsonResponse(await clientProvider().index.stacking.list(params)));
|
|
517
533
|
defineTool(server, "index_mempool", "List pending (unconfirmed) transactions from the Index mempool. Sequence-cursor paginated (no height range). Anonymous reads allowed (free-tier keys rejected).", {
|
|
518
|
-
sender:
|
|
519
|
-
type:
|
|
520
|
-
contractId:
|
|
521
|
-
cursor:
|
|
522
|
-
limit:
|
|
534
|
+
sender: z3.string().optional().describe("Filter by sender principal"),
|
|
535
|
+
type: z3.string().optional().describe("Filter by transaction type"),
|
|
536
|
+
contractId: z3.string().optional().describe("Filter to pending calls to a single contract"),
|
|
537
|
+
cursor: z3.string().optional().describe("Opaque cursor from a prior response's next_cursor"),
|
|
538
|
+
limit: z3.number().optional().describe("Max rows for this page")
|
|
523
539
|
}, async (params) => jsonResponse(await clientProvider().index.mempool.list(params)));
|
|
524
|
-
defineTool(server, "index_mempool_tx", "Get a single pending transaction from the Index mempool by tx_id. Returns not_found once it is mined or dropped.", { txId:
|
|
540
|
+
defineTool(server, "index_mempool_tx", "Get a single pending transaction from the Index mempool by tx_id. Returns not_found once it is mined or dropped.", { txId: z3.string().describe("Transaction id (0x… hash)") }, async ({ txId }) => {
|
|
525
541
|
const tx = await clientProvider().index.mempool.get(txId);
|
|
526
542
|
return tx ? jsonResponse(tx) : notFound(`No pending tx for ${txId}`);
|
|
527
543
|
});
|
|
528
544
|
defineTool(server, "index_discover", "Discover the Index vocabulary: every event type and its columns, allowed/equality filters, and required-non-null fields (and which types accept `trait`). Read this before building Index queries instead of guessing filters. Anonymous read.", {}, async () => jsonResponse(await clientProvider().index.discover()));
|
|
529
545
|
defineTool(server, "index_usage", "Your own Index consumption (decoded events today + this month) and tier limits. Requires a Build+ API key (anonymous reads can't report usage).", {}, async () => jsonResponse(await clientProvider().index.usage()));
|
|
530
546
|
defineTool(server, "index_codegen", `Generate a typed schema (Prisma, Kysely, Drizzle, or JSON-Schema) for the public Index domain tables so they can be mirrored into a BYO database with full types. Returns the schema as text. Tables: ${INDEX_CODEGEN_TABLES.join(", ")}.`, {
|
|
531
|
-
target:
|
|
532
|
-
tables:
|
|
533
|
-
schemaName:
|
|
547
|
+
target: z3.enum(["prisma", "kysely", "drizzle", "json-schema"]).optional().describe("Output target (default kysely)"),
|
|
548
|
+
tables: z3.array(z3.string()).optional().describe("Subset of Index tables (default: all)"),
|
|
549
|
+
schemaName: z3.string().optional().describe("Postgres schema to qualify table names with")
|
|
534
550
|
}, async ({ target = "kysely", tables, schemaName }) => {
|
|
535
551
|
const out = generateIndexSchema(target, { tables, schemaName });
|
|
536
552
|
return { content: [{ type: "text", text: out }] };
|
|
537
553
|
});
|
|
554
|
+
defineTool(server, "batch_query", "Run up to 10 public /v1 reads in one round trip (POST /v1/batch). Each item keeps its own auth/quota/pay-per-call semantics; results return in order with per-item status. Paths must start with /v1/index, /v1/subgraphs, /v1/streams, or /v1/contracts.", {
|
|
555
|
+
requests: z3.array(z3.object({
|
|
556
|
+
path: z3.string().describe("Public /v1 read path"),
|
|
557
|
+
params: z3.record(z3.string(), z3.string()).optional()
|
|
558
|
+
})).min(1).max(10).describe("Read descriptors, executed concurrently")
|
|
559
|
+
}, async (params) => jsonResponse(await clientProvider().batch(params.requests)));
|
|
538
560
|
}
|
|
539
561
|
|
|
540
562
|
// src/tools/projects.ts
|
|
541
|
-
import { z as
|
|
563
|
+
import { z as z4 } from "zod/v4";
|
|
542
564
|
function registerProjectTools(server, clientProvider = getClient) {
|
|
543
565
|
defineTool(server, "project_list", "List the account's projects. Requires an account-level (owner) API key.", {}, async () => jsonResponse(await clientProvider().projects.list()));
|
|
544
|
-
defineTool(server, "project_get", "Get a single project by slug.", { slug:
|
|
566
|
+
defineTool(server, "project_get", "Get a single project by slug.", { slug: z4.string().describe("Project slug") }, async ({ slug }) => jsonResponse(await clientProvider().projects.get(slug)));
|
|
545
567
|
defineTool(server, "project_create", "Create a project. The slug is derived from the name when omitted. Requires an account-level (owner) API key.", {
|
|
546
|
-
name:
|
|
547
|
-
slug:
|
|
548
|
-
network:
|
|
549
|
-
nodeRpc:
|
|
568
|
+
name: z4.string().describe("Project name"),
|
|
569
|
+
slug: z4.string().optional().describe("URL slug (auto-derived from name if omitted)"),
|
|
570
|
+
network: z4.string().optional().describe("Network (e.g. mainnet, testnet)"),
|
|
571
|
+
nodeRpc: z4.string().optional().describe("Custom node RPC URL")
|
|
550
572
|
}, async ({ name, slug, network, nodeRpc }) => jsonResponse(await clientProvider().projects.create({
|
|
551
573
|
name,
|
|
552
574
|
slug,
|
|
@@ -554,12 +576,12 @@ function registerProjectTools(server, clientProvider = getClient) {
|
|
|
554
576
|
nodeRpc
|
|
555
577
|
})));
|
|
556
578
|
defineTool(server, "project_update", "Update a project. `slug` selects the project; `newSlug` renames it. Requires an account-level (owner) API key.", {
|
|
557
|
-
slug:
|
|
558
|
-
newSlug:
|
|
559
|
-
name:
|
|
560
|
-
network:
|
|
561
|
-
nodeRpc:
|
|
562
|
-
settings:
|
|
579
|
+
slug: z4.string().describe("Slug of the project to update"),
|
|
580
|
+
newSlug: z4.string().optional().describe("New slug (renames the project)"),
|
|
581
|
+
name: z4.string().optional().describe("New display name"),
|
|
582
|
+
network: z4.string().optional().describe("Network (e.g. mainnet, testnet)"),
|
|
583
|
+
nodeRpc: z4.string().optional().describe("Custom node RPC URL"),
|
|
584
|
+
settings: z4.record(z4.string(), z4.unknown()).optional().describe("Arbitrary project settings to merge")
|
|
563
585
|
}, async ({ slug, newSlug, name, network, nodeRpc, settings }) => jsonResponse(await clientProvider().projects.update(slug, {
|
|
564
586
|
...newSlug !== undefined ? { slug: newSlug } : {},
|
|
565
587
|
...name !== undefined ? { name } : {},
|
|
@@ -567,8 +589,8 @@ function registerProjectTools(server, clientProvider = getClient) {
|
|
|
567
589
|
...nodeRpc !== undefined ? { nodeRpc } : {},
|
|
568
590
|
...settings !== undefined ? { settings } : {}
|
|
569
591
|
})));
|
|
570
|
-
defineTool(server, "project_delete", "Delete a project permanently. The account's last remaining project cannot be deleted.", { slug:
|
|
571
|
-
defineTool(server, "project_team_list", "List a project's team members and pending invitations.", { slug:
|
|
592
|
+
defineTool(server, "project_delete", "Delete a project permanently. The account's last remaining project cannot be deleted.", { slug: z4.string().describe("Project slug") }, async ({ slug }) => jsonResponse(await clientProvider().projects.delete(slug)));
|
|
593
|
+
defineTool(server, "project_team_list", "List a project's team members and pending invitations.", { slug: z4.string().describe("Project slug") }, async ({ slug }) => jsonResponse(await clientProvider().projects.team(slug)));
|
|
572
594
|
}
|
|
573
595
|
|
|
574
596
|
// src/tools/scaffold.ts
|
|
@@ -577,7 +599,7 @@ import {
|
|
|
577
599
|
generateTraitSubgraph
|
|
578
600
|
} from "@secondlayer/scaffold";
|
|
579
601
|
import { TRAIT_STANDARDS as TRAIT_STANDARDS2 } from "@secondlayer/stacks/clarity";
|
|
580
|
-
import { z as
|
|
602
|
+
import { z as z5 } from "zod/v4";
|
|
581
603
|
async function fetchAbi(contractId) {
|
|
582
604
|
const contract = await getClient().contracts.get(contractId, {
|
|
583
605
|
includeAbi: true
|
|
@@ -592,24 +614,24 @@ async function fetchAbi(contractId) {
|
|
|
592
614
|
}
|
|
593
615
|
function registerScaffoldTools(server) {
|
|
594
616
|
defineTool(server, "scaffold_from_trait", "Generate a deploy-ready subgraph scaffold that indexes EVERY contract conforming to a SIP trait (no specific contract needed) — sip-009 → an nft_transfer source, sip-010/sip-013 → ft_transfer. Use scaffold_from_contract/abi instead when targeting one contract. See the secondlayer://traits resource for valid trait ids.", {
|
|
595
|
-
trait:
|
|
596
|
-
subgraphName:
|
|
617
|
+
trait: z5.enum(TRAIT_STANDARDS2).describe("SIP standard to index (sip-009 | sip-010 | sip-013)"),
|
|
618
|
+
subgraphName: z5.string().optional().describe("Override the subgraph name (defaults to <trait>-transfers)")
|
|
597
619
|
}, async ({ trait, subgraphName }) => {
|
|
598
620
|
const code = generateTraitSubgraph({ trait, name: subgraphName });
|
|
599
621
|
return { content: [{ type: "text", text: code }] };
|
|
600
622
|
});
|
|
601
623
|
defineTool(server, "scaffold_from_contract", "Generate a subgraph scaffold from a deployed Stacks contract. Fetches the ABI automatically.", {
|
|
602
|
-
contractId:
|
|
603
|
-
subgraphName:
|
|
624
|
+
contractId: z5.string().describe("Fully qualified contract ID (e.g. SP102V8P0F7JX67ARQ77WEA3D3CFB5XW39REDT0AM.amm-pool-v2-01)"),
|
|
625
|
+
subgraphName: z5.string().optional().describe("Override the subgraph name (defaults to contract name)")
|
|
604
626
|
}, async ({ contractId, subgraphName }) => {
|
|
605
627
|
const { functions, maps } = await fetchAbi(contractId);
|
|
606
628
|
const code = generateSubgraphCode(contractId, functions, subgraphName, maps);
|
|
607
629
|
return { content: [{ type: "text", text: code }] };
|
|
608
630
|
});
|
|
609
631
|
defineTool(server, "scaffold_from_abi", "Generate a subgraph scaffold from a provided ABI JSON. Use when you already have the ABI.", {
|
|
610
|
-
abi:
|
|
611
|
-
contractId:
|
|
612
|
-
subgraphName:
|
|
632
|
+
abi: z5.string().describe("ABI JSON string (the full contract ABI object)"),
|
|
633
|
+
contractId: z5.string().describe("Fully qualified contract ID"),
|
|
634
|
+
subgraphName: z5.string().optional().describe("Override the subgraph name")
|
|
613
635
|
}, async ({ abi, contractId, subgraphName }) => {
|
|
614
636
|
let parsed;
|
|
615
637
|
try {
|
|
@@ -628,7 +650,7 @@ function registerScaffoldTools(server) {
|
|
|
628
650
|
// src/tools/streams.ts
|
|
629
651
|
import { AuthError } from "@secondlayer/sdk";
|
|
630
652
|
import { DECODED_EVENT_TYPES as DECODED_EVENT_TYPES3 } from "@secondlayer/shared";
|
|
631
|
-
import { z as
|
|
653
|
+
import { z as z6 } from "zod/v4";
|
|
632
654
|
var STREAMS_EVENT_TYPES = DECODED_EVENT_TYPES3;
|
|
633
655
|
async function withStreamsAuthHint(fn) {
|
|
634
656
|
try {
|
|
@@ -643,28 +665,28 @@ async function withStreamsAuthHint(fn) {
|
|
|
643
665
|
function registerStreamsTools(server, clientProvider = getClient) {
|
|
644
666
|
defineTool(server, "streams_tip", "Get the current Streams chain tip (latest processed block + lag). Streams requires an API key (SL_API_KEY).", {}, async () => withStreamsAuthHint(async () => jsonResponse(await clientProvider().streams.tip())));
|
|
645
667
|
defineTool(server, "streams_events", "List raw chain events from the Streams firehose. Streams requires an API key (SL_API_KEY). Filter by event types, principals, contract, asset, or block range; page with cursor.", {
|
|
646
|
-
types:
|
|
647
|
-
notTypes:
|
|
648
|
-
contractId:
|
|
649
|
-
sender:
|
|
650
|
-
recipient:
|
|
651
|
-
assetIdentifier:
|
|
652
|
-
fromHeight:
|
|
653
|
-
toHeight:
|
|
654
|
-
cursor:
|
|
655
|
-
limit:
|
|
668
|
+
types: z6.array(z6.enum(STREAMS_EVENT_TYPES)).optional().describe("Event types to include"),
|
|
669
|
+
notTypes: z6.array(z6.enum(STREAMS_EVENT_TYPES)).optional().describe("Event types to exclude (applied after types)"),
|
|
670
|
+
contractId: z6.string().optional().describe("Filter by contract id"),
|
|
671
|
+
sender: z6.string().optional().describe("Filter by sender principal"),
|
|
672
|
+
recipient: z6.string().optional().describe("Filter by recipient principal"),
|
|
673
|
+
assetIdentifier: z6.string().optional().describe("Filter by asset identifier"),
|
|
674
|
+
fromHeight: z6.number().optional().describe("Start block height (inclusive)"),
|
|
675
|
+
toHeight: z6.number().optional().describe("End block height (inclusive)"),
|
|
676
|
+
cursor: z6.string().optional().describe("Opaque cursor from a prior response"),
|
|
677
|
+
limit: z6.number().optional().describe("Max events for this page")
|
|
656
678
|
}, async (params) => withStreamsAuthHint(async () => jsonResponse(await clientProvider().streams.events.list(params))));
|
|
657
679
|
defineTool(server, "streams_consume", "Consume a bounded, reorg-aware run of Streams events from a cursor. Walks up to maxPages pages and returns the events, any reorgs observed, and a resume `cursor` to pass back as fromCursor next call — the agent-native consume/resume primitive. Streams requires an API key (SL_API_KEY).", {
|
|
658
|
-
fromCursor:
|
|
659
|
-
types:
|
|
660
|
-
notTypes:
|
|
661
|
-
contractId:
|
|
662
|
-
sender:
|
|
663
|
-
recipient:
|
|
664
|
-
assetIdentifier:
|
|
665
|
-
batchSize:
|
|
666
|
-
maxPages:
|
|
667
|
-
finalizedOnly:
|
|
680
|
+
fromCursor: z6.string().optional().describe("Resume cursor from a prior consume (omit to start at genesis)"),
|
|
681
|
+
types: z6.array(z6.enum(STREAMS_EVENT_TYPES)).optional().describe("Event types to include"),
|
|
682
|
+
notTypes: z6.array(z6.enum(STREAMS_EVENT_TYPES)).optional().describe("Event types to exclude"),
|
|
683
|
+
contractId: z6.string().optional().describe("Filter by contract id"),
|
|
684
|
+
sender: z6.string().optional().describe("Filter by sender principal"),
|
|
685
|
+
recipient: z6.string().optional().describe("Filter by recipient principal"),
|
|
686
|
+
assetIdentifier: z6.string().optional().describe("Filter by asset identifier"),
|
|
687
|
+
batchSize: z6.number().optional().describe("Events per page (1–1000, default 100)"),
|
|
688
|
+
maxPages: z6.number().optional().describe("Max pages to walk this call (1–20, default 5)"),
|
|
689
|
+
finalizedOnly: z6.boolean().optional().describe("Only emit finalized events; skip reorg handling")
|
|
668
690
|
}, async (params) => withStreamsAuthHint(async () => {
|
|
669
691
|
const maxPages = Math.min(Math.max(params.maxPages ?? 5, 1), 20);
|
|
670
692
|
const batchSize = Math.min(Math.max(params.batchSize ?? 100, 1), 1000);
|
|
@@ -696,15 +718,15 @@ function registerStreamsTools(server, clientProvider = getClient) {
|
|
|
696
718
|
pages: result.pages
|
|
697
719
|
});
|
|
698
720
|
}));
|
|
699
|
-
defineTool(server, "streams_event_by_txid", "List all Streams events emitted by a single transaction. Streams requires an API key (SL_API_KEY).", { txId:
|
|
721
|
+
defineTool(server, "streams_event_by_txid", "List all Streams events emitted by a single transaction. Streams requires an API key (SL_API_KEY).", { txId: z6.string().describe("Transaction id (0x… hash)") }, async ({ txId }) => withStreamsAuthHint(async () => jsonResponse(await clientProvider().streams.events.byTxId(txId))));
|
|
700
722
|
defineTool(server, "streams_block_events", "List all Streams events in a single block, by height or block hash. Streams requires an API key (SL_API_KEY).", {
|
|
701
|
-
heightOrHash:
|
|
723
|
+
heightOrHash: z6.string().describe("Block height (digits) or block hash (0x… string)")
|
|
702
724
|
}, async ({ heightOrHash }) => withStreamsAuthHint(async () => jsonResponse(await clientProvider().streams.blocks.events(/^\d+$/.test(heightOrHash) ? Number(heightOrHash) : heightOrHash))));
|
|
703
725
|
defineTool(server, "streams_reorgs", "List chain reorgs observed by Streams since a cursor. Streams requires an API key (SL_API_KEY).", {
|
|
704
|
-
since:
|
|
705
|
-
limit:
|
|
726
|
+
since: z6.string().describe("Cursor to list reorgs since (block:index or ISO timestamp)"),
|
|
727
|
+
limit: z6.number().optional().describe("Max reorgs to return")
|
|
706
728
|
}, async (params) => withStreamsAuthHint(async () => jsonResponse(await clientProvider().streams.reorgs.list(params))));
|
|
707
|
-
defineTool(server, "streams_canonical", "Get the canonical block at a given height from Streams (height + hashes + is_canonical). Streams requires an API key (SL_API_KEY).", { height:
|
|
729
|
+
defineTool(server, "streams_canonical", "Get the canonical block at a given height from Streams (height + hashes + is_canonical). Streams requires an API key (SL_API_KEY).", { height: z6.number().describe("Block height") }, async ({ height }) => withStreamsAuthHint(async () => jsonResponse(await clientProvider().streams.canonical(height))));
|
|
708
730
|
defineTool(server, "streams_usage", "Your own Streams consumption (events today + this month) and tier limits (rate limit, retention). Streams requires an API key (SL_API_KEY).", {}, async () => withStreamsAuthHint(async () => jsonResponse(await clientProvider().streams.usage())));
|
|
709
731
|
defineTool(server, "streams_dumps", "List the Streams bulk parquet dumps manifest — coverage range, latest_finalized_cursor, and per-file metadata (block range, row count, size, sha256, signed URL). This is the cold backfill path for downloading all raw data; fetch the file URLs directly (e.g. with DuckDB). Requires the dumps base URL to be configured (SL_STREAMS_DUMPS_URL).", {}, async () => jsonResponse(await clientProvider().streams.dumps.list()));
|
|
710
732
|
}
|
|
@@ -717,9 +739,9 @@ import {
|
|
|
717
739
|
generateKyselySchema,
|
|
718
740
|
generatePrismaSchema
|
|
719
741
|
} from "@secondlayer/subgraphs";
|
|
720
|
-
import { z as
|
|
742
|
+
import { z as z7 } from "zod/v4";
|
|
721
743
|
function registerSubgraphTools(server, clientProvider = getClient) {
|
|
722
|
-
defineTool(server, "subgraphs_list", "List all deployed subgraphs. Returns summary fields only
|
|
744
|
+
defineTool(server, "subgraphs_list", "List all deployed subgraphs. Returns summary fields only, including visibility — public subgraphs are anon-readable at /v1/subgraphs/<name>.", {}, async () => {
|
|
723
745
|
const { data } = await clientProvider().subgraphs.list();
|
|
724
746
|
return {
|
|
725
747
|
content: [
|
|
@@ -730,16 +752,16 @@ function registerSubgraphTools(server, clientProvider = getClient) {
|
|
|
730
752
|
]
|
|
731
753
|
};
|
|
732
754
|
});
|
|
733
|
-
defineTool(server, "subgraphs_get", "Get full details of a subgraph including schema, health, and table columns.", { name:
|
|
755
|
+
defineTool(server, "subgraphs_get", "Get full details of a subgraph including schema, health, and table columns.", { name: z7.string().describe("Subgraph name") }, async ({ name }) => {
|
|
734
756
|
const detail = await clientProvider().subgraphs.get(name);
|
|
735
757
|
return {
|
|
736
758
|
content: [{ type: "text", text: JSON.stringify(detail, null, 2) }]
|
|
737
759
|
};
|
|
738
760
|
});
|
|
739
761
|
defineTool(server, "subgraphs_spec", "Get generated API documentation for a subgraph. Defaults to compact agent schema; supports OpenAPI JSON and Markdown.", {
|
|
740
|
-
name:
|
|
741
|
-
format:
|
|
742
|
-
serverUrl:
|
|
762
|
+
name: z7.string().describe("Subgraph name"),
|
|
763
|
+
format: z7.enum(["agent", "openapi", "markdown"]).optional().describe("Spec format to return. Defaults to agent."),
|
|
764
|
+
serverUrl: z7.string().optional().describe("Override the server URL embedded in generated docs.")
|
|
743
765
|
}, async ({ name, format = "agent", serverUrl }) => {
|
|
744
766
|
const options = serverUrl ? { serverUrl } : undefined;
|
|
745
767
|
const spec = format === "openapi" ? await clientProvider().subgraphs.openapi(name, options) : format === "markdown" ? await clientProvider().subgraphs.markdown(name, options) : await clientProvider().subgraphs.schema(name, options);
|
|
@@ -752,16 +774,16 @@ function registerSubgraphTools(server, clientProvider = getClient) {
|
|
|
752
774
|
]
|
|
753
775
|
};
|
|
754
776
|
});
|
|
755
|
-
defineTool(server, "subgraphs_query", '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. To TAIL new rows (no streaming over MCP): sort=_id, order=desc for the latest, then poll forward with the filter {"_id.gt": "<last _id seen>"}, order=asc. Fetch one row by id with {"_id": "<id>"}.', {
|
|
756
|
-
name:
|
|
757
|
-
table:
|
|
758
|
-
filters:
|
|
759
|
-
sort:
|
|
760
|
-
order:
|
|
761
|
-
limit:
|
|
762
|
-
offset:
|
|
763
|
-
fields:
|
|
764
|
-
count:
|
|
777
|
+
defineTool(server, "subgraphs_query", '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. To TAIL new rows (no streaming over MCP): sort=_id, order=desc for the latest, then poll forward with the filter {"_id.gt": "<last _id seen>"}, order=asc. Fetch one row by id with {"_id": "<id>"}. Public subgraphs are also keyless over HTTP at GET /v1/subgraphs/<name>/<table> — { rows, next_cursor, tip } envelope, resume with ?cursor=<next_cursor> + _order=asc|desc (no _offset/_sort on /v1); hand that URL to third parties.', {
|
|
778
|
+
name: z7.string().describe("Subgraph name"),
|
|
779
|
+
table: z7.string().describe("Table name"),
|
|
780
|
+
filters: z7.record(z7.string(), z7.string()).optional().describe('Column filters — plain values or with operators (e.g. {"amount.gte": "1000", "sender": "SP..."})'),
|
|
781
|
+
sort: z7.string().optional().describe("Column to sort by"),
|
|
782
|
+
order: z7.enum(["asc", "desc"]).optional().describe("Sort order"),
|
|
783
|
+
limit: z7.number().max(200).optional().describe("Max rows (default 50, max 200)"),
|
|
784
|
+
offset: z7.number().optional().describe("Offset for pagination"),
|
|
785
|
+
fields: z7.string().optional().describe('Comma-separated column list to return (e.g. "sender,amount")'),
|
|
786
|
+
count: z7.boolean().optional().describe("If true, return row count instead of rows")
|
|
765
787
|
}, async ({
|
|
766
788
|
name,
|
|
767
789
|
table,
|
|
@@ -794,14 +816,14 @@ function registerSubgraphTools(server, clientProvider = getClient) {
|
|
|
794
816
|
};
|
|
795
817
|
});
|
|
796
818
|
defineTool(server, "subgraphs_aggregate", `Compute scalar aggregates over a subgraph table's filtered rows. Supports count, countDistinct, and sum/min/max (numeric columns only — uint/int plus the system _block_height). Filters use the same grammar as subgraphs_query (e.g. {"amount.gte": "1000"}). sum/min/max come back as lossless strings; counts as numbers. With no aggregate requested, returns the row count.`, {
|
|
797
|
-
name:
|
|
798
|
-
table:
|
|
799
|
-
filters:
|
|
800
|
-
count:
|
|
801
|
-
countDistinct:
|
|
802
|
-
sum:
|
|
803
|
-
min:
|
|
804
|
-
max:
|
|
819
|
+
name: z7.string().describe("Subgraph name"),
|
|
820
|
+
table: z7.string().describe("Table name"),
|
|
821
|
+
filters: z7.record(z7.string(), z7.string()).optional().describe('Column filters — plain values or with operators (e.g. {"amount.gte": "1000", "sender": "SP..."})'),
|
|
822
|
+
count: z7.boolean().optional().describe("Include COUNT(*) of matching rows"),
|
|
823
|
+
countDistinct: z7.array(z7.string()).optional().describe("Columns to count distinct values of"),
|
|
824
|
+
sum: z7.array(z7.string()).optional().describe("Numeric columns to sum (lossless string result)"),
|
|
825
|
+
min: z7.array(z7.string()).optional().describe("Numeric columns to take the minimum of"),
|
|
826
|
+
max: z7.array(z7.string()).optional().describe("Numeric columns to take the maximum of")
|
|
805
827
|
}, async ({ name, table, filters, count, countDistinct, sum, min, max }) => {
|
|
806
828
|
const result = await clientProvider().subgraphs.queryTableAggregate(name, table, { filters, count, countDistinct, sum, min, max });
|
|
807
829
|
return {
|
|
@@ -809,9 +831,9 @@ function registerSubgraphTools(server, clientProvider = getClient) {
|
|
|
809
831
|
};
|
|
810
832
|
});
|
|
811
833
|
defineTool(server, "subgraphs_reindex", "Reindex a subgraph from a specific block range. Returns an operationId — poll subgraphs_operation to track progress to completion.", {
|
|
812
|
-
name:
|
|
813
|
-
fromBlock:
|
|
814
|
-
toBlock:
|
|
834
|
+
name: z7.string().describe("Subgraph name"),
|
|
835
|
+
fromBlock: z7.number().optional().describe("Start block (defaults to beginning)"),
|
|
836
|
+
toBlock: z7.number().optional().describe("End block (defaults to latest)")
|
|
815
837
|
}, async ({ name, fromBlock, toBlock }) => {
|
|
816
838
|
const result = await clientProvider().subgraphs.reindex(name, {
|
|
817
839
|
fromBlock,
|
|
@@ -822,8 +844,8 @@ function registerSubgraphTools(server, clientProvider = getClient) {
|
|
|
822
844
|
};
|
|
823
845
|
});
|
|
824
846
|
defineTool(server, "subgraphs_operation", "Check reindex/backfill progress. With operationId, returns that operation's status (poll until status is completed/failed/cancelled); without it, lists recent operations for the subgraph.", {
|
|
825
|
-
name:
|
|
826
|
-
operationId:
|
|
847
|
+
name: z7.string().describe("Subgraph name"),
|
|
848
|
+
operationId: z7.string().optional().describe("Operation id from reindex/backfill/stop; omit to list recent operations")
|
|
827
849
|
}, async ({ name, operationId }) => {
|
|
828
850
|
const result = operationId ? await clientProvider().subgraphs.getOperation(name, operationId) : await clientProvider().subgraphs.operations(name);
|
|
829
851
|
return {
|
|
@@ -831,9 +853,9 @@ function registerSubgraphTools(server, clientProvider = getClient) {
|
|
|
831
853
|
};
|
|
832
854
|
});
|
|
833
855
|
defineTool(server, "subgraphs_backfill", "Backfill a subgraph over a block range. Non-destructive forward fill (does not drop existing data) — unlike subgraphs_reindex, and the only data-fill path for BYO subgraphs (reindex is blocked there). Both blocks required. Returns an operationId — poll subgraphs_operation to track progress.", {
|
|
834
|
-
name:
|
|
835
|
-
fromBlock:
|
|
836
|
-
toBlock:
|
|
856
|
+
name: z7.string().describe("Subgraph name"),
|
|
857
|
+
fromBlock: z7.number().int().nonnegative().describe("Start block (inclusive)"),
|
|
858
|
+
toBlock: z7.number().int().nonnegative().describe("End block (inclusive)")
|
|
837
859
|
}, async ({ name, fromBlock, toBlock }) => {
|
|
838
860
|
const result = await clientProvider().subgraphs.backfill(name, {
|
|
839
861
|
fromBlock,
|
|
@@ -843,17 +865,17 @@ function registerSubgraphTools(server, clientProvider = getClient) {
|
|
|
843
865
|
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
844
866
|
};
|
|
845
867
|
});
|
|
846
|
-
defineTool(server, "subgraphs_stop", "Cancel an in-flight reindex or backfill operation for a subgraph. Returns the stop request status; poll subgraphs_operation to confirm it reaches a terminal state.", { name:
|
|
868
|
+
defineTool(server, "subgraphs_stop", "Cancel an in-flight reindex or backfill operation for a subgraph. Returns the stop request status; poll subgraphs_operation to confirm it reaches a terminal state.", { name: z7.string().describe("Subgraph name") }, async ({ name }) => {
|
|
847
869
|
const result = await clientProvider().subgraphs.stop(name);
|
|
848
870
|
return {
|
|
849
871
|
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
850
872
|
};
|
|
851
873
|
});
|
|
852
874
|
defineTool(server, "subgraphs_gaps", "List indexing gaps (missing block ranges) for a subgraph. Each gap reports start/end/size, reason, and detected/resolved timestamps. Feed an unresolved gap's range into subgraphs_backfill to fill it. Defaults to unresolved gaps.", {
|
|
853
|
-
name:
|
|
854
|
-
limit:
|
|
855
|
-
offset:
|
|
856
|
-
resolved:
|
|
875
|
+
name: z7.string().describe("Subgraph name"),
|
|
876
|
+
limit: z7.number().int().positive().optional().describe("Max gaps to return"),
|
|
877
|
+
offset: z7.number().int().nonnegative().optional().describe("Pagination offset"),
|
|
878
|
+
resolved: z7.boolean().optional().describe("Filter by resolved state (omit for unresolved only)")
|
|
857
879
|
}, async ({ name, limit, offset, resolved }) => {
|
|
858
880
|
const result = await clientProvider().subgraphs.gaps(name, {
|
|
859
881
|
limit,
|
|
@@ -864,16 +886,17 @@ function registerSubgraphTools(server, clientProvider = getClient) {
|
|
|
864
886
|
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
865
887
|
};
|
|
866
888
|
});
|
|
867
|
-
defineTool(server, "subgraphs_delete", "Delete a subgraph permanently.", { name:
|
|
889
|
+
defineTool(server, "subgraphs_delete", "Delete a subgraph permanently.", { name: z7.string().describe("Subgraph name") }, async ({ name }) => {
|
|
868
890
|
const result = await clientProvider().subgraphs.delete(name);
|
|
869
891
|
return { content: [{ type: "text", text: result.message }] };
|
|
870
892
|
});
|
|
871
|
-
defineTool(server, "subgraphs_deploy", "Deploy a subgraph from TypeScript code. Pass the full defineSubgraph() source — it will be bundled, validated, and deployed. Optional startBlock overrides the source definition for this deploy. Set dryRun to validate and preview the schema/DDL without writing anything. Set databaseUrl to deploy to your own Postgres (BYO data plane) — the server verifies the connection first; with dryRun it returns the DDL + grant script. A breaking BYO schema change is refused and returns a migration plan (drop + rebuild DDL) instead of deploying. Call `subgraphs_reindex` separately if you need a forced reindex.", {
|
|
872
|
-
code:
|
|
873
|
-
startBlock:
|
|
874
|
-
databaseUrl:
|
|
875
|
-
dryRun:
|
|
876
|
-
|
|
893
|
+
defineTool(server, "subgraphs_deploy", "Deploy a subgraph from TypeScript code. Pass the full defineSubgraph() source — it will be bundled, validated, and deployed. Optional startBlock overrides the source definition for this deploy. Set dryRun to validate and preview the schema/DDL without writing anything. Set databaseUrl to deploy to your own Postgres (BYO data plane) — the server verifies the connection first; with dryRun it returns the DDL + grant script. A breaking BYO schema change is refused and returns a migration plan (drop + rebuild DDL) instead of deploying. Visibility defaults: managed deploys are public (anon-readable at /v1/subgraphs/<name>, name claimed in the global public namespace), BYO deploys are private. Call `subgraphs_reindex` separately if you need a forced reindex.", {
|
|
894
|
+
code: z7.string().describe("TypeScript source code containing a defineSubgraph() call"),
|
|
895
|
+
startBlock: z7.number().int().nonnegative().optional().describe("Override the definition startBlock for this deploy"),
|
|
896
|
+
databaseUrl: z7.string().optional().describe("BYO data plane: Postgres connection string to host the subgraph's schema and rows in your own database"),
|
|
897
|
+
dryRun: z7.boolean().optional().describe("Validate and preview the deploy (schema/DDL, BYO connection) without writing changes"),
|
|
898
|
+
visibility: z7.enum(["public", "private"]).optional().describe("Read visibility: public = anon /v1 reads + global name claim; private = owning account's key only. Defaults: managed → public, BYO → private.")
|
|
899
|
+
}, async ({ code, startBlock, databaseUrl, dryRun, visibility }) => {
|
|
877
900
|
const bundled = await bundleSubgraphCode(code);
|
|
878
901
|
try {
|
|
879
902
|
const result = await clientProvider().subgraphs.deploy({
|
|
@@ -886,7 +909,8 @@ function registerSubgraphTools(server, clientProvider = getClient) {
|
|
|
886
909
|
sourceCode: code,
|
|
887
910
|
...startBlock !== undefined ? { startBlock } : {},
|
|
888
911
|
...databaseUrl !== undefined ? { databaseUrl } : {},
|
|
889
|
-
...dryRun !== undefined ? { dryRun } : {}
|
|
912
|
+
...dryRun !== undefined ? { dryRun } : {},
|
|
913
|
+
...visibility !== undefined ? { visibility } : {}
|
|
890
914
|
});
|
|
891
915
|
return {
|
|
892
916
|
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
@@ -905,17 +929,29 @@ function registerSubgraphTools(server, clientProvider = getClient) {
|
|
|
905
929
|
throw err;
|
|
906
930
|
}
|
|
907
931
|
});
|
|
908
|
-
defineTool(server, "
|
|
932
|
+
defineTool(server, "subgraphs_publish", "Make a subgraph publicly readable at /v1/subgraphs/<name> — anyone (or any agent) can read it without a key. Claims the name in the global public namespace; fails with PUBLIC_NAME_TAKEN if another account holds it.", { name: z7.string().describe("Subgraph name") }, async ({ name }) => {
|
|
933
|
+
const result = await clientProvider().subgraphs.publish(name);
|
|
934
|
+
return {
|
|
935
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
936
|
+
};
|
|
937
|
+
});
|
|
938
|
+
defineTool(server, "subgraphs_unpublish", "Make a subgraph private again — /v1 reads then require the owning account's bearer key, and the global public name claim is released.", { name: z7.string().describe("Subgraph name") }, async ({ name }) => {
|
|
939
|
+
const result = await clientProvider().subgraphs.unpublish(name);
|
|
940
|
+
return {
|
|
941
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
942
|
+
};
|
|
943
|
+
});
|
|
944
|
+
defineTool(server, "subgraphs_read_source", "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.", { name: z7.string().describe("Subgraph name") }, async ({ name }) => {
|
|
909
945
|
const source = await clientProvider().subgraphs.getSource(name);
|
|
910
946
|
return {
|
|
911
947
|
content: [{ type: "text", text: JSON.stringify(source, null, 2) }]
|
|
912
948
|
};
|
|
913
949
|
});
|
|
914
950
|
defineTool(server, "subgraphs_codegen", "Generate a typed ORM schema (Prisma, Drizzle, or Kysely) for a subgraph's tables so they can be queried from a BYO database. Pass either `code` (defineSubgraph source) or `name` (a deployed subgraph — its captured source is used). Returns the schema as text.", {
|
|
915
|
-
code:
|
|
916
|
-
name:
|
|
917
|
-
target:
|
|
918
|
-
schemaName:
|
|
951
|
+
code: z7.string().optional().describe("defineSubgraph() source (mutually exclusive with name)"),
|
|
952
|
+
name: z7.string().optional().describe("Deployed subgraph name (mutually exclusive with code)"),
|
|
953
|
+
target: z7.enum(["prisma", "drizzle", "kysely"]).optional().describe("ORM target (default prisma)"),
|
|
954
|
+
schemaName: z7.string().optional().describe("Postgres schema name (defaults to subgraph_<name>)")
|
|
919
955
|
}, async ({ code, name, target = "prisma", schemaName }) => {
|
|
920
956
|
if (code && name || !code && !name) {
|
|
921
957
|
throw new Error("Provide exactly one of `code` or `name`.");
|
|
@@ -944,7 +980,7 @@ function registerSubgraphTools(server, clientProvider = getClient) {
|
|
|
944
980
|
|
|
945
981
|
// src/tools/subscriptions.ts
|
|
946
982
|
import { CHAIN_TRIGGER_TYPES } from "@secondlayer/shared";
|
|
947
|
-
import { z as
|
|
983
|
+
import { z as z8 } from "zod/v4";
|
|
948
984
|
function registerSubscriptionTools(server, clientProvider = getClient) {
|
|
949
985
|
defineTool(server, "subscriptions_list", "List all subscriptions for the current account. Returns summary fields (no secrets).", {}, async () => {
|
|
950
986
|
const { data } = await clientProvider().subscriptions.list();
|
|
@@ -952,34 +988,34 @@ function registerSubscriptionTools(server, clientProvider = getClient) {
|
|
|
952
988
|
content: [{ type: "text", text: JSON.stringify(data, null, 2) }]
|
|
953
989
|
};
|
|
954
990
|
});
|
|
955
|
-
defineTool(server, "subscriptions_get", "Get full detail for a subscription (filter, auth, retry config, circuit state).", { id:
|
|
991
|
+
defineTool(server, "subscriptions_get", "Get full detail for a subscription (filter, auth, retry config, circuit state).", { id: z8.string().describe("Subscription id") }, async ({ id }) => {
|
|
956
992
|
const detail = await clientProvider().subscriptions.get(id);
|
|
957
993
|
return {
|
|
958
994
|
content: [{ type: "text", text: JSON.stringify(detail, null, 2) }]
|
|
959
995
|
};
|
|
960
996
|
});
|
|
961
997
|
defineTool(server, "subscriptions_create", "Create a subscription. Two kinds (mutually exclusive): a SUBGRAPH subscription fires on a subgraph table's rows (set subgraphName + tableName + optional filter); a CHAIN subscription fires on raw chain events with no subgraph (set triggers). Returns `signingSecret` ONCE — forward it to the user so they can wire it into their receiver.", {
|
|
962
|
-
name:
|
|
963
|
-
subgraphName:
|
|
964
|
-
tableName:
|
|
965
|
-
triggers:
|
|
966
|
-
type:
|
|
967
|
-
contractId:
|
|
968
|
-
functionName:
|
|
969
|
-
caller:
|
|
970
|
-
sender:
|
|
971
|
-
recipient:
|
|
972
|
-
assetIdentifier:
|
|
973
|
-
deployer:
|
|
974
|
-
contractName:
|
|
975
|
-
topic:
|
|
976
|
-
lockedAddress:
|
|
977
|
-
trait:
|
|
978
|
-
minAmount:
|
|
979
|
-
maxAmount:
|
|
998
|
+
name: z8.string().describe("Human-readable name, unique per account"),
|
|
999
|
+
subgraphName: z8.string().optional().describe("Subgraph to subscribe to (subgraph subscription)"),
|
|
1000
|
+
tableName: z8.string().optional().describe("Table within the subgraph (subgraph subscription)"),
|
|
1001
|
+
triggers: z8.array(z8.object({
|
|
1002
|
+
type: z8.enum(CHAIN_TRIGGER_TYPES),
|
|
1003
|
+
contractId: z8.string().optional(),
|
|
1004
|
+
functionName: z8.string().optional(),
|
|
1005
|
+
caller: z8.string().optional(),
|
|
1006
|
+
sender: z8.string().optional(),
|
|
1007
|
+
recipient: z8.string().optional(),
|
|
1008
|
+
assetIdentifier: z8.string().optional(),
|
|
1009
|
+
deployer: z8.string().optional(),
|
|
1010
|
+
contractName: z8.string().optional(),
|
|
1011
|
+
topic: z8.string().optional(),
|
|
1012
|
+
lockedAddress: z8.string().optional(),
|
|
1013
|
+
trait: z8.string().optional(),
|
|
1014
|
+
minAmount: z8.union([z8.string(), z8.number()]).optional(),
|
|
1015
|
+
maxAmount: z8.union([z8.string(), z8.number()]).optional()
|
|
980
1016
|
})).optional().describe("Chain triggers (chain subscription) — provide INSTEAD of subgraphName/tableName. Each targets a raw chain event/tx; string fields accept `*` wildcards, `trait` scopes to a SIP/trait. Per-type accepted fields: see the secondlayer://chain-triggers resource. Forward-looking: starts at chain tip, no backfill."),
|
|
981
|
-
url:
|
|
982
|
-
format:
|
|
1017
|
+
url: z8.string().describe("Webhook URL"),
|
|
1018
|
+
format: z8.enum([
|
|
983
1019
|
"standard-webhooks",
|
|
984
1020
|
"inngest",
|
|
985
1021
|
"trigger",
|
|
@@ -987,9 +1023,9 @@ function registerSubscriptionTools(server, clientProvider = getClient) {
|
|
|
987
1023
|
"cloudevents",
|
|
988
1024
|
"raw"
|
|
989
1025
|
]).optional().describe("Wire format (default standard-webhooks)"),
|
|
990
|
-
runtime:
|
|
991
|
-
filter:
|
|
992
|
-
authConfig:
|
|
1026
|
+
runtime: z8.enum(["inngest", "trigger", "cloudflare", "node"]).optional().describe("Receiver runtime label (display only)"),
|
|
1027
|
+
filter: z8.record(z8.string(), z8.unknown()).optional().describe('Scalar filter DSL, e.g. {"amount": {"gte": 100}, "sender": "SP..."}'),
|
|
1028
|
+
authConfig: z8.record(z8.string(), z8.unknown()).optional().describe('Receiver auth sent with each delivery, e.g. {"type": "bearer", "token": "..."}')
|
|
993
1029
|
}, async (input) => {
|
|
994
1030
|
const res = await clientProvider().subscriptions.create(input);
|
|
995
1031
|
return {
|
|
@@ -997,12 +1033,12 @@ function registerSubscriptionTools(server, clientProvider = getClient) {
|
|
|
997
1033
|
};
|
|
998
1034
|
});
|
|
999
1035
|
defineTool(server, "subscriptions_update", "Patch a subscription (name, url, filter, authConfig, format, runtime, retry, timeout, concurrency).", {
|
|
1000
|
-
id:
|
|
1001
|
-
name:
|
|
1002
|
-
url:
|
|
1003
|
-
filter:
|
|
1004
|
-
authConfig:
|
|
1005
|
-
format:
|
|
1036
|
+
id: z8.string(),
|
|
1037
|
+
name: z8.string().optional().describe("Rename the subscription"),
|
|
1038
|
+
url: z8.string().optional(),
|
|
1039
|
+
filter: z8.record(z8.string(), z8.unknown()).optional(),
|
|
1040
|
+
authConfig: z8.record(z8.string(), z8.unknown()).optional().describe("Receiver auth sent with each delivery (bearer/etc.)"),
|
|
1041
|
+
format: z8.enum([
|
|
1006
1042
|
"standard-webhooks",
|
|
1007
1043
|
"inngest",
|
|
1008
1044
|
"trigger",
|
|
@@ -1010,51 +1046,51 @@ function registerSubscriptionTools(server, clientProvider = getClient) {
|
|
|
1010
1046
|
"cloudevents",
|
|
1011
1047
|
"raw"
|
|
1012
1048
|
]).optional(),
|
|
1013
|
-
runtime:
|
|
1014
|
-
maxRetries:
|
|
1015
|
-
timeoutMs:
|
|
1016
|
-
concurrency:
|
|
1049
|
+
runtime: z8.enum(["inngest", "trigger", "cloudflare", "node"]).nullable().optional(),
|
|
1050
|
+
maxRetries: z8.number().int().min(0).optional(),
|
|
1051
|
+
timeoutMs: z8.number().int().min(100).optional(),
|
|
1052
|
+
concurrency: z8.number().int().min(1).optional()
|
|
1017
1053
|
}, async ({ id, ...patch }) => {
|
|
1018
1054
|
const res = await clientProvider().subscriptions.update(id, patch);
|
|
1019
1055
|
return {
|
|
1020
1056
|
content: [{ type: "text", text: JSON.stringify(res, null, 2) }]
|
|
1021
1057
|
};
|
|
1022
1058
|
});
|
|
1023
|
-
defineTool(server, "subscriptions_pause", "Pause a subscription. Pending rows remain queued until resumed.", { id:
|
|
1059
|
+
defineTool(server, "subscriptions_pause", "Pause a subscription. Pending rows remain queued until resumed.", { id: z8.string() }, async ({ id }) => {
|
|
1024
1060
|
const res = await clientProvider().subscriptions.pause(id);
|
|
1025
1061
|
return {
|
|
1026
1062
|
content: [{ type: "text", text: JSON.stringify(res, null, 2) }]
|
|
1027
1063
|
};
|
|
1028
1064
|
});
|
|
1029
|
-
defineTool(server, "subscriptions_resume", "Resume a paused or circuit-open subscription and reset circuit failures.", { id:
|
|
1065
|
+
defineTool(server, "subscriptions_resume", "Resume a paused or circuit-open subscription and reset circuit failures.", { id: z8.string() }, async ({ id }) => {
|
|
1030
1066
|
const res = await clientProvider().subscriptions.resume(id);
|
|
1031
1067
|
return {
|
|
1032
1068
|
content: [{ type: "text", text: JSON.stringify(res, null, 2) }]
|
|
1033
1069
|
};
|
|
1034
1070
|
});
|
|
1035
|
-
defineTool(server, "subscriptions_delete", "Delete a subscription. Pending outbox rows are cascade-deleted.", { id:
|
|
1071
|
+
defineTool(server, "subscriptions_delete", "Delete a subscription. Pending outbox rows are cascade-deleted.", { id: z8.string() }, async ({ id }) => {
|
|
1036
1072
|
const res = await clientProvider().subscriptions.delete(id);
|
|
1037
1073
|
return {
|
|
1038
1074
|
content: [{ type: "text", text: JSON.stringify(res, null, 2) }]
|
|
1039
1075
|
};
|
|
1040
1076
|
});
|
|
1041
|
-
defineTool(server, "subscriptions_rotate_secret", "Rotate a subscription signing secret. Returns the new plaintext secret once.", { id:
|
|
1077
|
+
defineTool(server, "subscriptions_rotate_secret", "Rotate a subscription signing secret. Returns the new plaintext secret once.", { id: z8.string() }, async ({ id }) => {
|
|
1042
1078
|
const res = await clientProvider().subscriptions.rotateSecret(id);
|
|
1043
1079
|
return {
|
|
1044
1080
|
content: [{ type: "text", text: JSON.stringify(res, null, 2) }]
|
|
1045
1081
|
};
|
|
1046
1082
|
});
|
|
1047
|
-
defineTool(server, "subscriptions_test", "Send a one-off test webhook to a subscription's URL (built for its format, SSRF-guarded). Logged as a delivery row — check subscriptions_recent_deliveries. Returns {ok, statusCode, error, durationMs, deliveryId}.", { id:
|
|
1083
|
+
defineTool(server, "subscriptions_test", "Send a one-off test webhook to a subscription's URL (built for its format, SSRF-guarded). Logged as a delivery row — check subscriptions_recent_deliveries. Returns {ok, statusCode, error, durationMs, deliveryId}.", { id: z8.string().describe("Subscription id") }, async ({ id }) => {
|
|
1048
1084
|
const res = await clientProvider().subscriptions.test(id);
|
|
1049
1085
|
return {
|
|
1050
1086
|
content: [{ type: "text", text: JSON.stringify(res, null, 2) }]
|
|
1051
1087
|
};
|
|
1052
1088
|
});
|
|
1053
1089
|
defineTool(server, "subscriptions_replay", "Replay a block range for a subscription. Replays run at 10% of batch capacity — use sparingly. Pass `force` (a short idempotency suffix) to re-run a range that was already replayed.", {
|
|
1054
|
-
id:
|
|
1055
|
-
fromBlock:
|
|
1056
|
-
toBlock:
|
|
1057
|
-
force:
|
|
1090
|
+
id: z8.string(),
|
|
1091
|
+
fromBlock: z8.number().int().nonnegative(),
|
|
1092
|
+
toBlock: z8.number().int().nonnegative(),
|
|
1093
|
+
force: z8.string().optional().describe("Idempotency suffix to force a duplicate replay of the range")
|
|
1058
1094
|
}, async ({ id, fromBlock, toBlock, force }) => {
|
|
1059
1095
|
const res = await clientProvider().subscriptions.replay(id, {
|
|
1060
1096
|
fromBlock,
|
|
@@ -1065,22 +1101,22 @@ function registerSubscriptionTools(server, clientProvider = getClient) {
|
|
|
1065
1101
|
content: [{ type: "text", text: JSON.stringify(res, null, 2) }]
|
|
1066
1102
|
};
|
|
1067
1103
|
});
|
|
1068
|
-
defineTool(server, "subscriptions_dead", "Return the last 100 dead-letter outbox rows for a subscription.", { id:
|
|
1104
|
+
defineTool(server, "subscriptions_dead", "Return the last 100 dead-letter outbox rows for a subscription.", { id: z8.string() }, async ({ id }) => {
|
|
1069
1105
|
const { data } = await clientProvider().subscriptions.dead(id);
|
|
1070
1106
|
return {
|
|
1071
1107
|
content: [{ type: "text", text: JSON.stringify(data, null, 2) }]
|
|
1072
1108
|
};
|
|
1073
1109
|
});
|
|
1074
1110
|
defineTool(server, "subscriptions_requeue_dead", "Requeue one dead-letter outbox row for delivery retry.", {
|
|
1075
|
-
id:
|
|
1076
|
-
outboxId:
|
|
1111
|
+
id: z8.string(),
|
|
1112
|
+
outboxId: z8.string()
|
|
1077
1113
|
}, async ({ id, outboxId }) => {
|
|
1078
1114
|
const res = await clientProvider().subscriptions.requeueDead(id, outboxId);
|
|
1079
1115
|
return {
|
|
1080
1116
|
content: [{ type: "text", text: JSON.stringify(res, null, 2) }]
|
|
1081
1117
|
};
|
|
1082
1118
|
});
|
|
1083
|
-
defineTool(server, "subscriptions_recent_deliveries", "Return the last 100 delivery attempts (attempt #, status code, duration, truncated response).", { id:
|
|
1119
|
+
defineTool(server, "subscriptions_recent_deliveries", "Return the last 100 delivery attempts (attempt #, status code, duration, truncated response).", { id: z8.string() }, async ({ id }) => {
|
|
1084
1120
|
const { data } = await clientProvider().subscriptions.recentDeliveries(id);
|
|
1085
1121
|
return {
|
|
1086
1122
|
content: [{ type: "text", text: JSON.stringify(data, null, 2) }]
|
|
@@ -1101,7 +1137,6 @@ function createServer() {
|
|
|
1101
1137
|
registerSubscriptionTools(server);
|
|
1102
1138
|
registerAccountTools(server);
|
|
1103
1139
|
registerProjectTools(server);
|
|
1104
|
-
registerDatasetTools(server);
|
|
1105
1140
|
registerIndexTools(server);
|
|
1106
1141
|
registerStreamsTools(server);
|
|
1107
1142
|
registerContractTools(server);
|
|
@@ -1112,5 +1147,5 @@ export {
|
|
|
1112
1147
|
createServer
|
|
1113
1148
|
};
|
|
1114
1149
|
|
|
1115
|
-
//# debugId=
|
|
1150
|
+
//# debugId=C349C261EC92DE8964756E2164756E21
|
|
1116
1151
|
//# sourceMappingURL=index.js.map
|