@secondlayer/mcp 3.9.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -5,26 +5,54 @@ import { fileURLToPath } from "node:url";
5
5
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
6
6
 
7
7
  // src/resources.ts
8
- import { CHAIN_TRIGGER_FIELDS, DECODED_EVENT_TYPES } from "@secondlayer/shared";
8
+ import { CHAIN_TRIGGER_FIELDS } from "@secondlayer/shared";
9
9
  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;
@@ -165,25 +193,21 @@ var COLUMN_TYPES = [
165
193
  }
166
194
  ];
167
195
  var PRODUCT_BLURBS = {
168
- datasets: "public foundation datasets",
169
- index: "decoded L2 events, contract calls, blocks, transactions, stacking, mempool",
170
- streams: "raw canonical chain event firehose",
171
- contracts: "trait-based contract discovery",
196
+ index: "decoded L2 events, transfers, contract calls, blocks, transactions",
197
+ streams: "bulk parquet dumps of the raw chain event firehose",
198
+ contracts: "trait-based contract discovery and ABIs",
172
199
  subgraphs: "author/deploy/query custom indexes",
173
200
  subscriptions: "webhook delivery on subgraph rows or raw chain events",
174
- account: "identity, plan, billing, usage, spend caps, and API keys",
175
- project: "create/manage projects and view their team",
176
- scaffold: "generate typed contract clients from a deployment or ABI"
201
+ account: "identity and self-provisioned API keys",
202
+ scaffold: "generate deploy-ready subgraph code from a deployed contract"
177
203
  };
178
204
  var PRODUCT_ORDER = [
179
- "datasets",
180
205
  "index",
181
206
  "streams",
182
207
  "contracts",
183
208
  "subgraphs",
184
209
  "subscriptions",
185
210
  "account",
186
- "project",
187
211
  "scaffold"
188
212
  ];
189
213
  function buildCapabilities() {
@@ -205,11 +229,17 @@ function buildCapabilities() {
205
229
  });
206
230
  return {
207
231
  products,
208
- discoverFirst: "Call datasets_list / index_discover / contracts_find to learn what exists (and which filters each surface accepts) before querying."
232
+ discoverFirst: "Call index_discover / contracts_find to learn what exists (and which filters each surface accepts) before querying."
209
233
  };
210
234
  }
235
+ var X402_CAPABILITY = {
236
+ 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.",
237
+ 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.",
238
+ 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.",
239
+ discovery: "GET /v1/x402/supported on the API host for scheme, assets, prices, quotas, sessions, and prepaid metadata.",
240
+ 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."
241
+ };
211
242
  var READ_AUTH_TIERS = {
212
- datasets: "open — no API key required",
213
243
  index: "anonymous reads allowed; free-tier API keys are rejected (Build+ required)",
214
244
  streams: "API key required (SL_API_KEY) — keyless calls return 401",
215
245
  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"
@@ -219,7 +249,10 @@ async function buildContext(deps = { clientProvider: getClient }) {
219
249
  const orNull = (v) => v == null ? unavailable : v;
220
250
  const snap = await deps.clientProvider().context().catch(() => null);
221
251
  return {
222
- authState: { apiKeySet: Boolean(process.env.SL_API_KEY) },
252
+ authState: {
253
+ apiKeySet: Boolean(process.env.SL_API_KEY),
254
+ x402WalletSet: Boolean(process.env.X402_PRIVATE_KEY)
255
+ },
223
256
  whatExists: {
224
257
  account: orNull(snap?.account),
225
258
  streamsTip: orNull(snap?.streamsTip),
@@ -231,7 +264,8 @@ async function buildContext(deps = { clientProvider: getClient }) {
231
264
  activeOperations: orNull(snap?.activeOperations)
232
265
  },
233
266
  whatYouCanDo: buildCapabilities(),
234
- readAuthTiers: READ_AUTH_TIERS
267
+ readAuthTiers: READ_AUTH_TIERS,
268
+ payPerCall: X402_CAPABILITY
235
269
  };
236
270
  }
237
271
  function registerResources(server) {
@@ -280,29 +314,6 @@ function registerResources(server) {
280
314
  }
281
315
  ]
282
316
  }));
283
- server.resource("streams-filters", "secondlayer://streams-filters", {
284
- description: "Streams firehose vocabulary — the decoded event types and the filter fields accepted by streams_events / streams_consume."
285
- }, async () => ({
286
- contents: [
287
- {
288
- uri: "secondlayer://streams-filters",
289
- mimeType: "application/json",
290
- text: JSON.stringify({
291
- eventTypes: [...DECODED_EVENT_TYPES],
292
- filters: {
293
- types: "include only these event types (array)",
294
- notTypes: "exclude these event types (array)",
295
- contractId: "match a contract id",
296
- sender: "match the sender principal",
297
- recipient: "match the recipient principal",
298
- assetIdentifier: "match the asset identifier (contract::asset)",
299
- fromHeight: "start block height (inclusive)",
300
- toHeight: "end block height (inclusive)"
301
- }
302
- }, null, 2)
303
- }
304
- ]
305
- }));
306
317
  server.resource("chain-triggers", "secondlayer://chain-triggers", {
307
318
  description: "Chain-subscription trigger types and the filter fields each accepts (for subscriptions_create triggers)."
308
319
  }, async () => ({
@@ -323,50 +334,13 @@ function registerAccountTools(server) {
323
334
  const result = await apiRequest("GET", "/api/accounts/me");
324
335
  return jsonResponse(result);
325
336
  });
326
- defineTool(server, "account_update", "Update the authenticated account's profile. Requires an API key.", {
327
- displayName: z.string().optional().describe("Display name"),
328
- bio: z.string().optional().describe("Profile bio"),
329
- slug: z.string().optional().describe("Account URL slug")
330
- }, async ({ displayName, bio, slug }) => {
331
- const body = {};
332
- if (displayName !== undefined)
333
- body.display_name = displayName;
334
- if (bio !== undefined)
335
- body.bio = bio;
336
- if (slug !== undefined)
337
- body.slug = slug;
338
- const result = await apiRequest("PATCH", "/api/accounts/me", body);
339
- return jsonResponse(result);
340
- });
341
- defineTool(server, "account_billing", "Show the account's plan and subscription/billing status. Requires an API key. (Plan upgrade / Stripe portal / checkout are deliberately not agent tools — they are session-only human-payment flows; use account_set_caps to bound spend.)", {}, async () => {
342
- const result = await apiRequest("GET", "/api/billing/status");
343
- return jsonResponse(result);
344
- });
345
337
  defineTool(server, "account_create_key", "Mint a scoped streams/index read API key so the agent can self-provision access. Requires an account-level (owner) API key. The returned `key` is shown ONCE — forward it to the user to set as SL_API_KEY.", {
346
338
  product: z.enum(["streams", "index"]).optional().describe("Key scope (default streams)"),
347
339
  name: z.string().optional().describe("Optional label for the key")
348
340
  }, async ({ product, name }) => jsonResponse(await getClient().apiKeys.create({ product, name })));
349
- defineTool(server, "account_list_keys", "List the account's API keys (metadata only — prefix, name, status, product, tier, last used; never the plaintext). Requires an account-level (owner) API key.", {}, async () => jsonResponse(await getClient().apiKeys.list()));
350
- defineTool(server, "account_revoke_key", "Revoke an API key by id. Requests using that key stop working immediately. Requires an account-level (owner) API key.", { id: z.string().describe("Key id from account_list_keys") }, async ({ id }) => jsonResponse(await getClient().apiKeys.revoke(id)));
351
- defineTool(server, "account_usage", "Show the current billing period's usage snapshot: spend (with cap/projection), compute, storage, and per-project breakdown. Requires an API key.", {}, async () => jsonResponse(await apiRequest("GET", "/api/accounts/usage")));
352
- defineTool(server, "account_get_caps", "Show the account's spend caps and alert threshold. Requires an account-level (owner) API key.", {}, async () => jsonResponse(await apiRequest("GET", "/api/billing/caps")));
353
- defineTool(server, "account_set_caps", "Set the account's spend caps and alert threshold (no payment — just bounds spend). Requires an account-level (owner) API key.", {
354
- monthlyCapCents: z.number().int().nonnegative().optional().describe("Total monthly spend cap in cents"),
355
- computeCapCents: z.number().int().nonnegative().optional().describe("Compute spend cap in cents"),
356
- storageCapCents: z.number().int().nonnegative().optional().describe("Storage spend cap in cents"),
357
- alertThresholdPct: z.number().int().min(1).max(100).optional().describe("Percent of cap that triggers an alert (1-100)")
358
- }, async (caps) => {
359
- const body = {};
360
- for (const [k, v] of Object.entries(caps)) {
361
- if (v !== undefined)
362
- body[k] = v;
363
- }
364
- return jsonResponse(await apiRequest("PATCH", "/api/billing/caps", body));
365
- });
366
341
  }
367
342
 
368
343
  // src/tools/contracts.ts
369
- import { generateContractInterface } from "@secondlayer/scaffold";
370
344
  import { z as z2 } from "zod/v4";
371
345
  function registerContractTools(server, clientProvider = getClient) {
372
346
  defineTool(server, "contracts_find", 'Discover deployed Stacks contracts conforming to a trait (e.g. "sip-010", "sip-009", "sip-013"). The discovery endpoint for "which contracts implement X". Reads are public.', {
@@ -376,7 +350,7 @@ function registerContractTools(server, clientProvider = getClient) {
376
350
  limit: z2.number().optional().describe("Page size, 1–500 (default 100)"),
377
351
  cursor: z2.string().optional().describe("Opaque cursor from a prior response's next_cursor")
378
352
  }, async (params) => jsonResponse(await clientProvider().contracts.list(params)));
379
- defineTool(server, "get_contract_abi", "Fetch a single deployed contract's ABI from the registry (prod-safe). Returns the contract's metadata + full ABI (functions, maps, variables, fungible/non-fungible tokens). Returns not_found if the contract isn't in the registry. Feed the ABI into scaffold_from_abi or generate a typed client.", {
353
+ defineTool(server, "get_contract_abi", "Fetch a single deployed contract's ABI from the registry (prod-safe). Returns the contract's metadata + full ABI (functions, maps, variables, fungible/non-fungible tokens). Returns not_found if the contract isn't in the registry. Use it to inspect a contract before scaffold_from_contract.", {
380
354
  contractId: z2.string().describe("Fully qualified contract id (e.g. SP….amm-pool-v2-01)")
381
355
  }, async ({ contractId }) => {
382
356
  const contract = await clientProvider().contracts.get(contractId, {
@@ -390,72 +364,18 @@ function registerContractTools(server, clientProvider = getClient) {
390
364
  }
391
365
  }, true);
392
366
  });
393
- defineTool(server, "generate_contract_interface", "Generate a typed TypeScript contract-client interface (typed methods + map/var/constant readers) from a deployed contract's ABI (fetched from the registry). Returns not_found if the contract isn't in the registry.", {
394
- contractId: z2.string().describe("Fully qualified contract id (e.g. SP….amm-pool-v2-01)")
395
- }, async ({ contractId }) => {
396
- const c = await clientProvider().contracts.get(contractId, {
397
- includeAbi: true
398
- });
399
- if (!c || !c.abi) {
400
- return jsonResponse({
401
- error: {
402
- type: "not_found",
403
- status: 404,
404
- message: `Contract not in registry: ${contractId}`
405
- }
406
- }, true);
407
- }
408
- const [address, contractName] = contractId.split(".");
409
- const name = (contractName ?? contractId).replace(/[^a-zA-Z0-9]/g, "_");
410
- const code = generateContractInterface([
411
- {
412
- name,
413
- address,
414
- contractName: contractName ?? "",
415
- abi: c.abi
416
- }
417
- ]);
418
- return { content: [{ type: "text", text: code }] };
419
- });
420
- }
421
-
422
- // src/tools/datasets.ts
423
- import { z as z3 } from "zod/v4";
424
- function registerDatasetTools(server, clientProvider = getClient) {
425
- 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 () => {
426
- const catalog = await clientProvider().datasets.listDatasets();
427
- return jsonResponse(catalog);
428
- });
429
- 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.', {
430
- slug: z3.string().describe("Dataset slug from datasets_list (e.g. stx-transfers)"),
431
- filters: z3.record(z3.string(), z3.string()).optional().describe("Documented per-dataset query params (snake_case values)"),
432
- limit: z3.number().optional().describe("Max rows for this page"),
433
- cursor: z3.string().optional().describe("Opaque cursor from a prior response's next_cursor")
434
- }, async ({ slug, filters, limit, cursor }) => {
435
- const params = { ...filters ?? {} };
436
- if (limit !== undefined)
437
- params.limit = limit;
438
- if (cursor !== undefined)
439
- params.cursor = cursor;
440
- const result = await clientProvider().datasets.get(slug, params);
441
- return jsonResponse(result);
442
- });
443
367
  }
444
368
 
445
369
  // src/tools/index.ts
446
- import { DECODED_EVENT_TYPES as DECODED_EVENT_TYPES2 } from "@secondlayer/shared";
447
- import {
448
- INDEX_CODEGEN_TABLES,
449
- generateIndexSchema
450
- } from "@secondlayer/subgraphs";
451
- import { z as z4 } from "zod/v4";
452
- var INDEX_EVENT_TYPES = DECODED_EVENT_TYPES2;
370
+ import { DECODED_EVENT_TYPES } from "@secondlayer/shared";
371
+ import { z as z3 } from "zod/v4";
372
+ var INDEX_EVENT_TYPES = DECODED_EVENT_TYPES;
453
373
  var rangeFilters = {
454
- contractId: z4.string().optional().describe("Filter by contract id"),
455
- fromHeight: z4.number().optional().describe("Start block height (inclusive)"),
456
- toHeight: z4.number().optional().describe("End block height (inclusive)"),
457
- cursor: z4.string().optional().describe("Opaque cursor from a prior response's next_cursor"),
458
- limit: z4.number().optional().describe("Max rows for this page")
374
+ contractId: z3.string().optional().describe("Filter by contract id"),
375
+ fromHeight: z3.number().optional().describe("Start block height (inclusive)"),
376
+ toHeight: z3.number().optional().describe("End block height (inclusive)"),
377
+ cursor: z3.string().optional().describe("Opaque cursor from a prior response's next_cursor"),
378
+ limit: z3.number().optional().describe("Max rows for this page")
459
379
  };
460
380
  var heightFilters = {
461
381
  fromHeight: rangeFilters.fromHeight,
@@ -463,126 +383,52 @@ var heightFilters = {
463
383
  cursor: rangeFilters.cursor,
464
384
  limit: rangeFilters.limit
465
385
  };
466
- var notFound = (message) => jsonResponse({ error: { type: "not_found", status: 404, message } }, true);
467
386
  function registerIndexTools(server, clientProvider = getClient) {
468
387
  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).", {
469
388
  ...rangeFilters,
470
- sender: z4.string().optional().describe("Filter by sender principal"),
471
- recipient: z4.string().optional().describe("Filter by recipient principal")
389
+ sender: z3.string().optional().describe("Filter by sender principal"),
390
+ recipient: z3.string().optional().describe("Filter by recipient principal")
472
391
  }, async (params) => jsonResponse(await clientProvider().index.ftTransfers.list(params)));
473
392
  defineTool(server, "index_nft_transfers", "List decoded SIP-009 non-fungible-token transfers from the Index. Anonymous reads allowed (free-tier keys rejected).", {
474
393
  ...rangeFilters,
475
- sender: z4.string().optional().describe("Filter by sender principal"),
476
- recipient: z4.string().optional().describe("Filter by recipient principal"),
477
- assetIdentifier: z4.string().optional().describe("Filter by asset identifier (contract::asset)")
394
+ sender: z3.string().optional().describe("Filter by sender principal"),
395
+ recipient: z3.string().optional().describe("Filter by recipient principal"),
396
+ assetIdentifier: z3.string().optional().describe("Filter by asset identifier (contract::asset)")
478
397
  }, async (params) => jsonResponse(await clientProvider().index.nftTransfers.list(params)));
479
398
  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.", {
480
- eventType: z4.enum(INDEX_EVENT_TYPES).describe("Required. Decoded event type to list."),
399
+ eventType: z3.enum(INDEX_EVENT_TYPES).describe("Required. Decoded event type to list."),
481
400
  ...rangeFilters,
482
- sender: z4.string().optional().describe("Filter by sender principal"),
483
- recipient: z4.string().optional().describe("Filter by recipient principal"),
484
- assetIdentifier: z4.string().optional().describe("Filter by asset identifier where applicable"),
485
- trait: z4.string().optional().describe("Match contracts conforming to a trait/standard (e.g. sip-010). Mutually exclusive with contractId; contract-keyed event types only.")
401
+ sender: z3.string().optional().describe("Filter by sender principal"),
402
+ recipient: z3.string().optional().describe("Filter by recipient principal"),
403
+ assetIdentifier: z3.string().optional().describe("Filter by asset identifier where applicable"),
404
+ 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.")
486
405
  }, async (params) => jsonResponse(await clientProvider().index.events.list(params)));
487
406
  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.", {
488
407
  ...rangeFilters,
489
- functionName: z4.string().optional().describe("Filter by called function name"),
490
- sender: z4.string().optional().describe("Filter by caller principal"),
491
- trait: z4.string().optional().describe("Match contracts conforming to a trait/standard (e.g. sip-010). Mutually exclusive with contractId.")
408
+ functionName: z3.string().optional().describe("Filter by called function name"),
409
+ sender: z3.string().optional().describe("Filter by caller principal"),
410
+ trait: z3.string().optional().describe("Match contracts conforming to a trait/standard (e.g. sip-010). Mutually exclusive with contractId.")
492
411
  }, async (params) => jsonResponse(await clientProvider().index.contractCalls.list(params)));
493
- 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)));
494
412
  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)));
495
- defineTool(server, "index_block", "Get a single block from the Index by height or block hash. Returns not_found if unknown.", {
496
- ref: z4.string().describe("Block height (digits) or block hash (0x… string)")
497
- }, async ({ ref }) => {
498
- const block = await clientProvider().index.blocks.get(/^\d+$/.test(ref) ? Number(ref) : ref);
499
- return block ? jsonResponse(block) : notFound(`No block for ref ${ref}`);
500
- });
501
413
  defineTool(server, "index_transactions", "List decoded transactions from the Index. Filter by type, sender, or contract. Anonymous reads allowed (free-tier keys rejected).", {
502
414
  ...rangeFilters,
503
- type: z4.string().optional().describe("Filter by transaction type"),
504
- sender: z4.string().optional().describe("Filter by sender principal")
415
+ type: z3.string().optional().describe("Filter by transaction type"),
416
+ sender: z3.string().optional().describe("Filter by sender principal")
505
417
  }, async (params) => jsonResponse(await clientProvider().index.transactions.list(params)));
506
- defineTool(server, "index_transaction", "Get a single transaction from the Index by tx_id. Returns not_found if unknown.", { txId: z4.string().describe("Transaction id (0x… hash)") }, async ({ txId }) => {
507
- const tx = await clientProvider().index.transactions.get(txId);
508
- return tx ? jsonResponse(tx) : notFound(`No transaction for ${txId}`);
509
- });
510
- 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: z4.string().describe("Transaction id (0x… hash)") }, async ({ txId }) => {
511
- const proof = await clientProvider().index.transactions.getProof(txId);
512
- return proof ? jsonResponse(proof) : notFound(`No proof available for ${txId}`);
513
- });
514
- 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).", {
515
- ...heightFilters,
516
- functionName: z4.string().optional().describe("Filter by PoX function name"),
517
- stacker: z4.string().optional().describe("Filter by stacker principal"),
518
- caller: z4.string().optional().describe("Filter by caller principal")
519
- }, async (params) => jsonResponse(await clientProvider().index.stacking.list(params)));
520
- 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).", {
521
- sender: z4.string().optional().describe("Filter by sender principal"),
522
- type: z4.string().optional().describe("Filter by transaction type"),
523
- contractId: z4.string().optional().describe("Filter to pending calls to a single contract"),
524
- cursor: z4.string().optional().describe("Opaque cursor from a prior response's next_cursor"),
525
- limit: z4.number().optional().describe("Max rows for this page")
526
- }, async (params) => jsonResponse(await clientProvider().index.mempool.list(params)));
527
- 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: z4.string().describe("Transaction id (0x… hash)") }, async ({ txId }) => {
528
- const tx = await clientProvider().index.mempool.get(txId);
529
- return tx ? jsonResponse(tx) : notFound(`No pending tx for ${txId}`);
530
- });
531
418
  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()));
532
- 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()));
533
- 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(", ")}.`, {
534
- target: z4.enum(["prisma", "kysely", "drizzle", "json-schema"]).optional().describe("Output target (default kysely)"),
535
- tables: z4.array(z4.string()).optional().describe("Subset of Index tables (default: all)"),
536
- schemaName: z4.string().optional().describe("Postgres schema to qualify table names with")
537
- }, async ({ target = "kysely", tables, schemaName }) => {
538
- const out = generateIndexSchema(target, { tables, schemaName });
539
- return { content: [{ type: "text", text: out }] };
540
- });
541
- }
542
-
543
- // src/tools/projects.ts
544
- import { z as z5 } from "zod/v4";
545
- function registerProjectTools(server, clientProvider = getClient) {
546
- defineTool(server, "project_list", "List the account's projects. Requires an account-level (owner) API key.", {}, async () => jsonResponse(await clientProvider().projects.list()));
547
- defineTool(server, "project_get", "Get a single project by slug.", { slug: z5.string().describe("Project slug") }, async ({ slug }) => jsonResponse(await clientProvider().projects.get(slug)));
548
- defineTool(server, "project_create", "Create a project. The slug is derived from the name when omitted. Requires an account-level (owner) API key.", {
549
- name: z5.string().describe("Project name"),
550
- slug: z5.string().optional().describe("URL slug (auto-derived from name if omitted)"),
551
- network: z5.string().optional().describe("Network (e.g. mainnet, testnet)"),
552
- nodeRpc: z5.string().optional().describe("Custom node RPC URL")
553
- }, async ({ name, slug, network, nodeRpc }) => jsonResponse(await clientProvider().projects.create({
554
- name,
555
- slug,
556
- network,
557
- nodeRpc
558
- })));
559
- defineTool(server, "project_update", "Update a project. `slug` selects the project; `newSlug` renames it. Requires an account-level (owner) API key.", {
560
- slug: z5.string().describe("Slug of the project to update"),
561
- newSlug: z5.string().optional().describe("New slug (renames the project)"),
562
- name: z5.string().optional().describe("New display name"),
563
- network: z5.string().optional().describe("Network (e.g. mainnet, testnet)"),
564
- nodeRpc: z5.string().optional().describe("Custom node RPC URL"),
565
- settings: z5.record(z5.string(), z5.unknown()).optional().describe("Arbitrary project settings to merge")
566
- }, async ({ slug, newSlug, name, network, nodeRpc, settings }) => jsonResponse(await clientProvider().projects.update(slug, {
567
- ...newSlug !== undefined ? { slug: newSlug } : {},
568
- ...name !== undefined ? { name } : {},
569
- ...network !== undefined ? { network } : {},
570
- ...nodeRpc !== undefined ? { nodeRpc } : {},
571
- ...settings !== undefined ? { settings } : {}
572
- })));
573
- defineTool(server, "project_delete", "Delete a project permanently. The account's last remaining project cannot be deleted.", { slug: z5.string().describe("Project slug") }, async ({ slug }) => jsonResponse(await clientProvider().projects.delete(slug)));
574
- defineTool(server, "project_team_list", "List a project's team members and pending invitations.", { slug: z5.string().describe("Project slug") }, async ({ slug }) => jsonResponse(await clientProvider().projects.team(slug)));
419
+ 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.", {
420
+ requests: z3.array(z3.object({
421
+ path: z3.string().describe("Public /v1 read path"),
422
+ params: z3.record(z3.string(), z3.string()).optional()
423
+ })).min(1).max(10).describe("Read descriptors, executed concurrently")
424
+ }, async (params) => jsonResponse(await clientProvider().batch(params.requests)));
575
425
  }
576
426
 
577
427
  // src/tools/scaffold.ts
578
- import {
579
- generateSubgraphCode,
580
- generateTraitSubgraph
581
- } from "@secondlayer/scaffold";
582
- import { TRAIT_STANDARDS as TRAIT_STANDARDS2 } from "@secondlayer/stacks/clarity";
583
- import { z as z6 } from "zod/v4";
584
- async function fetchAbi(contractId) {
585
- const contract = await getClient().contracts.get(contractId, {
428
+ import { generateSubgraphCode } from "@secondlayer/scaffold";
429
+ import { z as z4 } from "zod/v4";
430
+ async function fetchAbi(clientProvider, contractId) {
431
+ const contract = await clientProvider().contracts.get(contractId, {
586
432
  includeAbi: true
587
433
  });
588
434
  if (!contract)
@@ -593,134 +439,26 @@ async function fetchAbi(contractId) {
593
439
  }
594
440
  return { functions: abi.functions ?? [], maps: abi.maps ?? [] };
595
441
  }
596
- function registerScaffoldTools(server) {
597
- 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.", {
598
- trait: z6.enum(TRAIT_STANDARDS2).describe("SIP standard to index (sip-009 | sip-010 | sip-013)"),
599
- subgraphName: z6.string().optional().describe("Override the subgraph name (defaults to <trait>-transfers)")
600
- }, async ({ trait, subgraphName }) => {
601
- const code = generateTraitSubgraph({ trait, name: subgraphName });
602
- return { content: [{ type: "text", text: code }] };
603
- });
442
+ function registerScaffoldTools(server, clientProvider = getClient) {
604
443
  defineTool(server, "scaffold_from_contract", "Generate a subgraph scaffold from a deployed Stacks contract. Fetches the ABI automatically.", {
605
- contractId: z6.string().describe("Fully qualified contract ID (e.g. SP102V8P0F7JX67ARQ77WEA3D3CFB5XW39REDT0AM.amm-pool-v2-01)"),
606
- subgraphName: z6.string().optional().describe("Override the subgraph name (defaults to contract name)")
444
+ contractId: z4.string().describe("Fully qualified contract ID (e.g. SP102V8P0F7JX67ARQ77WEA3D3CFB5XW39REDT0AM.amm-pool-v2-01)"),
445
+ subgraphName: z4.string().optional().describe("Override the subgraph name (defaults to contract name)")
607
446
  }, async ({ contractId, subgraphName }) => {
608
- const { functions, maps } = await fetchAbi(contractId);
447
+ const { functions, maps } = await fetchAbi(clientProvider, contractId);
609
448
  const code = generateSubgraphCode(contractId, functions, subgraphName, maps);
610
449
  return { content: [{ type: "text", text: code }] };
611
450
  });
612
- defineTool(server, "scaffold_from_abi", "Generate a subgraph scaffold from a provided ABI JSON. Use when you already have the ABI.", {
613
- abi: z6.string().describe("ABI JSON string (the full contract ABI object)"),
614
- contractId: z6.string().describe("Fully qualified contract ID"),
615
- subgraphName: z6.string().optional().describe("Override the subgraph name")
616
- }, async ({ abi, contractId, subgraphName }) => {
617
- let parsed;
618
- try {
619
- parsed = JSON.parse(abi);
620
- } catch {
621
- return {
622
- content: [{ type: "text", text: "Invalid ABI JSON" }],
623
- isError: true
624
- };
625
- }
626
- const code = generateSubgraphCode(contractId, parsed.functions ?? [], subgraphName, parsed.maps ?? []);
627
- return { content: [{ type: "text", text: code }] };
628
- });
629
451
  }
630
452
 
631
453
  // src/tools/streams.ts
632
- import { AuthError } from "@secondlayer/sdk";
633
- import { DECODED_EVENT_TYPES as DECODED_EVENT_TYPES3 } from "@secondlayer/shared";
634
- import { z as z7 } from "zod/v4";
635
- var STREAMS_EVENT_TYPES = DECODED_EVENT_TYPES3;
636
- async function withStreamsAuthHint(fn) {
637
- try {
638
- return await fn();
639
- } catch (err) {
640
- if (err instanceof AuthError) {
641
- throw Object.assign(new Error(err.message + keyHint), { status: 401 });
642
- }
643
- throw err;
644
- }
645
- }
646
454
  function registerStreamsTools(server, clientProvider = getClient) {
647
- 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())));
648
- 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.", {
649
- types: z7.array(z7.enum(STREAMS_EVENT_TYPES)).optional().describe("Event types to include"),
650
- notTypes: z7.array(z7.enum(STREAMS_EVENT_TYPES)).optional().describe("Event types to exclude (applied after types)"),
651
- contractId: z7.string().optional().describe("Filter by contract id"),
652
- sender: z7.string().optional().describe("Filter by sender principal"),
653
- recipient: z7.string().optional().describe("Filter by recipient principal"),
654
- assetIdentifier: z7.string().optional().describe("Filter by asset identifier"),
655
- fromHeight: z7.number().optional().describe("Start block height (inclusive)"),
656
- toHeight: z7.number().optional().describe("End block height (inclusive)"),
657
- cursor: z7.string().optional().describe("Opaque cursor from a prior response"),
658
- limit: z7.number().optional().describe("Max events for this page")
659
- }, async (params) => withStreamsAuthHint(async () => jsonResponse(await clientProvider().streams.events.list(params))));
660
- 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).", {
661
- fromCursor: z7.string().optional().describe("Resume cursor from a prior consume (omit to start at genesis)"),
662
- types: z7.array(z7.enum(STREAMS_EVENT_TYPES)).optional().describe("Event types to include"),
663
- notTypes: z7.array(z7.enum(STREAMS_EVENT_TYPES)).optional().describe("Event types to exclude"),
664
- contractId: z7.string().optional().describe("Filter by contract id"),
665
- sender: z7.string().optional().describe("Filter by sender principal"),
666
- recipient: z7.string().optional().describe("Filter by recipient principal"),
667
- assetIdentifier: z7.string().optional().describe("Filter by asset identifier"),
668
- batchSize: z7.number().optional().describe("Events per page (1–1000, default 100)"),
669
- maxPages: z7.number().optional().describe("Max pages to walk this call (1–20, default 5)"),
670
- finalizedOnly: z7.boolean().optional().describe("Only emit finalized events; skip reorg handling")
671
- }, async (params) => withStreamsAuthHint(async () => {
672
- const maxPages = Math.min(Math.max(params.maxPages ?? 5, 1), 20);
673
- const batchSize = Math.min(Math.max(params.batchSize ?? 100, 1), 1000);
674
- const events = [];
675
- const reorgs = [];
676
- const result = await clientProvider().streams.events.consume({
677
- fromCursor: params.fromCursor ?? null,
678
- mode: "bounded",
679
- finalizedOnly: params.finalizedOnly,
680
- types: params.types,
681
- notTypes: params.notTypes,
682
- contractId: params.contractId,
683
- sender: params.sender,
684
- recipient: params.recipient,
685
- assetIdentifier: params.assetIdentifier,
686
- batchSize,
687
- maxPages,
688
- onBatch: (batch) => {
689
- events.push(...batch);
690
- },
691
- onReorg: (reorg) => {
692
- reorgs.push(reorg);
693
- }
694
- });
695
- return jsonResponse({
696
- events,
697
- reorgs,
698
- cursor: result.cursor,
699
- pages: result.pages
700
- });
701
- }));
702
- defineTool(server, "streams_event_by_txid", "List all Streams events emitted by a single transaction. Streams requires an API key (SL_API_KEY).", { txId: z7.string().describe("Transaction id (0x… hash)") }, async ({ txId }) => withStreamsAuthHint(async () => jsonResponse(await clientProvider().streams.events.byTxId(txId))));
703
- 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).", {
704
- heightOrHash: z7.string().describe("Block height (digits) or block hash (0x… string)")
705
- }, async ({ heightOrHash }) => withStreamsAuthHint(async () => jsonResponse(await clientProvider().streams.blocks.events(/^\d+$/.test(heightOrHash) ? Number(heightOrHash) : heightOrHash))));
706
- defineTool(server, "streams_reorgs", "List chain reorgs observed by Streams since a cursor. Streams requires an API key (SL_API_KEY).", {
707
- since: z7.string().describe("Cursor to list reorgs since (block:index or ISO timestamp)"),
708
- limit: z7.number().optional().describe("Max reorgs to return")
709
- }, async (params) => withStreamsAuthHint(async () => jsonResponse(await clientProvider().streams.reorgs.list(params))));
710
- 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: z7.number().describe("Block height") }, async ({ height }) => withStreamsAuthHint(async () => jsonResponse(await clientProvider().streams.canonical(height))));
711
- 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())));
712
- 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()));
455
+ 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). Live Streams reads (tip, events, consume) are REST-only: see /v1/streams/* in the OpenAPI spec.", {}, async () => jsonResponse(await clientProvider().streams.dumps.list()));
713
456
  }
714
457
 
715
458
  // src/tools/subgraphs.ts
716
459
  import { bundleSubgraphCode } from "@secondlayer/bundler";
717
460
  import { ByoBreakingChangeError } from "@secondlayer/sdk";
718
- import {
719
- generateDrizzleSchema,
720
- generateKyselySchema,
721
- generatePrismaSchema
722
- } from "@secondlayer/subgraphs";
723
- import { z as z8 } from "zod/v4";
461
+ import { z as z5 } from "zod/v4";
724
462
  function registerSubgraphTools(server, clientProvider = getClient) {
725
463
  defineTool(server, "subgraphs_list", "List all deployed subgraphs. Returns summary fields only, including visibility — public subgraphs are anon-readable at /v1/subgraphs/<name>.", {}, async () => {
726
464
  const { data } = await clientProvider().subgraphs.list();
@@ -733,38 +471,22 @@ function registerSubgraphTools(server, clientProvider = getClient) {
733
471
  ]
734
472
  };
735
473
  });
736
- defineTool(server, "subgraphs_get", "Get full details of a subgraph including schema, health, and table columns.", { name: z8.string().describe("Subgraph name") }, async ({ name }) => {
474
+ defineTool(server, "subgraphs_get", "Get full details of a subgraph including schema, health, and table columns.", { name: z5.string().describe("Subgraph name") }, async ({ name }) => {
737
475
  const detail = await clientProvider().subgraphs.get(name);
738
476
  return {
739
477
  content: [{ type: "text", text: JSON.stringify(detail, null, 2) }]
740
478
  };
741
479
  });
742
- defineTool(server, "subgraphs_spec", "Get generated API documentation for a subgraph. Defaults to compact agent schema; supports OpenAPI JSON and Markdown.", {
743
- name: z8.string().describe("Subgraph name"),
744
- format: z8.enum(["agent", "openapi", "markdown"]).optional().describe("Spec format to return. Defaults to agent."),
745
- serverUrl: z8.string().optional().describe("Override the server URL embedded in generated docs.")
746
- }, async ({ name, format = "agent", serverUrl }) => {
747
- const options = serverUrl ? { serverUrl } : undefined;
748
- const spec = format === "openapi" ? await clientProvider().subgraphs.openapi(name, options) : format === "markdown" ? await clientProvider().subgraphs.markdown(name, options) : await clientProvider().subgraphs.schema(name, options);
749
- return {
750
- content: [
751
- {
752
- type: "text",
753
- text: typeof spec === "string" ? spec : JSON.stringify(spec, null, 2)
754
- }
755
- ]
756
- };
757
- });
758
480
  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.', {
759
- name: z8.string().describe("Subgraph name"),
760
- table: z8.string().describe("Table name"),
761
- filters: z8.record(z8.string(), z8.string()).optional().describe('Column filters — plain values or with operators (e.g. {"amount.gte": "1000", "sender": "SP..."})'),
762
- sort: z8.string().optional().describe("Column to sort by"),
763
- order: z8.enum(["asc", "desc"]).optional().describe("Sort order"),
764
- limit: z8.number().max(200).optional().describe("Max rows (default 50, max 200)"),
765
- offset: z8.number().optional().describe("Offset for pagination"),
766
- fields: z8.string().optional().describe('Comma-separated column list to return (e.g. "sender,amount")'),
767
- count: z8.boolean().optional().describe("If true, return row count instead of rows")
481
+ name: z5.string().describe("Subgraph name"),
482
+ table: z5.string().describe("Table name"),
483
+ filters: z5.record(z5.string(), z5.string()).optional().describe('Column filters — plain values or with operators (e.g. {"amount.gte": "1000", "sender": "SP..."})'),
484
+ sort: z5.string().optional().describe("Column to sort by"),
485
+ order: z5.enum(["asc", "desc"]).optional().describe("Sort order"),
486
+ limit: z5.number().max(200).optional().describe("Max rows (default 50, max 200)"),
487
+ offset: z5.number().optional().describe("Offset for pagination"),
488
+ fields: z5.string().optional().describe('Comma-separated column list to return (e.g. "sender,amount")'),
489
+ count: z5.boolean().optional().describe("If true, return row count instead of rows")
768
490
  }, async ({
769
491
  name,
770
492
  table,
@@ -796,25 +518,10 @@ function registerSubgraphTools(server, clientProvider = getClient) {
796
518
  content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
797
519
  };
798
520
  });
799
- 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.`, {
800
- name: z8.string().describe("Subgraph name"),
801
- table: z8.string().describe("Table name"),
802
- filters: z8.record(z8.string(), z8.string()).optional().describe('Column filters — plain values or with operators (e.g. {"amount.gte": "1000", "sender": "SP..."})'),
803
- count: z8.boolean().optional().describe("Include COUNT(*) of matching rows"),
804
- countDistinct: z8.array(z8.string()).optional().describe("Columns to count distinct values of"),
805
- sum: z8.array(z8.string()).optional().describe("Numeric columns to sum (lossless string result)"),
806
- min: z8.array(z8.string()).optional().describe("Numeric columns to take the minimum of"),
807
- max: z8.array(z8.string()).optional().describe("Numeric columns to take the maximum of")
808
- }, async ({ name, table, filters, count, countDistinct, sum, min, max }) => {
809
- const result = await clientProvider().subgraphs.queryTableAggregate(name, table, { filters, count, countDistinct, sum, min, max });
810
- return {
811
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
812
- };
813
- });
814
- defineTool(server, "subgraphs_reindex", "Reindex a subgraph from a specific block range. Returns an operationId — poll subgraphs_operation to track progress to completion.", {
815
- name: z8.string().describe("Subgraph name"),
816
- fromBlock: z8.number().optional().describe("Start block (defaults to beginning)"),
817
- toBlock: z8.number().optional().describe("End block (defaults to latest)")
521
+ defineTool(server, "subgraphs_reindex", "Reindex a subgraph from a specific block range. Returns an operationId — check subgraphs_get (health) or the REST operations endpoint to track progress to completion.", {
522
+ name: z5.string().describe("Subgraph name"),
523
+ fromBlock: z5.number().optional().describe("Start block (defaults to beginning)"),
524
+ toBlock: z5.number().optional().describe("End block (defaults to latest)")
818
525
  }, async ({ name, fromBlock, toBlock }) => {
819
526
  const result = await clientProvider().subgraphs.reindex(name, {
820
527
  fromBlock,
@@ -824,19 +531,10 @@ function registerSubgraphTools(server, clientProvider = getClient) {
824
531
  content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
825
532
  };
826
533
  });
827
- 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.", {
828
- name: z8.string().describe("Subgraph name"),
829
- operationId: z8.string().optional().describe("Operation id from reindex/backfill/stop; omit to list recent operations")
830
- }, async ({ name, operationId }) => {
831
- const result = operationId ? await clientProvider().subgraphs.getOperation(name, operationId) : await clientProvider().subgraphs.operations(name);
832
- return {
833
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
834
- };
835
- });
836
- 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.", {
837
- name: z8.string().describe("Subgraph name"),
838
- fromBlock: z8.number().int().nonnegative().describe("Start block (inclusive)"),
839
- toBlock: z8.number().int().nonnegative().describe("End block (inclusive)")
534
+ 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 — check subgraphs_get (health) or the REST operations endpoint to track progress.", {
535
+ name: z5.string().describe("Subgraph name"),
536
+ fromBlock: z5.number().int().nonnegative().describe("Start block (inclusive)"),
537
+ toBlock: z5.number().int().nonnegative().describe("End block (inclusive)")
840
538
  }, async ({ name, fromBlock, toBlock }) => {
841
539
  const result = await clientProvider().subgraphs.backfill(name, {
842
540
  fromBlock,
@@ -846,17 +544,17 @@ function registerSubgraphTools(server, clientProvider = getClient) {
846
544
  content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
847
545
  };
848
546
  });
849
- 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: z8.string().describe("Subgraph name") }, async ({ name }) => {
547
+ defineTool(server, "subgraphs_stop", "Cancel an in-flight reindex or backfill operation for a subgraph. Returns the stop request status; check subgraphs_get (health) or the REST operations endpoint to confirm it reaches a terminal state.", { name: z5.string().describe("Subgraph name") }, async ({ name }) => {
850
548
  const result = await clientProvider().subgraphs.stop(name);
851
549
  return {
852
550
  content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
853
551
  };
854
552
  });
855
553
  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.", {
856
- name: z8.string().describe("Subgraph name"),
857
- limit: z8.number().int().positive().optional().describe("Max gaps to return"),
858
- offset: z8.number().int().nonnegative().optional().describe("Pagination offset"),
859
- resolved: z8.boolean().optional().describe("Filter by resolved state (omit for unresolved only)")
554
+ name: z5.string().describe("Subgraph name"),
555
+ limit: z5.number().int().positive().optional().describe("Max gaps to return"),
556
+ offset: z5.number().int().nonnegative().optional().describe("Pagination offset"),
557
+ resolved: z5.boolean().optional().describe("Filter by resolved state (omit for unresolved only)")
860
558
  }, async ({ name, limit, offset, resolved }) => {
861
559
  const result = await clientProvider().subgraphs.gaps(name, {
862
560
  limit,
@@ -867,16 +565,16 @@ function registerSubgraphTools(server, clientProvider = getClient) {
867
565
  content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
868
566
  };
869
567
  });
870
- defineTool(server, "subgraphs_delete", "Delete a subgraph permanently.", { name: z8.string().describe("Subgraph name") }, async ({ name }) => {
568
+ defineTool(server, "subgraphs_delete", "Delete a subgraph permanently.", { name: z5.string().describe("Subgraph name") }, async ({ name }) => {
871
569
  const result = await clientProvider().subgraphs.delete(name);
872
570
  return { content: [{ type: "text", text: result.message }] };
873
571
  });
874
572
  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.", {
875
- code: z8.string().describe("TypeScript source code containing a defineSubgraph() call"),
876
- startBlock: z8.number().int().nonnegative().optional().describe("Override the definition startBlock for this deploy"),
877
- databaseUrl: z8.string().optional().describe("BYO data plane: Postgres connection string to host the subgraph's schema and rows in your own database"),
878
- dryRun: z8.boolean().optional().describe("Validate and preview the deploy (schema/DDL, BYO connection) without writing changes"),
879
- visibility: z8.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.")
573
+ code: z5.string().describe("TypeScript source code containing a defineSubgraph() call"),
574
+ startBlock: z5.number().int().nonnegative().optional().describe("Override the definition startBlock for this deploy"),
575
+ databaseUrl: z5.string().optional().describe("BYO data plane: Postgres connection string to host the subgraph's schema and rows in your own database"),
576
+ dryRun: z5.boolean().optional().describe("Validate and preview the deploy (schema/DDL, BYO connection) without writing changes"),
577
+ visibility: z5.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.")
880
578
  }, async ({ code, startBlock, databaseUrl, dryRun, visibility }) => {
881
579
  const bundled = await bundleSubgraphCode(code);
882
580
  try {
@@ -910,58 +608,23 @@ function registerSubgraphTools(server, clientProvider = getClient) {
910
608
  throw err;
911
609
  }
912
610
  });
913
- 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: z8.string().describe("Subgraph name") }, async ({ name }) => {
611
+ 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: z5.string().describe("Subgraph name") }, async ({ name }) => {
914
612
  const result = await clientProvider().subgraphs.publish(name);
915
613
  return {
916
614
  content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
917
615
  };
918
616
  });
919
- 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: z8.string().describe("Subgraph name") }, async ({ name }) => {
617
+ 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: z5.string().describe("Subgraph name") }, async ({ name }) => {
920
618
  const result = await clientProvider().subgraphs.unpublish(name);
921
619
  return {
922
620
  content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
923
621
  };
924
622
  });
925
- 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: z8.string().describe("Subgraph name") }, async ({ name }) => {
926
- const source = await clientProvider().subgraphs.getSource(name);
927
- return {
928
- content: [{ type: "text", text: JSON.stringify(source, null, 2) }]
929
- };
930
- });
931
- 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.", {
932
- code: z8.string().optional().describe("defineSubgraph() source (mutually exclusive with name)"),
933
- name: z8.string().optional().describe("Deployed subgraph name (mutually exclusive with code)"),
934
- target: z8.enum(["prisma", "drizzle", "kysely"]).optional().describe("ORM target (default prisma)"),
935
- schemaName: z8.string().optional().describe("Postgres schema name (defaults to subgraph_<name>)")
936
- }, async ({ code, name, target = "prisma", schemaName }) => {
937
- if (code && name || !code && !name) {
938
- throw new Error("Provide exactly one of `code` or `name`.");
939
- }
940
- let source = code;
941
- if (name) {
942
- const stored = await clientProvider().subgraphs.getSource(name);
943
- if (!stored.sourceCode) {
944
- throw new Error(`Subgraph "${name}" has no captured source (deployed before source capture). Redeploy it, or pass its source as \`code\`.`);
945
- }
946
- source = stored.sourceCode;
947
- }
948
- const bundled = await bundleSubgraphCode(source);
949
- const def = {
950
- name: bundled.name,
951
- version: bundled.version,
952
- description: bundled.description,
953
- sources: bundled.sources,
954
- schema: bundled.schema,
955
- handlers: {}
956
- };
957
- const out = target === "drizzle" ? generateDrizzleSchema(def, { schemaName }) : target === "kysely" ? generateKyselySchema(def, { schemaName }) : generatePrismaSchema(def, { schemaName });
958
- return { content: [{ type: "text", text: out }] };
959
- });
960
623
  }
961
624
 
962
625
  // src/tools/subscriptions.ts
963
626
  import { CHAIN_TRIGGER_TYPES } from "@secondlayer/shared";
964
- import { z as z9 } from "zod/v4";
627
+ import { z as z6 } from "zod/v4";
965
628
  function registerSubscriptionTools(server, clientProvider = getClient) {
966
629
  defineTool(server, "subscriptions_list", "List all subscriptions for the current account. Returns summary fields (no secrets).", {}, async () => {
967
630
  const { data } = await clientProvider().subscriptions.list();
@@ -969,34 +632,34 @@ function registerSubscriptionTools(server, clientProvider = getClient) {
969
632
  content: [{ type: "text", text: JSON.stringify(data, null, 2) }]
970
633
  };
971
634
  });
972
- defineTool(server, "subscriptions_get", "Get full detail for a subscription (filter, auth, retry config, circuit state).", { id: z9.string().describe("Subscription id") }, async ({ id }) => {
635
+ defineTool(server, "subscriptions_get", "Get full detail for a subscription (filter, auth, retry config, circuit state).", { id: z6.string().describe("Subscription id") }, async ({ id }) => {
973
636
  const detail = await clientProvider().subscriptions.get(id);
974
637
  return {
975
638
  content: [{ type: "text", text: JSON.stringify(detail, null, 2) }]
976
639
  };
977
640
  });
978
641
  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.", {
979
- name: z9.string().describe("Human-readable name, unique per account"),
980
- subgraphName: z9.string().optional().describe("Subgraph to subscribe to (subgraph subscription)"),
981
- tableName: z9.string().optional().describe("Table within the subgraph (subgraph subscription)"),
982
- triggers: z9.array(z9.object({
983
- type: z9.enum(CHAIN_TRIGGER_TYPES),
984
- contractId: z9.string().optional(),
985
- functionName: z9.string().optional(),
986
- caller: z9.string().optional(),
987
- sender: z9.string().optional(),
988
- recipient: z9.string().optional(),
989
- assetIdentifier: z9.string().optional(),
990
- deployer: z9.string().optional(),
991
- contractName: z9.string().optional(),
992
- topic: z9.string().optional(),
993
- lockedAddress: z9.string().optional(),
994
- trait: z9.string().optional(),
995
- minAmount: z9.union([z9.string(), z9.number()]).optional(),
996
- maxAmount: z9.union([z9.string(), z9.number()]).optional()
642
+ name: z6.string().describe("Human-readable name, unique per account"),
643
+ subgraphName: z6.string().optional().describe("Subgraph to subscribe to (subgraph subscription)"),
644
+ tableName: z6.string().optional().describe("Table within the subgraph (subgraph subscription)"),
645
+ triggers: z6.array(z6.object({
646
+ type: z6.enum(CHAIN_TRIGGER_TYPES),
647
+ contractId: z6.string().optional(),
648
+ functionName: z6.string().optional(),
649
+ caller: z6.string().optional(),
650
+ sender: z6.string().optional(),
651
+ recipient: z6.string().optional(),
652
+ assetIdentifier: z6.string().optional(),
653
+ deployer: z6.string().optional(),
654
+ contractName: z6.string().optional(),
655
+ topic: z6.string().optional(),
656
+ lockedAddress: z6.string().optional(),
657
+ trait: z6.string().optional(),
658
+ minAmount: z6.union([z6.string(), z6.number()]).optional(),
659
+ maxAmount: z6.union([z6.string(), z6.number()]).optional()
997
660
  })).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."),
998
- url: z9.string().describe("Webhook URL"),
999
- format: z9.enum([
661
+ url: z6.string().describe("Webhook URL"),
662
+ format: z6.enum([
1000
663
  "standard-webhooks",
1001
664
  "inngest",
1002
665
  "trigger",
@@ -1004,9 +667,9 @@ function registerSubscriptionTools(server, clientProvider = getClient) {
1004
667
  "cloudevents",
1005
668
  "raw"
1006
669
  ]).optional().describe("Wire format (default standard-webhooks)"),
1007
- runtime: z9.enum(["inngest", "trigger", "cloudflare", "node"]).optional().describe("Receiver runtime label (display only)"),
1008
- filter: z9.record(z9.string(), z9.unknown()).optional().describe('Scalar filter DSL, e.g. {"amount": {"gte": 100}, "sender": "SP..."}'),
1009
- authConfig: z9.record(z9.string(), z9.unknown()).optional().describe('Receiver auth sent with each delivery, e.g. {"type": "bearer", "token": "..."}')
670
+ runtime: z6.enum(["inngest", "trigger", "cloudflare", "node"]).optional().describe("Receiver runtime label (display only)"),
671
+ filter: z6.record(z6.string(), z6.unknown()).optional().describe('Scalar filter DSL, e.g. {"amount": {"gte": 100}, "sender": "SP..."}'),
672
+ authConfig: z6.record(z6.string(), z6.unknown()).optional().describe('Receiver auth sent with each delivery, e.g. {"type": "bearer", "token": "..."}')
1010
673
  }, async (input) => {
1011
674
  const res = await clientProvider().subscriptions.create(input);
1012
675
  return {
@@ -1014,12 +677,12 @@ function registerSubscriptionTools(server, clientProvider = getClient) {
1014
677
  };
1015
678
  });
1016
679
  defineTool(server, "subscriptions_update", "Patch a subscription (name, url, filter, authConfig, format, runtime, retry, timeout, concurrency).", {
1017
- id: z9.string(),
1018
- name: z9.string().optional().describe("Rename the subscription"),
1019
- url: z9.string().optional(),
1020
- filter: z9.record(z9.string(), z9.unknown()).optional(),
1021
- authConfig: z9.record(z9.string(), z9.unknown()).optional().describe("Receiver auth sent with each delivery (bearer/etc.)"),
1022
- format: z9.enum([
680
+ id: z6.string(),
681
+ name: z6.string().optional().describe("Rename the subscription"),
682
+ url: z6.string().optional(),
683
+ filter: z6.record(z6.string(), z6.unknown()).optional(),
684
+ authConfig: z6.record(z6.string(), z6.unknown()).optional().describe("Receiver auth sent with each delivery (bearer/etc.)"),
685
+ format: z6.enum([
1023
686
  "standard-webhooks",
1024
687
  "inngest",
1025
688
  "trigger",
@@ -1027,51 +690,33 @@ function registerSubscriptionTools(server, clientProvider = getClient) {
1027
690
  "cloudevents",
1028
691
  "raw"
1029
692
  ]).optional(),
1030
- runtime: z9.enum(["inngest", "trigger", "cloudflare", "node"]).nullable().optional(),
1031
- maxRetries: z9.number().int().min(0).optional(),
1032
- timeoutMs: z9.number().int().min(100).optional(),
1033
- concurrency: z9.number().int().min(1).optional()
693
+ runtime: z6.enum(["inngest", "trigger", "cloudflare", "node"]).nullable().optional(),
694
+ maxRetries: z6.number().int().min(0).optional(),
695
+ timeoutMs: z6.number().int().min(100).optional(),
696
+ concurrency: z6.number().int().min(1).optional()
1034
697
  }, async ({ id, ...patch }) => {
1035
698
  const res = await clientProvider().subscriptions.update(id, patch);
1036
699
  return {
1037
700
  content: [{ type: "text", text: JSON.stringify(res, null, 2) }]
1038
701
  };
1039
702
  });
1040
- defineTool(server, "subscriptions_pause", "Pause a subscription. Pending rows remain queued until resumed.", { id: z9.string() }, async ({ id }) => {
1041
- const res = await clientProvider().subscriptions.pause(id);
1042
- return {
1043
- content: [{ type: "text", text: JSON.stringify(res, null, 2) }]
1044
- };
1045
- });
1046
- defineTool(server, "subscriptions_resume", "Resume a paused or circuit-open subscription and reset circuit failures.", { id: z9.string() }, async ({ id }) => {
1047
- const res = await clientProvider().subscriptions.resume(id);
1048
- return {
1049
- content: [{ type: "text", text: JSON.stringify(res, null, 2) }]
1050
- };
1051
- });
1052
- defineTool(server, "subscriptions_delete", "Delete a subscription. Pending outbox rows are cascade-deleted.", { id: z9.string() }, async ({ id }) => {
703
+ defineTool(server, "subscriptions_delete", "Delete a subscription. Pending outbox rows are cascade-deleted.", { id: z6.string() }, async ({ id }) => {
1053
704
  const res = await clientProvider().subscriptions.delete(id);
1054
705
  return {
1055
706
  content: [{ type: "text", text: JSON.stringify(res, null, 2) }]
1056
707
  };
1057
708
  });
1058
- defineTool(server, "subscriptions_rotate_secret", "Rotate a subscription signing secret. Returns the new plaintext secret once.", { id: z9.string() }, async ({ id }) => {
1059
- const res = await clientProvider().subscriptions.rotateSecret(id);
1060
- return {
1061
- content: [{ type: "text", text: JSON.stringify(res, null, 2) }]
1062
- };
1063
- });
1064
- 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: z9.string().describe("Subscription id") }, async ({ id }) => {
709
+ 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. Returns {ok, statusCode, error, durationMs, deliveryId}.", { id: z6.string().describe("Subscription id") }, async ({ id }) => {
1065
710
  const res = await clientProvider().subscriptions.test(id);
1066
711
  return {
1067
712
  content: [{ type: "text", text: JSON.stringify(res, null, 2) }]
1068
713
  };
1069
714
  });
1070
715
  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.", {
1071
- id: z9.string(),
1072
- fromBlock: z9.number().int().nonnegative(),
1073
- toBlock: z9.number().int().nonnegative(),
1074
- force: z9.string().optional().describe("Idempotency suffix to force a duplicate replay of the range")
716
+ id: z6.string(),
717
+ fromBlock: z6.number().int().nonnegative(),
718
+ toBlock: z6.number().int().nonnegative(),
719
+ force: z6.string().optional().describe("Idempotency suffix to force a duplicate replay of the range")
1075
720
  }, async ({ id, fromBlock, toBlock, force }) => {
1076
721
  const res = await clientProvider().subscriptions.replay(id, {
1077
722
  fromBlock,
@@ -1082,27 +727,6 @@ function registerSubscriptionTools(server, clientProvider = getClient) {
1082
727
  content: [{ type: "text", text: JSON.stringify(res, null, 2) }]
1083
728
  };
1084
729
  });
1085
- defineTool(server, "subscriptions_dead", "Return the last 100 dead-letter outbox rows for a subscription.", { id: z9.string() }, async ({ id }) => {
1086
- const { data } = await clientProvider().subscriptions.dead(id);
1087
- return {
1088
- content: [{ type: "text", text: JSON.stringify(data, null, 2) }]
1089
- };
1090
- });
1091
- defineTool(server, "subscriptions_requeue_dead", "Requeue one dead-letter outbox row for delivery retry.", {
1092
- id: z9.string(),
1093
- outboxId: z9.string()
1094
- }, async ({ id, outboxId }) => {
1095
- const res = await clientProvider().subscriptions.requeueDead(id, outboxId);
1096
- return {
1097
- content: [{ type: "text", text: JSON.stringify(res, null, 2) }]
1098
- };
1099
- });
1100
- defineTool(server, "subscriptions_recent_deliveries", "Return the last 100 delivery attempts (attempt #, status code, duration, truncated response).", { id: z9.string() }, async ({ id }) => {
1101
- const { data } = await clientProvider().subscriptions.recentDeliveries(id);
1102
- return {
1103
- content: [{ type: "text", text: JSON.stringify(data, null, 2) }]
1104
- };
1105
- });
1106
730
  }
1107
731
 
1108
732
  // src/server.ts
@@ -1117,8 +741,6 @@ function createServer() {
1117
741
  registerSubgraphTools(server);
1118
742
  registerSubscriptionTools(server);
1119
743
  registerAccountTools(server);
1120
- registerProjectTools(server);
1121
- registerDatasetTools(server);
1122
744
  registerIndexTools(server);
1123
745
  registerStreamsTools(server);
1124
746
  registerContractTools(server);
@@ -1129,5 +751,5 @@ export {
1129
751
  createServer
1130
752
  };
1131
753
 
1132
- //# debugId=00B1F28CFDA24A4764756E2164756E21
754
+ //# debugId=8F902CFB975F717764756E2164756E21
1133
755
  //# sourceMappingURL=index.js.map