@secondlayer/mcp 11.6.0 → 11.6.2
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/bin-http.js +164 -98
- package/dist/bin-http.js.map +9 -7
- package/dist/bin.js +89 -84
- package/dist/bin.js.map +7 -6
- package/dist/index.js +89 -84
- package/dist/index.js.map +7 -6
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
isHostedApiUrl,
|
|
5
5
|
resolveAccountKey,
|
|
6
6
|
resolveApiKey,
|
|
7
|
-
resolveBaseUrl
|
|
7
|
+
resolveBaseUrl,
|
|
8
|
+
resolveIdentity
|
|
8
9
|
} from "@secondlayer/sdk";
|
|
9
10
|
var instance = null;
|
|
10
11
|
var HOSTED_KEY_HINT = "set SECONDLAYER_API_KEY (sk-sl_*) for credits; INSTANCE_TOKEN is the instance";
|
|
11
|
-
var DEFAULT_ARCHIVE_OPS_URL = "https://api.secondlayer.tools";
|
|
12
12
|
function readApiKey() {
|
|
13
13
|
return resolveApiKey(undefined, resolveBaseUrl());
|
|
14
14
|
}
|
|
@@ -26,19 +26,15 @@ function getClient() {
|
|
|
26
26
|
}
|
|
27
27
|
return instance;
|
|
28
28
|
}
|
|
29
|
-
function readArchiveApiKey() {
|
|
30
|
-
return resolveAccountKey();
|
|
31
|
-
}
|
|
32
29
|
function getArchiveOpsClient() {
|
|
33
|
-
const
|
|
34
|
-
if (!
|
|
30
|
+
const { token, url } = resolveIdentity("account");
|
|
31
|
+
if (!token) {
|
|
35
32
|
throw new Error(HOSTED_KEY_HINT);
|
|
36
33
|
}
|
|
37
|
-
const archiveOpsUrl = process.env.SL_CREDITS_API_URL || process.env.ARCHIVE_OPS_API_URL || DEFAULT_ARCHIVE_OPS_URL;
|
|
38
34
|
return new SecondLayer({
|
|
39
|
-
accountKey,
|
|
35
|
+
accountKey: token,
|
|
40
36
|
origin: "mcp",
|
|
41
|
-
archiveOpsUrl
|
|
37
|
+
archiveOpsUrl: url
|
|
42
38
|
});
|
|
43
39
|
}
|
|
44
40
|
function keyHint(baseUrl = resolveBaseUrl()) {
|
|
@@ -867,7 +863,16 @@ import { DECODED_EVENT_TYPES as DECODED_EVENT_TYPES2 } from "@secondlayer/shared
|
|
|
867
863
|
import {
|
|
868
864
|
runSubgraphTest
|
|
869
865
|
} from "@secondlayer/subgraphs/testing";
|
|
866
|
+
import { z as z10 } from "zod";
|
|
867
|
+
|
|
868
|
+
// src/lib/ids.ts
|
|
870
869
|
import { z as z9 } from "zod";
|
|
870
|
+
var uuidSchema = z9.string().uuid();
|
|
871
|
+
var webhookIdSchema = uuidSchema.describe("Webhook id");
|
|
872
|
+
var subgraphNameSchema = z9.string().min(1).max(63).regex(/^[a-z0-9-]+$/, "lowercase alphanumeric + hyphens only").describe("Subgraph name");
|
|
873
|
+
var tableNameSchema = z9.string().min(1).max(63).regex(/^[a-z_][a-z0-9_]*$/i, "letters, digits and underscores only").describe("Table name");
|
|
874
|
+
|
|
875
|
+
// src/tools/subgraphs.ts
|
|
871
876
|
function eventTypeFor(filter) {
|
|
872
877
|
if (filter.type === "contract_deploy")
|
|
873
878
|
return null;
|
|
@@ -893,13 +898,13 @@ function registerSubgraphTools(server, clientProvider = getClient) {
|
|
|
893
898
|
const { data } = await clientProvider().subgraphs.list();
|
|
894
899
|
return jsonResponse(data.map(formatSubgraphSummary));
|
|
895
900
|
});
|
|
896
|
-
defineTool(server, "subgraphs_status", "Get full details of a subgraph including schema, health (incl. health.emptyMapping when processed events wrote 0 rows), and table columns.", { name:
|
|
901
|
+
defineTool(server, "subgraphs_status", "Get full details of a subgraph including schema, health (incl. health.emptyMapping when processed events wrote 0 rows), and table columns.", { name: subgraphNameSchema }, async ({ name }) => {
|
|
897
902
|
const detail = await clientProvider().subgraphs.status(name);
|
|
898
903
|
return jsonResponse(detail);
|
|
899
904
|
});
|
|
900
905
|
defineTool(server, "subgraphs_spec", "Fetch a subgraph's self-describing spec — the tables, columns, filters, and read URLs a consumer needs, without guessing. `agent` (default) returns the compact JSON schema built for tool use, `openapi` the OpenAPI document for the subgraph's read routes, `markdown` human-readable docs. Read it before writing queries against an unfamiliar subgraph.", {
|
|
901
|
-
name:
|
|
902
|
-
format:
|
|
906
|
+
name: subgraphNameSchema,
|
|
907
|
+
format: z10.enum(["agent", "openapi", "markdown"]).optional().describe("agent = JSON schema for tool use (default), openapi = OpenAPI JSON, markdown = docs.md")
|
|
903
908
|
}, async ({ name, format }) => {
|
|
904
909
|
const client = clientProvider();
|
|
905
910
|
if (format === "openapi")
|
|
@@ -909,15 +914,15 @@ function registerSubgraphTools(server, clientProvider = getClient) {
|
|
|
909
914
|
return jsonResponse(await client.subgraphs.schema(name));
|
|
910
915
|
});
|
|
911
916
|
defineTool(server, "subgraphs_query", 'Query rows from a subgraph table (max 200 rows), reading the open /v1 surface — { rows, next_cursor, tip } envelope, cursor-paginated (no offset). Filters support operators: "amount.gte": "1000", "sender.neq": "SP...", "name.like": "%token%". Available operators: eq, neq, gt, gte, lt, lte, like. Every page with rows returns next_cursor (null only when empty): pass it back as `cursor` to read the next page. To TAIL new rows (no streaming over MCP), poll with cursor = next_cursor ?? the cursor you sent. Fetch one row by id with {"_id": "<id>"}. The same rows are readable over HTTP at GET /v1/subgraphs/<name>/<table>; hand that URL to third parties.', {
|
|
912
|
-
name:
|
|
913
|
-
table:
|
|
914
|
-
filters:
|
|
915
|
-
sort:
|
|
916
|
-
order:
|
|
917
|
-
limit:
|
|
918
|
-
cursor:
|
|
919
|
-
fields:
|
|
920
|
-
count:
|
|
917
|
+
name: subgraphNameSchema,
|
|
918
|
+
table: tableNameSchema,
|
|
919
|
+
filters: z10.record(z10.string(), z10.string()).optional().describe('Column filters — plain values or with operators (e.g. {"amount.gte": "1000", "sender": "SP..."})'),
|
|
920
|
+
sort: z10.string().optional().describe("Column to sort by"),
|
|
921
|
+
order: z10.enum(["asc", "desc"]).optional().describe("Sort order"),
|
|
922
|
+
limit: z10.number().max(200).optional().describe("Max rows (default 50, max 200)"),
|
|
923
|
+
cursor: z10.string().optional().describe("Resume from a previous response's nextCursor"),
|
|
924
|
+
fields: z10.string().optional().describe('Comma-separated column list to return (e.g. "sender,amount")'),
|
|
925
|
+
count: z10.boolean().optional().describe("If true, return row count instead of rows")
|
|
921
926
|
}, async ({
|
|
922
927
|
name,
|
|
923
928
|
table,
|
|
@@ -947,15 +952,15 @@ function registerSubgraphTools(server, clientProvider = getClient) {
|
|
|
947
952
|
return jsonResponse({ ...capped, nextCursor: next_cursor, tip });
|
|
948
953
|
});
|
|
949
954
|
defineTool(server, "subgraphs_reindex", "Reindex a subgraph: drops and rebuilds the whole subgraph from its start block to chain tip. Takes no block range — use subgraphs_backfill to process a specific range. Returns an operationId — check subgraphs_status (health) or the REST operations endpoint to track progress to completion.", {
|
|
950
|
-
name:
|
|
955
|
+
name: subgraphNameSchema
|
|
951
956
|
}, async ({ name }) => {
|
|
952
957
|
const result = await clientProvider().subgraphs.reindex(name);
|
|
953
958
|
return jsonResponse(result);
|
|
954
959
|
});
|
|
955
960
|
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_status (health) or the REST operations endpoint to track progress.", {
|
|
956
|
-
name:
|
|
957
|
-
fromBlock:
|
|
958
|
-
toBlock:
|
|
961
|
+
name: subgraphNameSchema,
|
|
962
|
+
fromBlock: z10.number().int().nonnegative().describe("Start block (inclusive)"),
|
|
963
|
+
toBlock: z10.number().int().nonnegative().describe("End block (inclusive)")
|
|
959
964
|
}, async ({ name, fromBlock, toBlock }) => {
|
|
960
965
|
const result = await clientProvider().subgraphs.backfill(name, {
|
|
961
966
|
fromBlock,
|
|
@@ -963,15 +968,15 @@ function registerSubgraphTools(server, clientProvider = getClient) {
|
|
|
963
968
|
});
|
|
964
969
|
return jsonResponse(result);
|
|
965
970
|
});
|
|
966
|
-
defineTool(server, "subgraphs_stop", "Cancel an in-flight reindex or backfill operation for a subgraph. Returns the stop request status; check subgraphs_status (health) or the REST operations endpoint to confirm it reaches a terminal state.", { name:
|
|
971
|
+
defineTool(server, "subgraphs_stop", "Cancel an in-flight reindex or backfill operation for a subgraph. Returns the stop request status; check subgraphs_status (health) or the REST operations endpoint to confirm it reaches a terminal state.", { name: subgraphNameSchema }, async ({ name }) => {
|
|
967
972
|
const result = await clientProvider().subgraphs.stop(name);
|
|
968
973
|
return jsonResponse(result);
|
|
969
974
|
});
|
|
970
975
|
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.", {
|
|
971
|
-
name:
|
|
972
|
-
limit:
|
|
973
|
-
offset:
|
|
974
|
-
resolved:
|
|
976
|
+
name: subgraphNameSchema,
|
|
977
|
+
limit: z10.number().int().positive().optional().describe("Max gaps to return"),
|
|
978
|
+
offset: z10.number().int().nonnegative().optional().describe("Pagination offset"),
|
|
979
|
+
resolved: z10.boolean().optional().describe("Filter by resolved state (omit for unresolved only)")
|
|
975
980
|
}, async ({ name, limit, offset, resolved }) => {
|
|
976
981
|
const result = await clientProvider().subgraphs.gaps(name, {
|
|
977
982
|
limit,
|
|
@@ -981,20 +986,20 @@ function registerSubgraphTools(server, clientProvider = getClient) {
|
|
|
981
986
|
return jsonResponse(result);
|
|
982
987
|
});
|
|
983
988
|
defineTool(server, "subgraphs_operations", "Operation history for a subgraph (deploy/reindex/backfill/stop), newest first — status, block range, progress, and error. THIS IS THE VERIFY CALL: after subgraphs_deploy, subgraphs_reindex, subgraphs_backfill, or subgraphs_stop, poll it with the returned operationId until `status` is terminal (completed/failed/cancelled) before reporting success. Omit operationId for the recent history.", {
|
|
984
|
-
name:
|
|
985
|
-
operationId:
|
|
989
|
+
name: subgraphNameSchema,
|
|
990
|
+
operationId: z10.string().optional().describe("Fetch one operation by id (the operationId returned by reindex/backfill/stop); omit for recent history")
|
|
986
991
|
}, async ({ name, operationId }) => {
|
|
987
992
|
const client = clientProvider();
|
|
988
993
|
return jsonResponse(operationId ? await client.subgraphs.getOperation(name, operationId) : await client.subgraphs.operations(name));
|
|
989
994
|
});
|
|
990
|
-
defineTool(server, "subgraphs_delete", "Delete a subgraph permanently.", { name:
|
|
995
|
+
defineTool(server, "subgraphs_delete", "Delete a subgraph permanently.", { name: subgraphNameSchema }, async ({ name }) => {
|
|
991
996
|
const result = await clientProvider().subgraphs.delete(name);
|
|
992
997
|
return textResponse(result.message);
|
|
993
998
|
});
|
|
994
999
|
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. dryRun validates schema/DDL only and does not run handlers — call subgraphs_test first and deploy only when it returns ok: true with written >= 1. Call subgraphs_reindex separately if you need a forced reindex.", {
|
|
995
|
-
code:
|
|
996
|
-
startBlock:
|
|
997
|
-
dryRun:
|
|
1000
|
+
code: z10.string().describe("TypeScript source code containing a defineSubgraph() call"),
|
|
1001
|
+
startBlock: z10.number().int().nonnegative().optional().describe("Override the definition startBlock for this deploy"),
|
|
1002
|
+
dryRun: z10.boolean().optional().describe("Validate schema/DDL only — does not run handlers. Use subgraphs_test to prove a mapping writes rows.")
|
|
998
1003
|
}, async ({ code, startBlock, dryRun }) => {
|
|
999
1004
|
const bundled = await bundleSubgraphCode(code);
|
|
1000
1005
|
const result = await clientProvider().subgraphs.deploy({
|
|
@@ -1010,10 +1015,10 @@ function registerSubgraphTools(server, clientProvider = getClient) {
|
|
|
1010
1015
|
return jsonResponse(result);
|
|
1011
1016
|
});
|
|
1012
1017
|
defineTool(server, "subgraphs_test", "Prove a subgraph mapping writes rows against Index data before deploy. Pass full defineSubgraph() source plus a height range. Returns ok/written/tables; EMPTY_MAPPING means events matched but 0 rows were written — read hint for observed event.data keys and do not invent fields. subgraphs_deploy dryRun is DDL only; do not deploy until ok: true with written >= 1.", {
|
|
1013
|
-
code:
|
|
1014
|
-
fromHeight:
|
|
1015
|
-
toHeight:
|
|
1016
|
-
limit:
|
|
1018
|
+
code: z10.string().describe("TypeScript source containing a defineSubgraph() call"),
|
|
1019
|
+
fromHeight: z10.number().int().nonnegative().describe("Start block height (inclusive)"),
|
|
1020
|
+
toHeight: z10.number().int().nonnegative().optional().describe("End block height (inclusive); default fromHeight+100"),
|
|
1021
|
+
limit: z10.number().int().positive().max(200).optional().describe("Max Index rows per source (default 50, max 200)")
|
|
1017
1022
|
}, async ({ code, fromHeight, toHeight, limit }) => {
|
|
1018
1023
|
const bundled = await bundleSubgraphCode(code);
|
|
1019
1024
|
const def = await loadBundledDefinition(bundled.handlerCode);
|
|
@@ -1094,36 +1099,36 @@ function registerSubgraphTools(server, clientProvider = getClient) {
|
|
|
1094
1099
|
|
|
1095
1100
|
// src/tools/webhooks.ts
|
|
1096
1101
|
import { CHAIN_TRIGGER_TYPES } from "@secondlayer/shared";
|
|
1097
|
-
import { z as
|
|
1102
|
+
import { z as z11 } from "zod";
|
|
1098
1103
|
function registerWebhookTools(server, clientProvider = getClient) {
|
|
1099
1104
|
defineTool(server, "webhooks_list", "List all webhooks for the current account. Returns summary fields (no secrets).", {}, async () => {
|
|
1100
1105
|
const { data } = await clientProvider().webhooks.list();
|
|
1101
1106
|
return jsonResponse(data);
|
|
1102
1107
|
});
|
|
1103
|
-
defineTool(server, "webhooks_get", "Get full detail for a webhook (triggers, auth, retry config, circuit state).", { id:
|
|
1108
|
+
defineTool(server, "webhooks_get", "Get full detail for a webhook (triggers, auth, retry config, circuit state).", { id: webhookIdSchema }, async ({ id }) => {
|
|
1104
1109
|
const detail = await clientProvider().webhooks.get(id);
|
|
1105
1110
|
return jsonResponse(detail);
|
|
1106
1111
|
});
|
|
1107
1112
|
defineTool(server, "webhooks_create", "Create a webhook that fires on raw chain events (set triggers). Returns `signingSecret` ONCE — forward it to the user so they can wire it into their receiver.", {
|
|
1108
|
-
name:
|
|
1109
|
-
triggers:
|
|
1110
|
-
type:
|
|
1111
|
-
contractId:
|
|
1112
|
-
functionName:
|
|
1113
|
-
caller:
|
|
1114
|
-
sender:
|
|
1115
|
-
recipient:
|
|
1116
|
-
assetIdentifier:
|
|
1117
|
-
deployer:
|
|
1118
|
-
contractName:
|
|
1119
|
-
topic:
|
|
1120
|
-
lockedAddress:
|
|
1121
|
-
trait:
|
|
1122
|
-
minAmount:
|
|
1123
|
-
maxAmount:
|
|
1113
|
+
name: z11.string().describe("Human-readable name, unique per account"),
|
|
1114
|
+
triggers: z11.array(z11.object({
|
|
1115
|
+
type: z11.enum(CHAIN_TRIGGER_TYPES),
|
|
1116
|
+
contractId: z11.string().optional(),
|
|
1117
|
+
functionName: z11.string().optional(),
|
|
1118
|
+
caller: z11.string().optional(),
|
|
1119
|
+
sender: z11.string().optional(),
|
|
1120
|
+
recipient: z11.string().optional(),
|
|
1121
|
+
assetIdentifier: z11.string().optional(),
|
|
1122
|
+
deployer: z11.string().optional(),
|
|
1123
|
+
contractName: z11.string().optional(),
|
|
1124
|
+
topic: z11.string().optional(),
|
|
1125
|
+
lockedAddress: z11.string().optional(),
|
|
1126
|
+
trait: z11.string().optional(),
|
|
1127
|
+
minAmount: z11.union([z11.string(), z11.number()]).optional(),
|
|
1128
|
+
maxAmount: z11.union([z11.string(), z11.number()]).optional()
|
|
1124
1129
|
})).describe("Chain triggers. 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."),
|
|
1125
|
-
url:
|
|
1126
|
-
format:
|
|
1130
|
+
url: z11.string().describe("Webhook URL"),
|
|
1131
|
+
format: z11.enum([
|
|
1127
1132
|
"standard-webhooks",
|
|
1128
1133
|
"inngest",
|
|
1129
1134
|
"trigger",
|
|
@@ -1131,17 +1136,17 @@ function registerWebhookTools(server, clientProvider = getClient) {
|
|
|
1131
1136
|
"cloudevents",
|
|
1132
1137
|
"raw"
|
|
1133
1138
|
]).optional().describe("Wire format (default standard-webhooks)"),
|
|
1134
|
-
authConfig:
|
|
1139
|
+
authConfig: z11.record(z11.string(), z11.unknown()).optional().describe('Receiver auth sent with each delivery, e.g. {"type": "bearer", "token": "..."}')
|
|
1135
1140
|
}, async (input) => {
|
|
1136
1141
|
const res = await clientProvider().webhooks.create(input);
|
|
1137
1142
|
return jsonResponse(res);
|
|
1138
1143
|
});
|
|
1139
1144
|
defineTool(server, "webhooks_update", "Patch a webhook (name, url, authConfig, format, retry, timeout, concurrency).", {
|
|
1140
|
-
id:
|
|
1141
|
-
name:
|
|
1142
|
-
url:
|
|
1143
|
-
authConfig:
|
|
1144
|
-
format:
|
|
1145
|
+
id: webhookIdSchema,
|
|
1146
|
+
name: z11.string().optional().describe("Rename the webhook"),
|
|
1147
|
+
url: z11.string().optional(),
|
|
1148
|
+
authConfig: z11.record(z11.string(), z11.unknown()).optional().describe("Receiver auth sent with each delivery (bearer/etc.)"),
|
|
1149
|
+
format: z11.enum([
|
|
1145
1150
|
"standard-webhooks",
|
|
1146
1151
|
"inngest",
|
|
1147
1152
|
"trigger",
|
|
@@ -1149,35 +1154,35 @@ function registerWebhookTools(server, clientProvider = getClient) {
|
|
|
1149
1154
|
"cloudevents",
|
|
1150
1155
|
"raw"
|
|
1151
1156
|
]).optional(),
|
|
1152
|
-
maxRetries:
|
|
1153
|
-
timeoutMs:
|
|
1154
|
-
concurrency:
|
|
1157
|
+
maxRetries: z11.number().int().min(0).optional(),
|
|
1158
|
+
timeoutMs: z11.number().int().min(100).optional(),
|
|
1159
|
+
concurrency: z11.number().int().min(1).optional()
|
|
1155
1160
|
}, async ({ id, ...patch }) => {
|
|
1156
1161
|
const res = await clientProvider().webhooks.update(id, patch);
|
|
1157
1162
|
return jsonResponse(res);
|
|
1158
1163
|
});
|
|
1159
|
-
defineTool(server, "webhooks_delete", "Delete a webhook. Pending outbox rows are cascade-deleted.", { id:
|
|
1164
|
+
defineTool(server, "webhooks_delete", "Delete a webhook. Pending outbox rows are cascade-deleted.", { id: webhookIdSchema }, async ({ id }) => {
|
|
1160
1165
|
const res = await clientProvider().webhooks.delete(id);
|
|
1161
1166
|
return jsonResponse(res);
|
|
1162
1167
|
});
|
|
1163
|
-
defineTool(server, "webhooks_test", "Send a one-off test webhook to a webhook's URL (built for its format, SSRF-guarded). Logged as a delivery row. Returns {ok, statusCode, error, durationMs, deliveryId}.", { id:
|
|
1168
|
+
defineTool(server, "webhooks_test", "Send a one-off test webhook to a webhook's URL (built for its format, SSRF-guarded). Logged as a delivery row. Returns {ok, statusCode, error, durationMs, deliveryId}.", { id: webhookIdSchema }, async ({ id }) => {
|
|
1164
1169
|
const res = await clientProvider().webhooks.test(id);
|
|
1165
1170
|
return jsonResponse(res);
|
|
1166
1171
|
});
|
|
1167
|
-
defineTool(server, "webhooks_pause", "Pause a webhook: stops delivery attempts and stops queueing new ones. Nothing is deleted — resume picks the webhook back up from the tip. Verify with webhooks_get (status).", { id:
|
|
1168
|
-
defineTool(server, "webhooks_resume", "Resume a paused webhook (also clears a tripped circuit breaker). Deliveries restart from the current tip — use webhooks_replay for the blocks missed while paused. Verify with webhooks_get (status).", { id:
|
|
1169
|
-
defineTool(server, "webhooks_rotate_secret", "Rotate a webhook's signing secret. Returns the NEW `signingSecret` ONCE — forward it to the user; deliveries signed with the old secret stop verifying as soon as this returns, so the receiver must be updated.", { id:
|
|
1170
|
-
defineTool(server, "webhooks_deliveries", "List recent delivery attempts for a webhook — status code, attempt count, error, duration, timestamps. THIS IS THE VERIFY CALL: after webhooks_create, webhooks_test, or webhooks_replay, read it to confirm the webhook actually landed (and to see the receiver's response when it didn't) instead of trusting the enqueue result.", { id:
|
|
1171
|
-
defineTool(server, "webhooks_dead", "List a webhook's dead-letter queue — deliveries that exhausted their retries, with the outbox id, payload, and last error. Diagnose the receiver first (webhooks_get for the URL/auth, webhooks_test for a live probe), then requeue rows with webhooks_requeue.", { id:
|
|
1172
|
+
defineTool(server, "webhooks_pause", "Pause a webhook: stops delivery attempts and stops queueing new ones. Nothing is deleted — resume picks the webhook back up from the tip. Verify with webhooks_get (status).", { id: webhookIdSchema }, async ({ id }) => jsonResponse(await clientProvider().webhooks.pause(id)));
|
|
1173
|
+
defineTool(server, "webhooks_resume", "Resume a paused webhook (also clears a tripped circuit breaker). Deliveries restart from the current tip — use webhooks_replay for the blocks missed while paused. Verify with webhooks_get (status).", { id: webhookIdSchema }, async ({ id }) => jsonResponse(await clientProvider().webhooks.resume(id)));
|
|
1174
|
+
defineTool(server, "webhooks_rotate_secret", "Rotate a webhook's signing secret. Returns the NEW `signingSecret` ONCE — forward it to the user; deliveries signed with the old secret stop verifying as soon as this returns, so the receiver must be updated.", { id: webhookIdSchema }, async ({ id }) => jsonResponse(await clientProvider().webhooks.rotateSecret(id)));
|
|
1175
|
+
defineTool(server, "webhooks_deliveries", "List recent delivery attempts for a webhook — status code, attempt count, error, duration, timestamps. THIS IS THE VERIFY CALL: after webhooks_create, webhooks_test, or webhooks_replay, read it to confirm the webhook actually landed (and to see the receiver's response when it didn't) instead of trusting the enqueue result.", { id: webhookIdSchema }, async ({ id }) => jsonResponse(await clientProvider().webhooks.deliveries(id)));
|
|
1176
|
+
defineTool(server, "webhooks_dead", "List a webhook's dead-letter queue — deliveries that exhausted their retries, with the outbox id, payload, and last error. Diagnose the receiver first (webhooks_get for the URL/auth, webhooks_test for a live probe), then requeue rows with webhooks_requeue.", { id: webhookIdSchema }, async ({ id }) => jsonResponse(await clientProvider().webhooks.dead(id)));
|
|
1172
1177
|
defineTool(server, "webhooks_requeue", "Requeue ONE dead-lettered delivery for another attempt, by its outbox id from webhooks_dead. Fix the receiver first — a requeue against a still-broken endpoint just dies again. Verify with webhooks_deliveries.", {
|
|
1173
|
-
id:
|
|
1174
|
-
outboxId:
|
|
1178
|
+
id: webhookIdSchema,
|
|
1179
|
+
outboxId: uuidSchema.describe("Outbox id of the dead delivery (from webhooks_dead)")
|
|
1175
1180
|
}, async ({ id, outboxId }) => jsonResponse(await clientProvider().webhooks.requeue(id, outboxId)));
|
|
1176
1181
|
defineTool(server, "webhooks_replay", "Replay a block range for a webhook. Replays run at 10% of batch capacity — use sparingly. Pass `force` (a short idempotency suffix) to re-run a range that was already replayed.", {
|
|
1177
|
-
id:
|
|
1178
|
-
fromBlock:
|
|
1179
|
-
toBlock:
|
|
1180
|
-
force:
|
|
1182
|
+
id: webhookIdSchema,
|
|
1183
|
+
fromBlock: z11.number().int().nonnegative(),
|
|
1184
|
+
toBlock: z11.number().int().nonnegative(),
|
|
1185
|
+
force: z11.string().optional().describe("Idempotency suffix to force a duplicate replay of the range")
|
|
1181
1186
|
}, async ({ id, fromBlock, toBlock, force }) => {
|
|
1182
1187
|
const res = await clientProvider().webhooks.replay(id, {
|
|
1183
1188
|
fromBlock,
|
|
@@ -1306,5 +1311,5 @@ export {
|
|
|
1306
1311
|
createServer
|
|
1307
1312
|
};
|
|
1308
1313
|
|
|
1309
|
-
//# debugId=
|
|
1314
|
+
//# debugId=6468B3A549EAD8FB64756E2164756E21
|
|
1310
1315
|
//# sourceMappingURL=index.js.map
|