@webhooks-cc/mcp 1.22.0 → 1.24.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/tools.js CHANGED
@@ -498,9 +498,28 @@ function keyText(key) {
498
498
  }
499
499
  function approvalResultText(result) {
500
500
  if (typeof result.key === "string") return keyText(result);
501
+ if (typeof result.spreadsheetId === "string") {
502
+ const tabs = Array.isArray(result.tabs) ? result.tabs.join(", ") : "";
503
+ return `Approved. The chosen spreadsheet is ${String(result.spreadsheetId)} (${String(result.url)}), on connection ${String(result.connectionId)}${tabs ? `; its tabs: ${tabs}` : ""}. Use them in a Sheets destination's config.`;
504
+ }
505
+ if (Array.isArray(result.fields)) {
506
+ return `Approved. AI setup proposed (nothing is saved until you apply it):
507
+ ${JSON.stringify(result, null, 2)}`;
508
+ }
509
+ if (typeof result.connectionId === "string") {
510
+ return `Approved. The Google account ${result.email ? `${String(result.email)} ` : ""}is connected as ${result.connectionId}.`;
511
+ }
501
512
  if (typeof result.url === "string") {
502
513
  return `Approved. The share link is ${result.url} (anyone with it can read the copy until ${String(result.expiresAt)}).`;
503
514
  }
515
+ if (typeof result.invitedEmail === "string") {
516
+ const team = typeof result.teamName === "string" ? ` to "${result.teamName}"` : "";
517
+ const warning = typeof result.warning === "string" ? ` ${result.warning} Tell them to sign up with that address and accept from their Teams page.` : " They get an email; accepting claims one of the team's seats.";
518
+ return `Approved. Invited ${result.invitedEmail}${team} (invite ${String(result.id)}).${warning}`;
519
+ }
520
+ if (typeof result.deleted === "string" && typeof result.teamId === "string") {
521
+ return `Approved. The team ${result.deleted ? `"${result.deleted}" ` : ""}was deleted; its subscription has ended.`;
522
+ }
504
523
  if (typeof result.removed === "string") {
505
524
  return `Approved. The domain ${result.removed} was removed; mail to it is refused now.`;
506
525
  }
@@ -575,6 +594,75 @@ function fitArrayField(value, key) {
575
594
  }
576
595
  return cut(low);
577
596
  }
597
+ function isoTime(ms) {
598
+ if (ms === null || !Number.isFinite(ms)) return null;
599
+ const date = new Date(ms);
600
+ return Number.isNaN(date.getTime()) ? null : date.toISOString();
601
+ }
602
+ function searchStoppedNote(searchedUntil, order, hasCursor) {
603
+ const [direction, rest] = order === "asc" ? ["forward", "newer"] : ["back", "older"];
604
+ const reached = searchedUntil ? `Searched ${direction} to ${searchedUntil}; ${rest} requests were not searched yet.` : `The search stopped before it read everything; ${rest} requests were not searched yet.`;
605
+ return hasCursor ? `${reached} Call search_requests again with cursor to continue.` : reached;
606
+ }
607
+ var FULL_REQUEST_HINT = "The full request is available from the API (GET /api/requests/{id}), the SDKs (requests.get(id)) or the CLI (whk requests get <id>).";
608
+ var SEARCH_SHORTENED_NOTE = `Some requests were shortened to fit the output (bodyTruncated with bodySize, or shortened: true for a summary); get_request with the id returns as much of one request as fits. ${FULL_REQUEST_HINT}`;
609
+ var REQUEST_SHORTENED_NOTE = `This request was cut to fit the output: its body (bodyTruncated, with bodySize), or everything but a summary (shortened: true). ${FULL_REQUEST_HINT}`;
610
+ function clip(value, max) {
611
+ return typeof value === "string" ? sliceText(value, max) : void 0;
612
+ }
613
+ function listedSize(request) {
614
+ return jsonSize([[request]]) - 8;
615
+ }
616
+ function fitSearchRequests(requests, room) {
617
+ const share = Math.floor(room / Math.max(1, requests.length));
618
+ const fitted = requests.map(
619
+ (request) => shortenRequest(request, share, listedSize)
620
+ );
621
+ if (fitted.every((request) => listedSize(request) <= share)) return fitted;
622
+ return requests.map((request) => {
623
+ const { id, receivedAt } = request;
624
+ return { id, receivedAt, shortened: true };
625
+ });
626
+ }
627
+ function shortenRequest(request, share, sizeOf) {
628
+ if (sizeOf(request) <= share) return request;
629
+ if (typeof request.body === "string") {
630
+ const body = request.body;
631
+ let keep = body.length - (sizeOf(request) - share) - 96;
632
+ while (keep > 0) {
633
+ const cut = {
634
+ ...request,
635
+ body: sliceText(body, keep),
636
+ bodyTruncated: true,
637
+ bodySize: body.length
638
+ };
639
+ if (sizeOf(cut) <= share) return cut;
640
+ keep = Math.floor(keep / 2);
641
+ }
642
+ }
643
+ const email = request.email;
644
+ const summary = {
645
+ id: request.id,
646
+ slug: clip(request.slug, 64),
647
+ method: clip(request.method, 16),
648
+ path: clip(request.path, 200),
649
+ contentType: clip(request.contentType, 100),
650
+ size: request.size,
651
+ receivedAt: request.receivedAt,
652
+ kind: request.kind,
653
+ ...email ? { subject: clip(email.subject, 200) } : {},
654
+ shortened: true,
655
+ ...typeof request.note === "string" ? { note: request.note } : {}
656
+ };
657
+ return summary;
658
+ }
659
+ function requestContent(request) {
660
+ const compact = compactRequest(request);
661
+ if (jsonSize(compact) <= MAX_BODY_SIZE) return jsonContent(compact);
662
+ return jsonContent(
663
+ shortenRequest({ ...compact, note: REQUEST_SHORTENED_NOTE }, MAX_BODY_SIZE, jsonSize)
664
+ );
665
+ }
578
666
  function jsonContent(value) {
579
667
  return textContent(serializeJson(value));
580
668
  }
@@ -619,6 +707,13 @@ function serializeError(error) {
619
707
  } else if (error instanceof import_sdk.WebhooksCCError) {
620
708
  payload.code = error.statusCode >= 500 ? "server_error" : "validation_error";
621
709
  }
710
+ if (error instanceof import_sdk.WebhooksCCError && payload.hint === null) {
711
+ if (error.code === "invalid_cursor") {
712
+ payload.hint = "The cursor is not one this search returned, or the order changed since. Pass a cursor exactly as a result gave it, or search again without one.";
713
+ } else if (error.code === "search_busy") {
714
+ payload.hint = "The account's other searches are still running. Wait retryAfter seconds, then call again with the same inputs.";
715
+ }
716
+ }
622
717
  return JSON.stringify(payload, null, 2);
623
718
  }
624
719
  function withErrorHandling(handler) {
@@ -1070,6 +1165,124 @@ function registerTools(target, client, options = {}) {
1070
1165
  return jsonContent({ shared: false, slug, teamId });
1071
1166
  })
1072
1167
  );
1168
+ server.tool(
1169
+ "create_team",
1170
+ "Create a team you own, to share endpoints with its members under a pooled quota. It does nothing until it has a subscription, which the person starts in the browser (Account > Teams); until then it is suspended.",
1171
+ { name: import_zod.z.string().trim().min(1).max(100).describe("The team's name") },
1172
+ withErrorHandling(async ({ name }) => jsonContent(await client.teams.create(name)))
1173
+ );
1174
+ server.tool(
1175
+ "rename_team",
1176
+ "Rename a team you own.",
1177
+ {
1178
+ teamId: import_zod.z.string().min(1).describe("Team id (from list_teams)"),
1179
+ name: import_zod.z.string().trim().min(1).max(100).describe("The new name")
1180
+ },
1181
+ withErrorHandling(async ({ teamId, name }) => {
1182
+ await client.teams.rename(teamId, name);
1183
+ return jsonContent({ renamed: true, teamId, name });
1184
+ })
1185
+ );
1186
+ server.tool(
1187
+ "delete_team",
1188
+ "Delete a team you own: its subscription ends at once, every member loses the endpoints shared with it, and it cannot be undone. Only when the person asks for it. The team's owner must approve it: this returns a link and a code to show them, then call wait_for_approval.",
1189
+ { teamId: import_zod.z.string().min(1).describe("Team id (from list_teams)") },
1190
+ withErrorHandling(async ({ teamId }) => {
1191
+ const pending = await client.teams.delete(teamId);
1192
+ if (!pending.id) return textContent(`Deleted the team ${teamId}.`);
1193
+ return textContent(approvalAskText(pending));
1194
+ })
1195
+ );
1196
+ server.tool(
1197
+ "remove_team_member",
1198
+ "Remove a member from a team you own: the endpoints they shared with the team stop being shared, and their seat is free for someone else. Only when the person asks for it.",
1199
+ {
1200
+ teamId: import_zod.z.string().min(1).describe("Team id (from list_teams)"),
1201
+ userId: import_zod.z.string().min(1).describe("The member's userId (from list_team_members)")
1202
+ },
1203
+ withErrorHandling(async ({ teamId, userId }) => {
1204
+ await client.teams.removeMember(teamId, userId);
1205
+ return jsonContent({ removed: true, teamId, userId });
1206
+ })
1207
+ );
1208
+ server.tool(
1209
+ "leave_team",
1210
+ "Leave a team you belong to: the endpoints you shared with it stop being shared, and you lose access to the ones shared with you through it. An owner cannot leave; they delete the team instead (delete_team). Only when the person asks for it.",
1211
+ { teamId: import_zod.z.string().min(1).describe("Team id (from list_teams)") },
1212
+ withErrorHandling(async ({ teamId }) => {
1213
+ await client.teams.leave(teamId);
1214
+ return jsonContent({ left: true, teamId });
1215
+ })
1216
+ );
1217
+ server.tool(
1218
+ "invite_to_team",
1219
+ "Invite an email address to a team you own. It emails that address, so the team's owner must approve it: this returns a link and a code to show them, then call wait_for_approval, which returns the invite. Accepting the invite claims one of the team's paid seats. Only when the person asks for it.",
1220
+ {
1221
+ teamId: import_zod.z.string().min(1).describe("Team id (from list_teams)"),
1222
+ email: import_zod.z.string().trim().email().describe("The address to invite")
1223
+ },
1224
+ withErrorHandling(async ({ teamId, email }) => {
1225
+ const pending = await client.teams.invite(teamId, email);
1226
+ if (!pending.id) return textContent(approvalResultText({ ...await pending.wait() }));
1227
+ return textContent(approvalAskText(pending));
1228
+ })
1229
+ );
1230
+ server.tool(
1231
+ "list_invites",
1232
+ "List the team invites waiting for you to answer: team, who invited you, when, and the invite id for answer_invite.",
1233
+ {},
1234
+ withErrorHandling(async () => jsonContent(await client.teams.invites.list()))
1235
+ );
1236
+ server.tool(
1237
+ "answer_invite",
1238
+ "Accept or decline a team invite waiting for you (from list_invites). Accepting claims one of the team's paid seats and you join the team, seeing the endpoints shared with it; it fails when the team is full or suspended. Only when the person says which.",
1239
+ {
1240
+ inviteId: import_zod.z.string().min(1).describe("The invite's id, from list_invites"),
1241
+ answer: import_zod.z.enum(["accept", "decline"]).describe("accept joins the team; decline turns it down")
1242
+ },
1243
+ withErrorHandling(async ({ inviteId, answer }) => {
1244
+ if (answer === "accept") {
1245
+ await client.teams.invites.accept(inviteId);
1246
+ return jsonContent({ accepted: true, inviteId });
1247
+ }
1248
+ await client.teams.invites.decline(inviteId);
1249
+ return jsonContent({ declined: true, inviteId });
1250
+ })
1251
+ );
1252
+ server.tool(
1253
+ "withdraw_invite",
1254
+ "Withdraw an invite to a team you own before it is answered (pending invites and their ids are in list_team_members). The invite link stops working.",
1255
+ {
1256
+ teamId: import_zod.z.string().min(1).describe("Team id (from list_teams)"),
1257
+ inviteId: import_zod.z.string().min(1).describe("The invite's id (from list_team_members' pendingInvites)")
1258
+ },
1259
+ withErrorHandling(async ({ teamId, inviteId }) => {
1260
+ await client.teams.withdrawInvite(teamId, inviteId);
1261
+ return jsonContent({ withdrawn: true, teamId, inviteId });
1262
+ })
1263
+ );
1264
+ server.tool(
1265
+ "quote_team_change",
1266
+ "What changing a team's seat count or plan would cost, read only (owner only): what is due now, any credit, and the price from the renewal. Give seats, or plan (with interval). The change itself is made by the person in the browser.",
1267
+ {
1268
+ teamId: import_zod.z.string().min(1).describe("Team id (from list_teams)"),
1269
+ seats: import_zod.z.number().int().min(1).optional().describe("Price this seat count"),
1270
+ plan: import_zod.z.enum(["team", "team_business"]).optional().describe("Price a move to this plan: team (Teams) or team_business (Team Business)"),
1271
+ interval: import_zod.z.enum(["month", "year"]).optional().describe("Billing interval for plan (default month; Teams is monthly only)")
1272
+ },
1273
+ withErrorHandling(async ({ teamId, seats, plan, interval }) => {
1274
+ if (seats === void 0 === (plan === void 0)) {
1275
+ throw new Error("Give seats or plan, not both.");
1276
+ }
1277
+ if (seats !== void 0) {
1278
+ if (interval !== void 0) throw new Error("interval goes with plan, not seats.");
1279
+ return jsonContent(await client.billing.quoteTeamSeats(teamId, seats));
1280
+ }
1281
+ return jsonContent(
1282
+ await client.billing.quoteTeamPlan(teamId, plan, interval)
1283
+ );
1284
+ })
1285
+ );
1073
1286
  server.tool(
1074
1287
  "get_endpoint",
1075
1288
  "Get details for a specific webhook endpoint by slug.",
@@ -1163,6 +1376,35 @@ function registerTools(target, client, options = {}) {
1163
1376
  return jsonContent(holder);
1164
1377
  })
1165
1378
  );
1379
+ server.tool(
1380
+ "list_layout_templates",
1381
+ "List the ready-made email layouts (order emails from Shopify, WooCommerce, Etsy and more, payments, bookings, attachments): each with its id, sender, kind, description, the fields it reads and whether it reads line items. Add one with add_layout_template.",
1382
+ { slug: import_zod.z.string().describe("The endpoint slug") },
1383
+ withErrorHandling(async ({ slug }) => jsonContent(await client.endpoints.layoutTemplates(slug)))
1384
+ );
1385
+ server.tool(
1386
+ "add_layout_template",
1387
+ "Add a ready-made layout (an id from list_layout_templates) to the end of an endpoint's layouts. Emails it matches are parsed from the next one on; check it on a captured email with preview_layouts. Owner only.",
1388
+ {
1389
+ slug: import_zod.z.string().describe("The endpoint slug"),
1390
+ template: import_zod.z.string().min(1).describe("The template's id, from list_layout_templates")
1391
+ },
1392
+ withErrorHandling(
1393
+ async ({ slug, template }) => jsonContent(await client.endpoints.addLayoutTemplate(slug, template))
1394
+ )
1395
+ );
1396
+ server.tool(
1397
+ "preview_email_fields",
1398
+ "Dry run of an endpoint's named email fields on a captured email: each field's value (null where it finds nothing), and problems with fields you pass. Nothing is saved. Pass emailFields to try fields before saving them with update_endpoint. Owner only.",
1399
+ {
1400
+ slug: import_zod.z.string().describe("The endpoint slug"),
1401
+ requestId: import_zod.z.string().optional().describe("A captured email on the endpoint (default: the newest)"),
1402
+ emailFields: import_zod.z.array(emailFieldSchema).max(20).optional().describe("Unsaved fields to try instead of the saved ones")
1403
+ },
1404
+ withErrorHandling(
1405
+ async ({ slug, requestId, emailFields }) => jsonContent(await client.endpoints.previewEmailFields(slug, { requestId, emailFields }))
1406
+ )
1407
+ );
1166
1408
  server.tool(
1167
1409
  "preview_response",
1168
1410
  "Dry run of an endpoint's responses: which response rule answers a captured request, and the response with its {{ placeholders }} filled in, exactly as the receiver would send it. Nothing is sent. Pass mockResponse or responseRules to try settings before saving them with update_endpoint.",
@@ -1298,56 +1540,95 @@ function registerTools(target, client, options = {}) {
1298
1540
  );
1299
1541
  server.tool(
1300
1542
  "search_requests",
1301
- "Search captured webhook requests across endpoints using retained full-text search.",
1543
+ "Search captured requests and emails across endpoints: a substring match on path, headers, body and decoded email fields. One call reads back through history for about 2 seconds and returns { requests, complete, searchedUntil, cursor }. When complete is false, older requests were not searched yet: call again with the cursor and the same filters to continue.",
1302
1544
  {
1303
1545
  slug: import_zod.z.string().optional().describe("Filter to a specific endpoint slug"),
1304
1546
  method: import_zod.z.string().optional().describe("Filter by HTTP method"),
1305
1547
  kind: kindSchema,
1306
- q: import_zod.z.string().optional().describe("Free-text search across path, body, and headers"),
1307
- from: durationOrTimestampSchema.optional().describe('Start time as a timestamp or duration like "1h" or "7d"'),
1308
- to: durationOrTimestampSchema.optional().describe('End time as a timestamp or duration like "1h" or "7d"'),
1548
+ q: import_zod.z.string().optional().describe(
1549
+ "Substring to find in the path, headers, body and decoded email fields (up to 1,000 characters)"
1550
+ ),
1551
+ from: durationOrTimestampSchema.optional().describe(
1552
+ 'Start time as a timestamp (Unix ms) or a duration back from now like "1h" or "7d". A duration is counted from each call, so when you continue with a cursor pass a timestamp to keep the same range.'
1553
+ ),
1554
+ to: durationOrTimestampSchema.optional().describe(
1555
+ 'End time as a timestamp (Unix ms) or a duration back from now like "1h" or "7d". A duration is counted from each call, so when you continue with a cursor pass a timestamp to keep the same range.'
1556
+ ),
1309
1557
  limit: import_zod.z.number().int().min(1).max(200).default(50).describe("Max results to return"),
1310
- offset: import_zod.z.number().int().min(0).max(1e4).default(0).describe("Result offset"),
1311
- order: import_zod.z.enum(["asc", "desc"]).default("desc").describe("Sort order by received time")
1558
+ offset: import_zod.z.number().int().min(0).max(1e4).default(0).describe("Matches to skip (first call only; a cursor carries what is left of it)"),
1559
+ order: import_zod.z.enum(["asc", "desc"]).default("desc").describe("Sort order by received time"),
1560
+ cursor: import_zod.z.string().optional().describe(
1561
+ "The cursor from a previous search_requests result, to continue that search. Keep the other inputs the same."
1562
+ )
1312
1563
  },
1313
- withErrorHandling(async ({ slug, method, kind, q, from, to, limit, offset, order }) => {
1314
- const results = await client.requests.search({
1315
- slug,
1316
- method,
1317
- kind,
1318
- q,
1319
- from,
1320
- to,
1321
- limit,
1322
- offset,
1323
- order
1324
- });
1325
- return jsonContent(results.map(compactRequest));
1564
+ withErrorHandling(async ({ slug, method, kind, q, from, to, limit, offset, order, cursor }) => {
1565
+ const page = await client.requests.searchPage(
1566
+ { slug, method, kind, q, from, to, limit, offset, order },
1567
+ { cursor }
1568
+ );
1569
+ const searchedUntil = isoTime(page.searchedUntil);
1570
+ const envelope = (requests2, shortened) => {
1571
+ const notes = [
1572
+ ...page.complete ? [] : [searchStoppedNote(searchedUntil, order, Boolean(page.cursor))],
1573
+ ...shortened ? [SEARCH_SHORTENED_NOTE] : []
1574
+ ];
1575
+ return {
1576
+ requests: requests2,
1577
+ complete: page.complete,
1578
+ searchedUntil,
1579
+ cursor: page.cursor,
1580
+ ...notes.length > 0 ? { note: notes.join(" ") } : {}
1581
+ };
1582
+ };
1583
+ const requests = page.requests.map(compactRequest);
1584
+ if (jsonSize(envelope(requests, false)) <= MAX_BODY_SIZE) {
1585
+ return jsonContent(envelope(requests, false));
1586
+ }
1587
+ const room = MAX_BODY_SIZE - jsonSize(envelope([], true)) - 8;
1588
+ return jsonContent(envelope(fitSearchRequests(requests, room), true));
1326
1589
  })
1327
1590
  );
1328
1591
  server.tool(
1329
1592
  "count_requests",
1330
- "Count captured webhook requests that match the given filters.",
1593
+ "Count captured requests and emails that match the given filters (q is a substring match on path, headers, body and decoded email fields). Returns { count, exact, searchedUntil, cursor }. With q or method a call counts back through history for about 2 seconds: when exact is false, count covers history back to searchedUntil only, and calling again with the cursor counts the next stretch (add the counts up).",
1331
1594
  {
1332
1595
  slug: import_zod.z.string().optional().describe("Filter to a specific endpoint slug"),
1333
1596
  method: import_zod.z.string().optional().describe("Filter by HTTP method"),
1334
1597
  kind: kindSchema,
1335
- q: import_zod.z.string().optional().describe("Free-text search across path, body, and headers"),
1336
- from: durationOrTimestampSchema.optional().describe('Start time as a timestamp or duration like "1h" or "7d"'),
1337
- to: durationOrTimestampSchema.optional().describe('End time as a timestamp or duration like "1h" or "7d"')
1598
+ q: import_zod.z.string().optional().describe(
1599
+ "Substring to find in the path, headers, body and decoded email fields (up to 1,000 characters)"
1600
+ ),
1601
+ from: durationOrTimestampSchema.optional().describe(
1602
+ 'Start time as a timestamp (Unix ms) or a duration back from now like "1h" or "7d". A duration is counted from each call, so when you continue with a cursor pass a timestamp to keep the same range.'
1603
+ ),
1604
+ to: durationOrTimestampSchema.optional().describe(
1605
+ 'End time as a timestamp (Unix ms) or a duration back from now like "1h" or "7d". A duration is counted from each call, so when you continue with a cursor pass a timestamp to keep the same range.'
1606
+ ),
1607
+ cursor: import_zod.z.string().optional().describe(
1608
+ "The cursor from a previous count_requests result, to count the next stretch. Keep the other inputs the same."
1609
+ )
1338
1610
  },
1339
- withErrorHandling(async ({ slug, method, kind, q, from, to }) => {
1340
- const count = await client.requests.count({ slug, method, kind, q, from, to });
1341
- return jsonContent({ count });
1611
+ withErrorHandling(async ({ slug, method, kind, q, from, to, cursor }) => {
1612
+ const page = await client.requests.countPage({ slug, method, kind, q, from, to }, { cursor });
1613
+ const searchedUntil = isoTime(page.searchedUntil);
1614
+ return jsonContent({
1615
+ count: page.count,
1616
+ exact: page.exact,
1617
+ searchedUntil,
1618
+ cursor: page.cursor,
1619
+ ...page.exact ? {} : {
1620
+ note: `At least ${page.count}, counted ${searchedUntil ? `back to ${searchedUntil}` : "over part of the history"}; ${page.cursor ? "call count_requests again with cursor to count further (the counts add up)." : "there is no cursor to count further with."}`
1621
+ }
1622
+ });
1342
1623
  })
1343
1624
  );
1344
1625
  server.tool(
1345
1626
  "get_request",
1346
- "Get full details for a specific captured request by ID.",
1627
+ "Get the details of a captured request by ID: method, path, headers and body. A request larger than the tool output has its body cut (bodyTruncated, bodySize) and a note saying where the whole request is available.",
1347
1628
  getRequestShape,
1348
1629
  withErrorHandling(async ({ requestId }) => {
1349
1630
  const request = await client.requests.get(requestId);
1350
- return jsonContent(compactRequest(request));
1631
+ return requestContent(request);
1351
1632
  })
1352
1633
  );
1353
1634
  server.tool(
@@ -1356,7 +1637,7 @@ function registerTools(target, client, options = {}) {
1356
1637
  waitForRequestShape,
1357
1638
  withErrorHandling(async ({ endpointSlug, timeout, pollInterval }) => {
1358
1639
  const request = await client.requests.waitFor(endpointSlug, { timeout, pollInterval });
1359
- return jsonContent(compactRequest(request));
1640
+ return requestContent(request);
1360
1641
  })
1361
1642
  );
1362
1643
  server.tool(
@@ -2110,7 +2391,7 @@ function registerTools(target, client, options = {}) {
2110
2391
  );
2111
2392
  server.tool(
2112
2393
  "wait_for_approval",
2113
- "Wait for the account's owner to answer an approval (from create_api_key, create_share_link, remove_domain or rename_account) and collect what it grants or did, such as the new API key or the share link. If they have not answered yet, call it again.",
2394
+ "Wait for the account's owner to answer an approval (from create_api_key, create_share_link, remove_domain, rename_account, delete_team, invite_to_team, connect_google, pick_spreadsheet or ai_setup) and collect what it grants or did, such as the new API key, the share link or AI setup's proposals. If they have not answered yet, call it again.",
2114
2395
  {
2115
2396
  id: import_zod.z.string().describe("The approval id"),
2116
2397
  timeout: durationOrTimestampSchema.default("45s").describe('How long to wait for the person, for example "45s"')
@@ -2278,6 +2559,109 @@ function registerTools(target, client, options = {}) {
2278
2559
  return textContent(approvalAskText(pending));
2279
2560
  })
2280
2561
  );
2562
+ server.tool(
2563
+ "list_google_connections",
2564
+ "List the Google accounts connected for Google Sheets destinations (id, email, when connected), and whether Google Sheets is set up on this server.",
2565
+ {},
2566
+ withErrorHandling(async () => jsonContent(await client.google.connections()))
2567
+ );
2568
+ server.tool(
2569
+ "connect_google",
2570
+ "Connect a Google account for Google Sheets destinations. The account's owner must approve it: this returns a link and a code to show them, and approving takes them to Google to choose the account. Then call wait_for_approval for the new connection's id.",
2571
+ {},
2572
+ withErrorHandling(async () => textContent(approvalAskText(await client.google.connect())))
2573
+ );
2574
+ server.tool(
2575
+ "pick_spreadsheet",
2576
+ "Have the account's owner choose an existing spreadsheet from Google Drive with a connected account (to add rows to it from a Sheets destination). Returns a link and a code to show them; the page opens Google's picker. Then call wait_for_approval for the spreadsheet's id and tabs. To use a new spreadsheet instead, call create_spreadsheet.",
2577
+ {
2578
+ connectionId: import_zod.z.string().describe("The Google connection's id, from list_google_connections")
2579
+ },
2580
+ withErrorHandling(
2581
+ async ({ connectionId }) => textContent(approvalAskText(await client.google.pick(connectionId)))
2582
+ )
2583
+ );
2584
+ server.tool(
2585
+ "create_spreadsheet",
2586
+ "Create a new spreadsheet with a header row in a connected Google account, for a Sheets destination. Needs no approval: the app reaches only spreadsheets it created or that were chosen for it.",
2587
+ {
2588
+ connectionId: import_zod.z.string().describe("The Google connection's id, from list_google_connections"),
2589
+ title: import_zod.z.string().max(200).optional().describe("The spreadsheet's title"),
2590
+ sheet: import_zod.z.string().max(100).optional().describe('The tab rows go to (default "Sheet1")'),
2591
+ headers: import_zod.z.array(import_zod.z.string().max(200)).max(50).describe("The header row, one per column")
2592
+ },
2593
+ withErrorHandling(
2594
+ async ({ connectionId, title, sheet, headers }) => jsonContent(await client.google.createSpreadsheet({ connectionId, title, sheet, headers }))
2595
+ )
2596
+ );
2597
+ server.tool(
2598
+ "list_sheet_tabs",
2599
+ "List a spreadsheet's tabs (one created by the app or chosen with pick_spreadsheet), to choose the one a Sheets destination writes to.",
2600
+ {
2601
+ connectionId: import_zod.z.string().describe("The Google connection's id"),
2602
+ spreadsheetId: import_zod.z.string().describe("The spreadsheet's id")
2603
+ },
2604
+ withErrorHandling(
2605
+ async ({ connectionId, spreadsheetId }) => jsonContent({ tabs: await client.google.tabs(connectionId, spreadsheetId) })
2606
+ )
2607
+ );
2608
+ server.tool(
2609
+ "disconnect_google",
2610
+ "Disconnect a Google account (id from list_google_connections) and revoke its access at Google. Sheets destinations using it fail until another account is chosen.",
2611
+ {
2612
+ connectionId: import_zod.z.string().describe("The Google connection's id")
2613
+ },
2614
+ withErrorHandling(async ({ connectionId }) => {
2615
+ await client.google.disconnect(connectionId);
2616
+ return textContent(`Disconnected the Google account ${connectionId}.`);
2617
+ })
2618
+ );
2619
+ server.tool(
2620
+ "ai_setup_status",
2621
+ "Whether AI setup is offered for an endpoint, and how many AI assists the plan has left in a rolling 30 days.",
2622
+ {
2623
+ slug: import_zod.z.string().describe("The endpoint's slug")
2624
+ },
2625
+ withErrorHandling(async ({ slug }) => jsonContent(await client.ai.status(slug)))
2626
+ );
2627
+ server.tool(
2628
+ "ai_setup",
2629
+ "Have AI propose email fields (or a layout, or a repaired field) from 1 to 5 of an endpoint's captured emails. It sends those emails (subject, sender, recipients, text, headers; never attachments) to Anthropic's model, so the account's owner must approve it: this returns a link and a code to show them, and the page lists the emails. Then call wait_for_approval for the proposals, each with the value it found in every email. Nothing is saved: apply the fields with update_endpoint. Uses one AI assist.",
2630
+ {
2631
+ slug: import_zod.z.string().describe("The endpoint's slug"),
2632
+ requestIds: import_zod.z.array(import_zod.z.string()).min(1).max(5).describe("1 to 5 of the endpoint's email request ids, from list_emails"),
2633
+ ask: import_zod.z.union([
2634
+ import_zod.z.object({
2635
+ kind: import_zod.z.literal("field"),
2636
+ name: import_zod.z.string().describe("The field's name: letters, digits and _"),
2637
+ description: import_zod.z.string().describe('What the field is, such as "the order number"')
2638
+ }),
2639
+ import_zod.z.object({
2640
+ kind: import_zod.z.literal("layout"),
2641
+ description: import_zod.z.string().optional().describe("What these emails are")
2642
+ }),
2643
+ import_zod.z.object({
2644
+ kind: import_zod.z.literal("repair"),
2645
+ field: import_zod.z.object({
2646
+ name: import_zod.z.string(),
2647
+ from: import_zod.z.string(),
2648
+ header: import_zod.z.string().optional(),
2649
+ pattern: import_zod.z.string()
2650
+ }).describe("The field to repair, as the endpoint has it")
2651
+ })
2652
+ ]).describe("What to propose")
2653
+ },
2654
+ withErrorHandling(
2655
+ async ({ slug, requestIds, ask }) => textContent(
2656
+ approvalAskText(
2657
+ await client.ai.setup(slug, {
2658
+ requestIds,
2659
+ ask
2660
+ })
2661
+ )
2662
+ )
2663
+ )
2664
+ );
2281
2665
  server.tool(
2282
2666
  "stop_share",
2283
2667
  "Stop a public preview or live tunnel by its id (from list_shares). The CLI running it is told why and exits.",
package/dist/tools.mjs CHANGED
@@ -18,7 +18,7 @@ import {
18
18
  waitForRequestShape,
19
19
  withErrorHandling,
20
20
  withShareHints
21
- } from "./chunk-VO7HGSRN.mjs";
21
+ } from "./chunk-SOQIUGLA.mjs";
22
22
  export {
23
23
  LOCAL_ONLY_TOOLS,
24
24
  REMOTE_MAX_WAIT_MS,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webhooks-cc/mcp",
3
- "version": "1.22.0",
3
+ "version": "1.24.0",
4
4
  "mcpName": "io.github.kroqdotdev/webhooks-cc",
5
5
  "description": "MCP server for webhooks.cc — AI agent integration for webhook testing",
6
6
  "main": "dist/index.js",
@@ -44,7 +44,7 @@
44
44
  "dependencies": {
45
45
  "@modelcontextprotocol/sdk": "^1.32.2",
46
46
  "zod": "^4.6.7",
47
- "@webhooks-cc/sdk": "1.26.0"
47
+ "@webhooks-cc/sdk": "1.28.0"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@types/node": "^26.6.6",