scrapeloop-mcp 0.7.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/package.json +23 -7
- package/src/index.js +336 -50
- package/src/mutation-policies.js +26 -0
package/README.md
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
A [Model Context Protocol](https://modelcontextprotocol.io) server for Scrapeloop.
|
|
4
4
|
**Set up and run Scrapeloop end-to-end from Claude Desktop, Cursor, ChatGPT, or any
|
|
5
|
-
MCP client**
|
|
5
|
+
MCP client** - connect integrations, scrape or pull from the lead database, verify
|
|
6
6
|
(incl. catch-all), clean, enrich, tag, and feed Instantly campaigns.
|
|
7
7
|
|
|
8
|
-
Pair it with the [`scrapeloop
|
|
8
|
+
Pair it with the [`scrapeloop` skill](../skill) for a saved Playbook setup and task
|
|
9
9
|
flow ("set up Scrapeloop").
|
|
10
10
|
|
|
11
11
|
## Setup
|
|
@@ -52,7 +52,7 @@ integrations:write scrape enrich cleaners strategies campaigns:write insta
|
|
|
52
52
|
```
|
|
53
53
|
|
|
54
54
|
A 403 with `"API key missing scope(s): …"` means the key was minted with a narrower
|
|
55
|
-
set
|
|
55
|
+
set - regenerate it with the full preset.
|
|
56
56
|
|
|
57
57
|
## Tools
|
|
58
58
|
|
|
@@ -64,7 +64,7 @@ cleaners, strategy tags, vendors, scopes, and the ordered 7 setup steps) and
|
|
|
64
64
|
|------|-------|
|
|
65
65
|
| Discovery | `get_capabilities`, `get_setup_status`, `get_credits`, `get_meta` |
|
|
66
66
|
| Integrations (BYOK) | `list_integrations`, `create_integration`, `list_credentials`, `add_credential`, `test_credential`, `list_instantly_connections` |
|
|
67
|
-
| Scrape | `list_scrapers`, `estimate_scrape`, `submit_scrape`, `list_jobs`, `get_job`, `cancel_job` |
|
|
67
|
+
| Scrape | `list_scrapers`, `estimate_scrape`, `submit_scrape`, `list_jobs`, `get_job`, `cancel_job`, `attach_job_to_table` |
|
|
68
68
|
| Lead database | `search_leads`, `estimate_leads`, `reveal_lead`, `save_leads`, `bulk_verify_leads` |
|
|
69
69
|
| Verify | `verify_email`, `verify_catchall` |
|
|
70
70
|
| Clean | `list_cleaners`, `preview_cleaners`, `apply_cleaners` |
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scrapeloop-mcp",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Scrapeloop MCP server
|
|
3
|
+
"version": "0.8.0",
|
|
4
|
+
"description": "Scrapeloop MCP server - set up and run Scrapeloop end-to-end (integrations, scraping, lead database, verification, cleaners, enrichment, strategies, Instantly campaigns) from any MCP client (Claude Desktop, Cursor, ChatGPT, \u2026).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"test": "node --check src/index.js && node test/mcp_table_tools.mjs && node test/mcp_community_intent.mjs && node test/mcp_api_key_preflight.mjs && node test/mutation_retry_contract.mjs && node test/release_readiness.mjs",
|
|
7
|
+
"test": "node --check src/index.js && node test/mcp_table_tools.mjs && node test/mcp_playbook_plans.mjs && node test/mcp_community_intent.mjs && node test/mcp_api_key_preflight.mjs && node test/mutation_retry_contract.mjs && node test/release_readiness.mjs",
|
|
8
8
|
"release:preflight": "node scripts/release-preflight.mjs",
|
|
9
9
|
"release:verify": "node scripts/release-installed-verify.mjs"
|
|
10
10
|
},
|
|
@@ -21,10 +21,26 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@modelcontextprotocol/sdk": "^1.0.0"
|
|
23
23
|
},
|
|
24
|
-
"keywords": [
|
|
24
|
+
"keywords": [
|
|
25
|
+
"mcp",
|
|
26
|
+
"scrapeloop",
|
|
27
|
+
"leads",
|
|
28
|
+
"b2b",
|
|
29
|
+
"email-verification",
|
|
30
|
+
"cold-email",
|
|
31
|
+
"model-context-protocol"
|
|
32
|
+
],
|
|
25
33
|
"homepage": "https://scrapeloop.com",
|
|
26
|
-
"repository": {
|
|
27
|
-
|
|
28
|
-
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "git+https://github.com/Hinkam-Lanello/scrapeloop.git",
|
|
37
|
+
"directory": "packages/mcp"
|
|
38
|
+
},
|
|
39
|
+
"bugs": {
|
|
40
|
+
"url": "https://github.com/Hinkam-Lanello/scrapeloop/issues"
|
|
41
|
+
},
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"access": "public"
|
|
44
|
+
},
|
|
29
45
|
"license": "UNLICENSED"
|
|
30
46
|
}
|
package/src/index.js
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* scrapeloop-mcp
|
|
3
|
+
* scrapeloop-mcp: Model Context Protocol server for Scrapeloop.
|
|
4
4
|
*
|
|
5
5
|
* A thin wrapper over the Scrapeloop REST API (/api/v1). Authenticates with a
|
|
6
6
|
* per-workspace API key (Settings → API access). Credit-gated actions surface
|
|
7
7
|
* 402/403 bodies verbatim so the model can self-correct or prompt a top-up.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* user already is, then walk the manifest's `steps` in order.
|
|
9
|
+
* Read get_capabilities, get_setup_status and get_playbook first. Use this
|
|
10
|
+
* workspace's saved answers for setup and later tasks, following the live
|
|
11
|
+
* manifest steps and each tool's approval and retry rules.
|
|
13
12
|
*
|
|
14
13
|
* Env:
|
|
15
|
-
* SCRAPELOOP_API_KEY required
|
|
16
|
-
* SCRAPELOOP_API_URL optional
|
|
14
|
+
* SCRAPELOOP_API_KEY required: sl_live_… key
|
|
15
|
+
* SCRAPELOOP_API_URL optional, defaults to https://api.scrapeloop.com
|
|
17
16
|
*/
|
|
18
17
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
19
18
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
@@ -31,6 +30,21 @@ const TIMEOUT_MS = Number(process.env.SCRAPELOOP_TIMEOUT_MS) || 30000;
|
|
|
31
30
|
const MAX_RETRIES = 3;
|
|
32
31
|
const MAX_TABLE_CELL_WRITES = 500;
|
|
33
32
|
const MAX_TABLE_CELL_REQUEST_BYTES = 256 * 1024;
|
|
33
|
+
// Native Smart Table tool keys, mirroring apps/api/lib/native_tool_columns.json.
|
|
34
|
+
// This package ships standalone, so it cannot read that file; the pairing is
|
|
35
|
+
// asserted in apps/web/lib/native-tool-columns.test.ts. Drift fails SAFE: the
|
|
36
|
+
// API rejects an unknown key and returns available_tools, and
|
|
37
|
+
// get_table_native_tools always serves the live catalog.
|
|
38
|
+
// verify_catchall is deliberately absent: its correctness needs a sibling Verify
|
|
39
|
+
// email column that has already RUN and returned Catch All or Unknown, which one
|
|
40
|
+
// create call cannot establish. Customers use verify_catchall (per address) or
|
|
41
|
+
// the in-app add-column menu. See docs/roadmap/mcp-native-tool-columns.md.
|
|
42
|
+
const NATIVE_TABLE_TOOLS = Object.freeze([
|
|
43
|
+
'verify_email',
|
|
44
|
+
'verify_phone',
|
|
45
|
+
'email_finder',
|
|
46
|
+
'business_email_finder',
|
|
47
|
+
]);
|
|
34
48
|
const TRACE_HEADER = 'X-Scrapeloop-Trace-Id';
|
|
35
49
|
const SAFE_TRACE_ID = /^[A-Za-z0-9_-]{8,80}$/;
|
|
36
50
|
const STARTUP_WARNINGS = new Set();
|
|
@@ -338,13 +352,34 @@ const runScopeBody = (a) => ({
|
|
|
338
352
|
...(a.only_failed !== undefined ? { only_failed: !!a.only_failed } : {}),
|
|
339
353
|
});
|
|
340
354
|
|
|
355
|
+
// Plan choices mirror the app wizard. Explicit scope and limits prevent a
|
|
356
|
+
// missing answer from silently becoming a country-wide paid plan.
|
|
357
|
+
const PLAN_FIELDS = {
|
|
358
|
+
name: S, kind: S, integration_id: S, country: S,
|
|
359
|
+
granularity: { ...S, enum: ['country', 'state', 'city', 'postal_code'] },
|
|
360
|
+
locations: ARR(S), location_items: ARR(O), categories: ARR(S),
|
|
361
|
+
min_population: { type: 'integer', minimum: 0 }, scrape_config: O,
|
|
362
|
+
run_mode: { ...S, enum: ['all_now', 'over_time'] }, spread_evenly: B,
|
|
363
|
+
monthly_max_leads: { type: 'integer', minimum: 1 },
|
|
364
|
+
monthly_lead_ceiling: { type: 'integer', minimum: 1 },
|
|
365
|
+
monthly_max_usd: { ...N, exclusiveMinimum: 0 },
|
|
366
|
+
monthly_max_credits: { type: 'integer', minimum: 1 },
|
|
367
|
+
spend_buffer_usd: { ...N, minimum: 0 },
|
|
368
|
+
max_leads_per_chunk: { type: 'integer', minimum: 0 },
|
|
369
|
+
chunk_interval_minutes: { type: 'integer', minimum: 0 },
|
|
370
|
+
chunk_order: { ...S, enum: ['sequential', 'largest_first', 'balanced'] },
|
|
371
|
+
rescrape_covered: B, min_age_days: { type: 'integer', minimum: 1 },
|
|
372
|
+
rescrape_after_days: { type: 'integer', minimum: 1 },
|
|
373
|
+
};
|
|
374
|
+
const PLAN_REQUIRED = ['name', 'kind', 'country', 'granularity', 'locations', 'categories', 'run_mode'];
|
|
375
|
+
|
|
341
376
|
// --- Tool registry: name → { def, run } -------------------------------------
|
|
342
377
|
const TOOLS = {
|
|
343
378
|
// ── Discovery / status ────────────────────────────────────────────────
|
|
344
379
|
get_capabilities: {
|
|
345
380
|
def: {
|
|
346
381
|
description:
|
|
347
|
-
'Fetch the live Scrapeloop capability manifest: scrapers (+ their config schemas), enrichment primitives & presets, cleaners, strategy tags, vendors, scopes, filter enums, and the ordered
|
|
382
|
+
'Fetch the live Scrapeloop capability manifest: scrapers (+ their config schemas), enrichment primitives & presets, cleaners, strategy tags, vendors, scopes, filter enums, and the ordered Playbook setup and run steps with guidance. CALL THIS FIRST and whenever unsure what is available: it reflects the workspace as it is right now.',
|
|
348
383
|
inputSchema: obj({}),
|
|
349
384
|
},
|
|
350
385
|
run: () => api('GET', '/manifest'),
|
|
@@ -352,7 +387,7 @@ const TOOLS = {
|
|
|
352
387
|
get_setup_status: {
|
|
353
388
|
def: {
|
|
354
389
|
description:
|
|
355
|
-
'Onboarding checklist booleans (integration connected, a lead revealed, a verify run, a
|
|
390
|
+
'Onboarding checklist booleans (Playbook saved, integration connected, a lead revealed, a verify run, a Table created) so you know what is already done and where to resume.',
|
|
356
391
|
inputSchema: obj({}),
|
|
357
392
|
},
|
|
358
393
|
run: () => api('GET', '/setup/status'),
|
|
@@ -402,7 +437,7 @@ const TOOLS = {
|
|
|
402
437
|
},
|
|
403
438
|
list_credentials: {
|
|
404
439
|
def: {
|
|
405
|
-
description: "List an integration's stored credentials (masked
|
|
440
|
+
description: "List an integration's stored credentials (masked: keys are never returned).",
|
|
406
441
|
inputSchema: obj({ integration_id: S }, ['integration_id']),
|
|
407
442
|
},
|
|
408
443
|
run: (a) =>
|
|
@@ -442,7 +477,7 @@ const TOOLS = {
|
|
|
442
477
|
list_scrapers: {
|
|
443
478
|
def: {
|
|
444
479
|
description:
|
|
445
|
-
'List available scrapers, whether each requires a credential, and the JSON Schema for each config.
|
|
480
|
+
'List available scrapers, whether each requires a credential, and the JSON Schema for each config. Reuse saved Playbook choices and ask only for missing fields. Read each plan capability before choosing preview_scrape_plan or a one-off estimate_scrape.',
|
|
446
481
|
inputSchema: obj({}),
|
|
447
482
|
},
|
|
448
483
|
run: () => api('GET', '/scrapers'),
|
|
@@ -470,7 +505,7 @@ const TOOLS = {
|
|
|
470
505
|
submit_scrape: {
|
|
471
506
|
def: {
|
|
472
507
|
description:
|
|
473
|
-
'Submit a scrape job. Optionally pass table_id from get_tables to add results to an existing writable static Table; omit it to keep results in All leads only. Paid scrapers spend vendor credits (BYOK) or lead credits (managed: 1 credit per NEW lead, deduped free), so confirm paid work with the user first. For every paid scraper, pass a positive hard_max_cost_usd equal to or above the estimate after the user confirms that ceiling; paid work will not start without it. A scraper with requires_credential=false is free and needs no integration_id, credential_id, or hard maximum. billing: "auto" (default) uses the workspace key when one exists, else Scrapeloop\'s managed key; "byok"/"managed" force the mode. integration_id is required for normal BYOK, optional for managed, and omitted for credential-free sources.
|
|
508
|
+
'Submit a scrape job. Optionally pass table_id from get_tables to add results to an existing writable static Table; omit it to keep results in All leads only. Paid scrapers spend vendor credits (BYOK) or lead credits (managed: 1 credit per NEW lead, deduped free), so confirm paid work with the user first. For every paid scraper, pass a positive hard_max_cost_usd equal to or above the estimate after the user confirms that ceiling; paid work will not start without it. A scraper with requires_credential=false is free and needs no integration_id, credential_id, or hard maximum. billing: "auto" (default) uses the workspace key when one exists, else Scrapeloop\'s managed key; "byok"/"managed" force the mode. integration_id is required for normal BYOK, optional for managed, and omitted for credential-free sources. Returns 402 for budget or credit limits and 409 when rescrape confirmation is needed; pass confirm_rescrape:true to proceed past a coverage conflict.',
|
|
474
509
|
inputSchema: obj(
|
|
475
510
|
{
|
|
476
511
|
kind: S,
|
|
@@ -497,18 +532,55 @@ const TOOLS = {
|
|
|
497
532
|
...(a.billing ? { billing: a.billing } : {}),
|
|
498
533
|
}),
|
|
499
534
|
},
|
|
535
|
+
get_scrape_plan_territories: {
|
|
536
|
+
def: {
|
|
537
|
+
description: 'Read places a scraper can cover before previewing a plan. Use returned values exactly. For Outscraper, pass a returned parent value to read its child cities.',
|
|
538
|
+
inputSchema: obj({ kind: S, country: S, granularity: S, min_population: N, parent: S }, ['kind', 'country']),
|
|
539
|
+
},
|
|
540
|
+
run: (a) => api('GET', `/plans/territories?${new URLSearchParams(Object.entries(a).filter(([, value]) => value !== undefined)).toString()}`),
|
|
541
|
+
},
|
|
542
|
+
preview_scrape_plan: {
|
|
543
|
+
def: {
|
|
544
|
+
description: 'Preview all-now or over-time scraping with the same limits as the app. No scrape or credential is created. Read the Playbook and scraper capabilities first. Set a lead or credit cap for credit-priced work, or a dollar cap for dollar-priced work. all_now limits apply once; over_time limits reset each month. Show costs and coverage warnings before creating.',
|
|
545
|
+
inputSchema: obj(PLAN_FIELDS, PLAN_REQUIRED),
|
|
546
|
+
},
|
|
547
|
+
run: (a) => api('POST', '/plans/preview', a),
|
|
548
|
+
},
|
|
549
|
+
create_scrape_plan: {
|
|
550
|
+
def: {
|
|
551
|
+
description: 'Create and start an approved scrape plan into an existing writable Table. This can spend credits or vendor money. Preview the exact choices first and stay within the approved limit and time period. Pass explicit territory values and matching billing limits. Reuse the same idempotency_key after a lost reply, inspect list_scrape_plans and never create a second plan to escape an uncertain result. Over-time limits reset monthly; a total one-time approval does not authorize recurring spend.',
|
|
552
|
+
inputSchema: obj({ ...PLAN_FIELDS, target_list_id: { ...S, format: 'uuid' } }, [...PLAN_REQUIRED, 'target_list_id']),
|
|
553
|
+
},
|
|
554
|
+
run: ({ idempotency_key: _key, ...body }) => api('POST', '/plans', body),
|
|
555
|
+
},
|
|
556
|
+
list_scrape_plans: {
|
|
557
|
+
def: { description: 'Read this workspace scrape plans, progress and spending. Use after an uncertain plan create.', inputSchema: obj({}) },
|
|
558
|
+
run: () => api('GET', '/plans'),
|
|
559
|
+
},
|
|
560
|
+
get_scrape_plan: {
|
|
561
|
+
def: { description: 'Read one scrape plan, its saved scope, limits, progress and spending.', inputSchema: obj({ plan_id: { ...S, format: 'uuid' } }, ['plan_id']) },
|
|
562
|
+
run: (a) => api('GET', `/plans/${enc(a.plan_id)}`),
|
|
563
|
+
},
|
|
564
|
+
pause_scrape_plan: {
|
|
565
|
+
def: { description: 'Pause new work from a scrape plan. A job already running may still finish. Inspect the plan and its jobs after pausing.', inputSchema: obj({ plan_id: { ...S, format: 'uuid' } }, ['plan_id']) },
|
|
566
|
+
run: (a) => api('POST', `/plans/${enc(a.plan_id)}/pause`),
|
|
567
|
+
},
|
|
500
568
|
list_jobs: {
|
|
501
569
|
def: { description: 'List recent scrape/enrich jobs in the workspace.', inputSchema: obj({}) },
|
|
502
570
|
run: () => api('GET', '/jobs'),
|
|
503
571
|
},
|
|
504
572
|
get_job: {
|
|
505
|
-
def: { description: 'Get one job with its execution steps (poll this for scrape progress).', inputSchema: obj({ job_id: S }, ['job_id']) },
|
|
573
|
+
def: { description: 'Get one job with its execution steps (poll this for scrape progress). A scrape job carries `delivery`: how many rows were found, kept, new, already yours, and added to its Table, why rows were left out, and whether adding them to the Table worked.', inputSchema: obj({ job_id: S }, ['job_id']) },
|
|
506
574
|
run: (a) => api('GET', `/jobs/${enc(a.job_id)}`),
|
|
507
575
|
},
|
|
508
576
|
cancel_job: {
|
|
509
577
|
def: { description: 'Request cancellation of a queued or running job. An active external vendor task remains nonterminal while the worker aborts it and settles final partial usage, then becomes cancelled.', inputSchema: obj({ job_id: S }, ['job_id']) },
|
|
510
578
|
run: (a) => api('POST', `/jobs/${enc(a.job_id)}/cancel`),
|
|
511
579
|
},
|
|
580
|
+
attach_job_to_table: {
|
|
581
|
+
def: { description: 'Add a finished scrape job\'s leads to its Table again. Use it only when get_job shows `delivery.attach.state` as "failed" and the job is done, and not when `delivery.attach.code` is "table_missing" (that Table was deleted). Rows already in the Table are skipped, so repeating it never adds a row twice. Returns `added`, `in_table`, and the updated `delivery`.', inputSchema: obj({ job_id: S }, ['job_id']) },
|
|
582
|
+
run: (a) => api('POST', `/jobs/${enc(a.job_id)}/attach-to-table`),
|
|
583
|
+
},
|
|
512
584
|
|
|
513
585
|
// ── Lead database ─────────────────────────────────────────────────────
|
|
514
586
|
search_leads: {
|
|
@@ -533,7 +605,7 @@ const TOOLS = {
|
|
|
533
605
|
},
|
|
534
606
|
reveal_lead: {
|
|
535
607
|
def: {
|
|
536
|
-
description: "Reveal a lead's email by global_person_id. SPENDS 1 lead credit (idempotent
|
|
608
|
+
description: "Reveal a lead's email by global_person_id. SPENDS 1 lead credit (idempotent: already-revealed leads are free).",
|
|
537
609
|
inputSchema: obj({ global_person_id: S }, ['global_person_id']),
|
|
538
610
|
},
|
|
539
611
|
run: (a) => api('POST', '/leads/reveal', { global_person_id: a.global_person_id }),
|
|
@@ -678,7 +750,7 @@ const TOOLS = {
|
|
|
678
750
|
verify_catchall: {
|
|
679
751
|
def: {
|
|
680
752
|
description:
|
|
681
|
-
'Resolve a mailbox on a catch-all domain with Scrapeloop managed verification (5 verify credits).
|
|
753
|
+
'Resolve a mailbox on a catch-all domain with Scrapeloop managed verification (5 verify credits). Optional and off unless chosen. It can resolve some unknown addresses but does not promise more replies. Estimate the eligible set and stay within the approved credit budget.',
|
|
682
754
|
inputSchema: obj({ email: S }, ['email']),
|
|
683
755
|
},
|
|
684
756
|
run: (a) => api('POST', '/verify/catchall', { email: a.email }),
|
|
@@ -737,7 +809,7 @@ const TOOLS = {
|
|
|
737
809
|
},
|
|
738
810
|
run_enrich: {
|
|
739
811
|
def: {
|
|
740
|
-
description: 'Enqueue a bulk enrichment run. SPENDS vendor credits
|
|
812
|
+
description: 'Enqueue a bulk enrichment run. SPENDS vendor credits: estimate + confirm first.',
|
|
741
813
|
inputSchema: obj({ preset_slug: S, preset_id: S, lead_ids: ARR(S), filter_query: O }),
|
|
742
814
|
},
|
|
743
815
|
run: (a) =>
|
|
@@ -768,6 +840,24 @@ const TOOLS = {
|
|
|
768
840
|
...(a.cache_settings ? { cache_settings: a.cache_settings } : {}),
|
|
769
841
|
}),
|
|
770
842
|
},
|
|
843
|
+
get_playbook: {
|
|
844
|
+
def: { description: "Read this workspace's saved Playbook and niches before setting up work.", inputSchema: obj({}) },
|
|
845
|
+
run: () => api('GET', '/playbook'),
|
|
846
|
+
},
|
|
847
|
+
update_playbook: {
|
|
848
|
+
def: {
|
|
849
|
+
description: 'Save defaults for this workspace only. Saves the sections you provide and keeps other answers. Never starts a scrape or spends credits.',
|
|
850
|
+
inputSchema: obj({ sections: { type: 'object', properties: Object.fromEntries(['channels', 'scrape', 'tables', 'checks', 'routing', 'campaigns'].map((key) => [key, { type: 'object' }])), additionalProperties: false } }, ['sections']),
|
|
851
|
+
},
|
|
852
|
+
run: (a) => api('PUT', '/playbook', a.sections),
|
|
853
|
+
},
|
|
854
|
+
set_playbook_niches: {
|
|
855
|
+
def: {
|
|
856
|
+
description: 'Save chosen niches in tiers 1, 2 or 3. A null tier removes a niche without deleting its category. Set replace to true only to replace all chosen niches.',
|
|
857
|
+
inputSchema: obj({ niches: ARR(obj({ gcid: { type: ['string', 'null'] }, name: { type: ['string', 'null'] }, tier: { type: ['integer', 'null'], enum: [1, 2, 3, null] } })), replace: B }, ['niches']),
|
|
858
|
+
},
|
|
859
|
+
run: (a) => api('PUT', '/playbook/niches', a),
|
|
860
|
+
},
|
|
771
861
|
get_ai_context: {
|
|
772
862
|
def: {
|
|
773
863
|
description: 'Get the workspace AI context (company description, ICP, buyer personas) that seeds every AI feature.',
|
|
@@ -822,7 +912,7 @@ const TOOLS = {
|
|
|
822
912
|
list_senders: {
|
|
823
913
|
def: {
|
|
824
914
|
description:
|
|
825
|
-
'List the sender vendors Scrapeloop supports (instantly, …) with each one\'s capabilities (webhooks, lead lists, async moves, bulk upload). Catalog read
|
|
915
|
+
'List the sender vendors Scrapeloop supports (instantly, …) with each one\'s capabilities (webhooks, lead lists, async moves, bulk upload). Catalog read: use it to know what a connected sender can do before configuring feed/offload.',
|
|
826
916
|
inputSchema: obj({}),
|
|
827
917
|
},
|
|
828
918
|
run: () => api('GET', '/senders'),
|
|
@@ -830,7 +920,7 @@ const TOOLS = {
|
|
|
830
920
|
list_sender_campaigns: {
|
|
831
921
|
def: {
|
|
832
922
|
description:
|
|
833
|
-
"List a sender credential's campaigns at the vendor (vendor-generic: works for any connected sender key, same shape as list_instantly_campaigns
|
|
923
|
+
"List a sender credential's campaigns at the vendor (vendor-generic: works for any connected sender key, same shape as list_instantly_campaigns; use it to pick external_list_id).",
|
|
834
924
|
inputSchema: obj({ credential_id: S }, ['credential_id']),
|
|
835
925
|
},
|
|
836
926
|
run: (a) => api('GET', `/senders/${enc(a.credential_id)}/campaigns`),
|
|
@@ -867,6 +957,10 @@ const TOOLS = {
|
|
|
867
957
|
def: { description: 'List campaigns with per-campaign stats and the bound list name.', inputSchema: obj({}) },
|
|
868
958
|
run: () => api('GET', '/campaigns'),
|
|
869
959
|
},
|
|
960
|
+
get_campaign_setup_options: {
|
|
961
|
+
def: { description: 'Read this workspace\'s channel choices and defaults for new campaign drafts. Explicit create choices win. Reading options changes nothing and starts no campaign.', inputSchema: obj({}) },
|
|
962
|
+
run: () => api('GET', '/campaigns/options'),
|
|
963
|
+
},
|
|
870
964
|
preview_add_leads_to_campaign: {
|
|
871
965
|
def: {
|
|
872
966
|
description:
|
|
@@ -894,21 +988,32 @@ const TOOLS = {
|
|
|
894
988
|
create_campaign: {
|
|
895
989
|
def: {
|
|
896
990
|
description:
|
|
897
|
-
'Create a campaign
|
|
991
|
+
'Create a draft campaign connected to a sender and a Scrapeloop Table or segment. Read get_campaign_setup_options first. Absent choices use this workspace Playbook; explicit values win. GoHighLevel SMS needs a source Table and external_list_id set to a workflow ID or contacts-only. Nothing starts until activate_campaign. Ask the user before Start.',
|
|
898
992
|
inputSchema: obj(
|
|
899
993
|
{
|
|
900
994
|
name: S,
|
|
995
|
+
sender_options: { ...O, description: "GoHighLevel SMS choices: workflow_id, tags, require_verified_mobile, voip_counts_as_mobile, missing_fields (ask, create, never)." },
|
|
996
|
+
icon: { type: ["string", "null"], description: "One or two emoji, or null to clear." },
|
|
901
997
|
source_list_id: S,
|
|
902
998
|
segment_id: S,
|
|
903
999
|
sender_credential_id: S,
|
|
904
1000
|
external_list_id: S,
|
|
905
1001
|
instantly_campaign_name: S,
|
|
906
1002
|
feed_mode: { ...S, enum: ['off', 'auto_add', 'drip'] },
|
|
1003
|
+
allow_risky_emails: B,
|
|
1004
|
+
offload_enabled: B,
|
|
1005
|
+
offload_no_reply_days: N,
|
|
1006
|
+
offload_to_instantly: B,
|
|
1007
|
+
offload_to_scrapeloop: B,
|
|
1008
|
+
offload_scrapeloop_list_id: S,
|
|
907
1009
|
drip_strategy: { ...S, enum: ['target_active', 'fixed_daily'] },
|
|
908
1010
|
drip_daily_count: N,
|
|
909
1011
|
target_active_count: N,
|
|
910
1012
|
cooldown_days: N,
|
|
911
1013
|
resting_period_days: N,
|
|
1014
|
+
recycle_mode: { ...S, enum: ['off', 'after_cooldown'] },
|
|
1015
|
+
prioritize_fresh: B,
|
|
1016
|
+
bounce_instantly_list_id: S,
|
|
912
1017
|
},
|
|
913
1018
|
['name', 'sender_credential_id', 'external_list_id'],
|
|
914
1019
|
),
|
|
@@ -917,7 +1022,10 @@ const TOOLS = {
|
|
|
917
1022
|
const body = { name: a.name, sender_credential_id: a.sender_credential_id, external_list_id: a.external_list_id };
|
|
918
1023
|
for (const k of [
|
|
919
1024
|
'source_list_id', 'segment_id', 'instantly_campaign_name', 'feed_mode', 'drip_strategy',
|
|
1025
|
+
'allow_risky_emails', 'offload_enabled', 'offload_no_reply_days', 'offload_to_instantly',
|
|
1026
|
+
'offload_to_scrapeloop', 'offload_scrapeloop_list_id',
|
|
920
1027
|
'drip_daily_count', 'target_active_count', 'cooldown_days', 'resting_period_days',
|
|
1028
|
+
'recycle_mode', 'prioritize_fresh', 'bounce_instantly_list_id', 'sender_options', 'icon',
|
|
921
1029
|
]) {
|
|
922
1030
|
if (a[k] !== undefined && a[k] !== null) body[k] = a[k];
|
|
923
1031
|
}
|
|
@@ -925,19 +1033,19 @@ const TOOLS = {
|
|
|
925
1033
|
},
|
|
926
1034
|
},
|
|
927
1035
|
update_campaign: {
|
|
928
|
-
def: { description: 'Patch a campaign (feed_mode, target_active_count, cooldown_days, external_list_id, …).', inputSchema: obj({ campaign_id: S, patch: O }, ['campaign_id', 'patch']) },
|
|
1036
|
+
def: { description: 'Patch a campaign (feed_mode, target_active_count, cooldown_days, external_list_id, …). Switching feed_mode on for an already active campaign runs the same check as campaign_readiness_check: any fail answers 422 with the report under detail.readiness.', inputSchema: obj({ campaign_id: S, patch: { ...O, description: "Campaign settings to change.", properties: { sender_options: { ...O, description: "GoHighLevel SMS settings. Only supplied keys change." }, icon: { type: ["string", "null"], description: "One or two emoji, or null to clear." } }, additionalProperties: true } }, ['campaign_id', 'patch']) },
|
|
929
1037
|
run: (a) => api('PATCH', `/campaigns/${enc(a.campaign_id)}`, a.patch || {}),
|
|
930
1038
|
},
|
|
931
1039
|
duplicate_campaign: {
|
|
932
1040
|
def: {
|
|
933
1041
|
description:
|
|
934
|
-
'Duplicate a campaign: clones ALL configuration (list/segment binding, sender credential, Instantly binding, feed/drip/offload settings, field mapping) into a new draft named "Copy of …". Created SAFE regardless of the source
|
|
1042
|
+
'Duplicate a campaign: clones ALL configuration (list/segment binding, sender credential, Instantly binding, feed/drip/offload settings, field mapping) into a new draft named "Copy of …". Created SAFE regardless of the source: feed_mode is forced to off and require_approval to true, so the copy never feeds leads to Instantly until explicitly enabled. Leads/stats/ledger are NOT copied.',
|
|
935
1043
|
inputSchema: obj({ campaign_id: S }, ['campaign_id']),
|
|
936
1044
|
},
|
|
937
1045
|
run: (a) => api('POST', `/campaigns/${enc(a.campaign_id)}/duplicate`),
|
|
938
1046
|
},
|
|
939
1047
|
activate_campaign: {
|
|
940
|
-
def: { description: 'Activate a campaign
|
|
1048
|
+
def: { description: 'Activate a campaign: STARTS the feed/send loop. Run campaign_readiness_check first; any fail makes this answer 422 with the report under detail.readiness. Confirm with the user first.', inputSchema: obj({ campaign_id: S }, ['campaign_id']) },
|
|
941
1049
|
run: (a) => api('POST', `/campaigns/${enc(a.campaign_id)}/activate`),
|
|
942
1050
|
},
|
|
943
1051
|
pause_campaign: {
|
|
@@ -952,6 +1060,53 @@ const TOOLS = {
|
|
|
952
1060
|
def: { description: "A campaign's ledger stats + best-effort live Instantly analytics.", inputSchema: obj({ campaign_id: S }, ['campaign_id']) },
|
|
953
1061
|
run: (a) => api('GET', `/campaigns/${enc(a.campaign_id)}/stats`),
|
|
954
1062
|
},
|
|
1063
|
+
get_campaign_field_mapping: {
|
|
1064
|
+
def: {
|
|
1065
|
+
description:
|
|
1066
|
+
'What a campaign sends to the sender and what each detail is called there. Returns every name the sequence uses, every source that could fill it (with how full each one is over the first 500 rows), and the obvious matches. Read this when a merge variable comes out blank in the emails.',
|
|
1067
|
+
inputSchema: obj({ campaign_id: S }, ['campaign_id']),
|
|
1068
|
+
},
|
|
1069
|
+
run: (a) => api('GET', `/campaigns/${enc(a.campaign_id)}/field-mapping`),
|
|
1070
|
+
},
|
|
1071
|
+
create_sender_fields: {
|
|
1072
|
+
def: {
|
|
1073
|
+
description: 'Create missing GoHighLevel SMS contact fields only after the user agrees. Existing fields are reused. With remember never, save the choice and create nothing. Returns requested names mapped to actual field keys; use those keys when saving the mapping.',
|
|
1074
|
+
inputSchema: obj({ campaign_id: S, names: ARR(S), remember: { type: ['string', 'null'], enum: ['create', 'never', null] } }, ['campaign_id', 'names']),
|
|
1075
|
+
},
|
|
1076
|
+
run: (a) => api('POST', `/campaigns/${enc(a.campaign_id)}/sender-fields`, { names: a.names, remember: a.remember ?? null }),
|
|
1077
|
+
},
|
|
1078
|
+
set_campaign_field_mapping: {
|
|
1079
|
+
def: {
|
|
1080
|
+
description:
|
|
1081
|
+
'Set what a campaign sends. `mapping` is {name the sender receives: where it comes from}, using lead.<column>, send.<name>, col.<table column key> or custom.<key>. `identity` may override first_name, last_name and company only, never email. `only_mapped` true means the mapping is the complete list and nothing else is sent. Saving also records that a person reviewed it, which a campaign needs before its feed can be switched on.',
|
|
1082
|
+
inputSchema: obj(
|
|
1083
|
+
{ campaign_id: S, mapping: { type: 'object' }, identity: { type: 'object' }, only_mapped: B },
|
|
1084
|
+
['campaign_id'],
|
|
1085
|
+
),
|
|
1086
|
+
},
|
|
1087
|
+
run: (a) =>
|
|
1088
|
+
api('PUT', `/campaigns/${enc(a.campaign_id)}/field-mapping`, {
|
|
1089
|
+
mapping: a.mapping || {},
|
|
1090
|
+
identity: a.identity || {},
|
|
1091
|
+
only_mapped: a.only_mapped !== false,
|
|
1092
|
+
}),
|
|
1093
|
+
},
|
|
1094
|
+
campaign_delivery_coverage: {
|
|
1095
|
+
def: {
|
|
1096
|
+
description:
|
|
1097
|
+
'What the live sequence asks for versus what the feed will actually supply. Names any merge variable that nothing fills, which goes out blank in the middle of a sentence, and any that is only filled on some leads.',
|
|
1098
|
+
inputSchema: obj({ campaign_id: S }, ['campaign_id']),
|
|
1099
|
+
},
|
|
1100
|
+
run: (a) => api('GET', `/campaigns/${enc(a.campaign_id)}/delivery-coverage`),
|
|
1101
|
+
},
|
|
1102
|
+
campaign_readiness_check: {
|
|
1103
|
+
def: {
|
|
1104
|
+
description:
|
|
1105
|
+
'Is this campaign ready to start? Run it before activate_campaign. Returns ready, sender_known, sampled and a list of checks, each with a stable key, a level (pass, warn, fail or info), one plain sentence and a fix. Any fail means activate_campaign will refuse with 422 and the same report under detail.readiness. A warn does not block: read it out to the user before they confirm. It judges the leads the feed sends next (not the ones already in the campaign). With feed_mode off nothing is uploaded, so the lead and mailbox checks only warn until the feed is switched on.',
|
|
1106
|
+
inputSchema: obj({ campaign_id: S }, ['campaign_id']),
|
|
1107
|
+
},
|
|
1108
|
+
run: (a) => api('GET', `/campaigns/${enc(a.campaign_id)}/readiness`),
|
|
1109
|
+
},
|
|
955
1110
|
get_sender_config: {
|
|
956
1111
|
def: { description: "Get an Instantly credential's sender config (daily cap, send accounts, …).", inputSchema: obj({ credential_id: S }, ['credential_id']) },
|
|
957
1112
|
run: (a) => api('GET', `/sender_configs/${enc(a.credential_id)}`),
|
|
@@ -1004,6 +1159,35 @@ const TOOLS = {
|
|
|
1004
1159
|
},
|
|
1005
1160
|
run: () => api('GET', '/workbench/tree'),
|
|
1006
1161
|
},
|
|
1162
|
+
get_pipeline: {
|
|
1163
|
+
def: {
|
|
1164
|
+
description: 'Read the saved result and progress for a pipeline. Use its operation_id after an interrupted create.',
|
|
1165
|
+
inputSchema: obj({ operation_id: { ...S, format: 'uuid' } }, ['operation_id']),
|
|
1166
|
+
},
|
|
1167
|
+
run: (a) => api('GET', `/pipelines/${enc(a.operation_id)}`),
|
|
1168
|
+
},
|
|
1169
|
+
preview_pipeline: {
|
|
1170
|
+
def: {
|
|
1171
|
+
description: 'Preview an empty pipeline from this workspace Playbook, including Tables, columns, checks, rules and future-row work. Creates nothing. Review this before create_pipeline.',
|
|
1172
|
+
inputSchema: obj({}),
|
|
1173
|
+
},
|
|
1174
|
+
run: (a) => api('POST', '/pipelines/preview', a),
|
|
1175
|
+
},
|
|
1176
|
+
create_pipeline: {
|
|
1177
|
+
def: {
|
|
1178
|
+
description: 'Create an empty pipeline from this workspace Playbook. Raw keeps originals. Rules start on, and chosen columns run on future rows. Creation starts no scrape, sends no messages and activates no campaign. Read get_playbook first. Reuse the same operation_id and choices to resume a partial create. Campaign bindings require campaigns:write and feeds off.',
|
|
1179
|
+
inputSchema: obj({
|
|
1180
|
+
operation_id: { ...S, format: 'uuid' }, name: S, market: S,
|
|
1181
|
+
niche_gcids: ARR(S), mode: { ...S, enum: ['auto', 'simple', 'advanced'] },
|
|
1182
|
+
channels: ARR({ ...S, enum: ['email', 'sms', 'linkedin'] }),
|
|
1183
|
+
checks: { ...O, description: 'Overrides for saved checks, using the Playbook checks keys.' },
|
|
1184
|
+
stage_mode: { ...S, enum: ['move', 'copy'] }, carry_values: B,
|
|
1185
|
+
raw_setup: { ...O, description: 'Optional Raw columns, packs and layout. Same shape as create_table table_setup.' },
|
|
1186
|
+
bindings: { ...O, description: 'Optional email, sms or linkedin campaign IDs. Existing campaign feeds must be off.' },
|
|
1187
|
+
}, ['operation_id', 'name']),
|
|
1188
|
+
},
|
|
1189
|
+
run: (a) => api('POST', '/pipelines', a),
|
|
1190
|
+
},
|
|
1007
1191
|
create_workbook: {
|
|
1008
1192
|
def: {
|
|
1009
1193
|
description:
|
|
@@ -1016,7 +1200,7 @@ const TOOLS = {
|
|
|
1016
1200
|
def: {
|
|
1017
1201
|
description:
|
|
1018
1202
|
'Add one tab to a workbook. Pass list_id to attach an existing standalone Table, or new_table_name to create a new empty Table and attach it. Pass exactly one.',
|
|
1019
|
-
inputSchema: obj({ workbook_id: S, list_id: S, new_table_name: S }, ['workbook_id']),
|
|
1203
|
+
inputSchema: obj({ workbook_id: S, list_id: S, new_table_name: S, operation_id: { ...S, format: 'uuid' }, table_setup: { ...O, description: 'New Tables only. Same saved-column, pack and layout choices as create_table.' } }, ['workbook_id']),
|
|
1020
1204
|
},
|
|
1021
1205
|
run: (a) => {
|
|
1022
1206
|
if (!!a.list_id === !!a.new_table_name) {
|
|
@@ -1029,6 +1213,8 @@ const TOOLS = {
|
|
|
1029
1213
|
return api('POST', `/workbooks/${enc(a.workbook_id)}/tables`, {
|
|
1030
1214
|
...(a.list_id ? { list_id: a.list_id } : {}),
|
|
1031
1215
|
...(a.new_table_name ? { new_table_name: a.new_table_name } : {}),
|
|
1216
|
+
...(a.operation_id ? { operation_id: a.operation_id } : {}),
|
|
1217
|
+
...(a.table_setup !== undefined ? { table_setup: a.table_setup } : {}),
|
|
1032
1218
|
});
|
|
1033
1219
|
},
|
|
1034
1220
|
},
|
|
@@ -1120,16 +1306,33 @@ const TOOLS = {
|
|
|
1120
1306
|
},
|
|
1121
1307
|
run: (a) => api('GET', `/tables${qs({ archived: a.archived })}`),
|
|
1122
1308
|
},
|
|
1309
|
+
get_table_setup_options: {
|
|
1310
|
+
def: {
|
|
1311
|
+
description: 'Read this workspace\'s saved Table columns, layout and available column packs. Read-only; starts no work.',
|
|
1312
|
+
inputSchema: obj({}),
|
|
1313
|
+
},
|
|
1314
|
+
run: () => api('GET', '/playbook/tables/options'),
|
|
1315
|
+
},
|
|
1123
1316
|
create_table: {
|
|
1124
1317
|
def: {
|
|
1125
1318
|
description:
|
|
1126
|
-
'Create a
|
|
1319
|
+
'Create a Scrapeloop Table. Regular Tables start with this workspace\'s saved columns and layout. Use table_setup to change columns, choose packs or rename labels. Creation never runs columns or spends credits. Smart Tables use filter_expression, sort_expression, visible_columns and is_shared, and cannot use table_setup. Retry with the same operation_id; different inputs return 409.',
|
|
1127
1320
|
inputSchema: obj(
|
|
1128
1321
|
{
|
|
1129
1322
|
name: S,
|
|
1130
1323
|
operation_id: { ...S, format: 'uuid', description: 'Optional retry key from a prior ambiguous call.' },
|
|
1131
1324
|
description: S,
|
|
1132
1325
|
kind: { ...S, enum: ['static', 'smart'] },
|
|
1326
|
+
table_setup: {
|
|
1327
|
+
...O,
|
|
1328
|
+
description: 'Regular Tables only. Read get_table_setup_options first. columns replaces saved columns (empty list means none); packs adds named packs; identity_column_state replaces the saved layout. All created columns start with auto-run off.',
|
|
1329
|
+
properties: {
|
|
1330
|
+
columns: ARR({ ...O, properties: { kind: { ...S, enum: ['native', 'preset'] }, key: S, label: S, config: O }, required: ['kind', 'key', 'label'] }),
|
|
1331
|
+
packs: ARR(S),
|
|
1332
|
+
identity_column_state: O,
|
|
1333
|
+
},
|
|
1334
|
+
additionalProperties: false,
|
|
1335
|
+
},
|
|
1133
1336
|
filter_expression: { ...O, description: 'Smart Tables only.' },
|
|
1134
1337
|
sort_expression: { ...O, description: 'Smart Tables only.' },
|
|
1135
1338
|
visible_columns: { ...ARR(S), description: 'Smart Tables only.' },
|
|
@@ -1157,6 +1360,7 @@ const TOOLS = {
|
|
|
1157
1360
|
operation_id: a.operation_id || randomUUID(),
|
|
1158
1361
|
...(a.description !== undefined ? { description: a.description } : {}),
|
|
1159
1362
|
...(a.kind !== undefined ? { kind: a.kind } : {}),
|
|
1363
|
+
...(a.table_setup !== undefined ? { table_setup: a.table_setup } : {}),
|
|
1160
1364
|
...(a.filter_expression !== undefined ? { filter_expression: a.filter_expression } : {}),
|
|
1161
1365
|
...(a.sort_expression !== undefined ? { sort_expression: a.sort_expression } : {}),
|
|
1162
1366
|
...(a.visible_columns !== undefined ? { visible_columns: a.visible_columns } : {}),
|
|
@@ -1338,6 +1542,86 @@ const TOOLS = {
|
|
|
1338
1542
|
});
|
|
1339
1543
|
},
|
|
1340
1544
|
},
|
|
1545
|
+
get_table_native_tools: {
|
|
1546
|
+
def: {
|
|
1547
|
+
description:
|
|
1548
|
+
'List the first-party Scrapeloop tools a Smart Table column can be built on, with their per-row credit price, documented options, and the legacy preset slugs each one supersedes. Read this when create_table_preset_column refuses a slug as superseded, or before create_table_native_column, so the tool key and options are exact rather than guessed.',
|
|
1549
|
+
inputSchema: obj({}, []),
|
|
1550
|
+
},
|
|
1551
|
+
run: () => api('GET', '/tables/native-tools'),
|
|
1552
|
+
},
|
|
1553
|
+
create_table_native_column: {
|
|
1554
|
+
def: {
|
|
1555
|
+
description:
|
|
1556
|
+
`Attach one native Scrapeloop tool as a real Smart Table column: ${NATIVE_TABLE_TOOLS.join(', ')}. These are the first-party tools that superseded four legacy presets, so they are addressed by tool key here rather than by preset slug through create_table_preset_column (which refuses a superseded slug for a new column). Each bills MANAGED VERIFICATION CREDITS per row, never dollars and never the customer's own vendor keys: verify_email reserves 1 credit per selected row, verify_phone reserves 5, and each email finder reserves 3. Settlement charges only fresh vendor checks and returns the unused reservation; missing inputs, cached rows, and skipped rows are free. Creating a column is always free. auto_run defaults false and queues nothing; when auto_run would backfill existing rows the API returns a 409 estimate whose cost.total_credits is the real charge, and you confirm it with confirm_auto_run plus confirmed_credits (CREDITS, not dollars - estimated_cost_usd is our vendor cost and is far smaller than what the workspace is billed). An auto_run that exceeds the workspace verify-credit balance returns 402 with {credit_kind, required, available} before anything is created. The Table master auto-run switch and workspace budget caps stay fail-closed. options are per tool and only the documented names are accepted - call get_table_native_tools for the current list. Owner email finder needs an owner first name plus the company website; point options.owner_name_column at an Owner name finder column to source the name, which auto_run requires. Business email finder is a SEPARATE column - create it with its own call and set options.owner_email_column to run it behind an owner finder. The Catch-all verifier is NOT creatable here: it needs a Verify email column that has already RUN and returned Catch All or Unknown, so use verify_catchall per address, or add the column from the Table's add-column menu.`,
|
|
1557
|
+
inputSchema: obj(
|
|
1558
|
+
{
|
|
1559
|
+
table_id: S,
|
|
1560
|
+
tool: { ...S, enum: NATIVE_TABLE_TOOLS },
|
|
1561
|
+
label: { ...S, description: 'Column label. Defaults to the tool name.' },
|
|
1562
|
+
auto_run: B,
|
|
1563
|
+
confirm_auto_run: B,
|
|
1564
|
+
confirmed_credits: {
|
|
1565
|
+
...N,
|
|
1566
|
+
minimum: 0,
|
|
1567
|
+
description:
|
|
1568
|
+
'The 409 estimate\'s cost.total_credits, echoed back exactly. Verification credits, not dollars.',
|
|
1569
|
+
},
|
|
1570
|
+
options: {
|
|
1571
|
+
...O,
|
|
1572
|
+
description:
|
|
1573
|
+
'Tool-specific options. verify_phone: phone_col, default_region. email_finder: owner_name_column. business_email_finder: owner_email_column. An undocumented name is rejected, never ignored.',
|
|
1574
|
+
},
|
|
1575
|
+
operation_id: {
|
|
1576
|
+
...S,
|
|
1577
|
+
format: 'uuid',
|
|
1578
|
+
description: 'Required stable retry key for this logical native-column create.',
|
|
1579
|
+
},
|
|
1580
|
+
},
|
|
1581
|
+
['table_id', 'tool', 'operation_id'],
|
|
1582
|
+
),
|
|
1583
|
+
},
|
|
1584
|
+
run: async (a) => {
|
|
1585
|
+
if (!a.table_id || !a.tool || !a.operation_id) {
|
|
1586
|
+
return {
|
|
1587
|
+
ok: false,
|
|
1588
|
+
status: 400,
|
|
1589
|
+
error: { detail: 'table_id, tool, and a stable operation_id are required.' },
|
|
1590
|
+
};
|
|
1591
|
+
}
|
|
1592
|
+
if (!NATIVE_TABLE_TOOLS.includes(a.tool)) {
|
|
1593
|
+
return {
|
|
1594
|
+
ok: false,
|
|
1595
|
+
status: 400,
|
|
1596
|
+
error: {
|
|
1597
|
+
detail: `Unknown native tool '${a.tool}'. Expected one of ${NATIVE_TABLE_TOOLS.join(', ')}. Call get_table_native_tools for the live catalog.`,
|
|
1598
|
+
},
|
|
1599
|
+
};
|
|
1600
|
+
}
|
|
1601
|
+
const requestBody = {
|
|
1602
|
+
tool: a.tool,
|
|
1603
|
+
operation_id: a.operation_id,
|
|
1604
|
+
...(a.label !== undefined ? { label: a.label } : {}),
|
|
1605
|
+
...(a.auto_run !== undefined ? { auto_run: a.auto_run } : {}),
|
|
1606
|
+
...(a.confirm_auto_run !== undefined ? { confirm_auto_run: a.confirm_auto_run } : {}),
|
|
1607
|
+
...(a.confirmed_credits !== undefined
|
|
1608
|
+
? { confirmed_credits: a.confirmed_credits }
|
|
1609
|
+
: {}),
|
|
1610
|
+
...(a.options !== undefined ? { options: a.options } : {}),
|
|
1611
|
+
};
|
|
1612
|
+
return api('POST', `/tables/${enc(a.table_id)}/native-columns`, requestBody, {
|
|
1613
|
+
reconciliation: {
|
|
1614
|
+
operation_id: a.operation_id,
|
|
1615
|
+
retry_with: {
|
|
1616
|
+
tool: 'create_table_native_column',
|
|
1617
|
+
arguments: { ...a, operation_id: a.operation_id },
|
|
1618
|
+
},
|
|
1619
|
+
retry_guidance:
|
|
1620
|
+
`Retry create_table_native_column with the same operation_id ${a.operation_id}. Never substitute a new key for this logical create.`,
|
|
1621
|
+
},
|
|
1622
|
+
});
|
|
1623
|
+
},
|
|
1624
|
+
},
|
|
1341
1625
|
set_table_cells: {
|
|
1342
1626
|
def: {
|
|
1343
1627
|
description:
|
|
@@ -1453,7 +1737,7 @@ const TOOLS = {
|
|
|
1453
1737
|
preview_apify_import: {
|
|
1454
1738
|
def: {
|
|
1455
1739
|
description:
|
|
1456
|
-
"Read-only preview of an approved Apify actor's already-produced dataset before importing it. mapping is {lead_field: dotted.source.path} where lead_field is one of name, email, phone, domain, organization_name, city, state, country, linkedin_url, title. Normalizes the whole dataset (rows with no email/phone/domain/linkedin/name are skipped), returns the first 25 rows plus record_count (the true total) and a preview_hash. Pass that preview_hash to import_apify_dataset
|
|
1740
|
+
"Read-only preview of an approved Apify actor's already-produced dataset before importing it. mapping is {lead_field: dotted.source.path} where lead_field is one of name, email, phone, domain, organization_name, city, state, country, linkedin_url, title. Normalizes the whole dataset (rows with no email/phone/domain/linkedin/name are skipped), returns the first 25 rows plus record_count (the true total) and a preview_hash. Pass that preview_hash to import_apify_dataset: the import re-verifies it and refuses (409) if the dataset changed. Does NOT run the actor or spend: it reads an existing dataset_id. Returns {dataset_id, actor_id, record_count, preview, preview_truncated, preview_hash}.",
|
|
1457
1741
|
inputSchema: obj(
|
|
1458
1742
|
{
|
|
1459
1743
|
dataset_id: { ...S, description: 'Apify dataset id from a completed actor run.' },
|
|
@@ -1468,7 +1752,7 @@ const TOOLS = {
|
|
|
1468
1752
|
import_apify_dataset: {
|
|
1469
1753
|
def: {
|
|
1470
1754
|
description:
|
|
1471
|
-
'Import a previewed Apify dataset (≤1000 rows) into a private Scrapeloop Table through the bring-your-own-leads funnel (dedupe + identity matching + Table attach reused; no lead credits). Call preview_apify_import first and pass its preview_hash
|
|
1755
|
+
'Import a previewed Apify dataset (≤1000 rows) into a private Scrapeloop Table through the bring-your-own-leads funnel (dedupe + identity matching + Table attach reused; no lead credits). Call preview_apify_import first and pass its preview_hash: the import re-reads the dataset and returns 409 (preview_drift) if it changed since preview. Each row gets a stable external_id (apify:{dataset}:{row}) so re-importing updates rather than duplicates; company lands in business_name and the contact name/title ride through as custom fields. Target list_id, or omit for a new "Apify import" Table. Returns the import funnel result {inserted, updated, deduped, invalid, ...}.',
|
|
1472
1756
|
inputSchema: obj(
|
|
1473
1757
|
{
|
|
1474
1758
|
dataset_id: S,
|
|
@@ -1646,7 +1930,7 @@ const TOOLS = {
|
|
|
1646
1930
|
preview_import: {
|
|
1647
1931
|
def: {
|
|
1648
1932
|
description:
|
|
1649
|
-
'Dry-run for import_leads: report exactly what an import WOULD do
|
|
1933
|
+
'Dry-run for import_leads: report exactly what an import WOULD do ({would_insert, would_update, deduped, invalid, invalid_reasons, list_exists}) WITHOUT writing anything (no leads, no list, no tags created). Same inputs as import_leads. Call this first for a bring-your-own batch, show the user the plan (e.g. "adds 340 new, updates 12, skips 3 bad rows"), then confirm before import_leads.',
|
|
1650
1934
|
inputSchema: obj(
|
|
1651
1935
|
{
|
|
1652
1936
|
list_id: S,
|
|
@@ -2068,7 +2352,7 @@ const TOOLS = {
|
|
|
2068
2352
|
list_table_rows: {
|
|
2069
2353
|
def: {
|
|
2070
2354
|
description:
|
|
2071
|
-
"Read a table's rows the way the grid sees them
|
|
2355
|
+
"Read a table's rows the way the grid sees them: lead identity fields (name/email/phone/domain/city/state/country/status) plus every column's cell (status + value). Server-side: sort is a JSON-array string like [{\"key\":\"lead.name\",\"dir\":\"asc\"},{\"key\":\"col.company_size\",\"dir\":\"desc\"}] (keys are lead.<field> or col.<column_key>, ≤3 levels); q is a full-text search across identity fields + visible column cells; filter is a FilterExpr object (same grammar the Tables filter UI uses), e.g. {\"and\":[{\"field\":\"lead.email_status\",\"op\":\"eq\",\"value\":\"valid\"},{\"field\":\"col.company_size\",\"op\":\"gte\",\"value\":50}]}, and adds total_filtered alongside total; pass the previous response's next_cursor back as cursor to page (null next_cursor = last page). Distinct from get_list_rows (the plain import read-back). limit ≤ 500.",
|
|
2072
2356
|
inputSchema: obj(
|
|
2073
2357
|
{
|
|
2074
2358
|
list_id: S,
|
|
@@ -2076,7 +2360,7 @@ const TOOLS = {
|
|
|
2076
2360
|
limit: N,
|
|
2077
2361
|
sort: S,
|
|
2078
2362
|
q: S,
|
|
2079
|
-
filter: { ...O, description: 'FilterExpr JSON (object)
|
|
2363
|
+
filter: { ...O, description: 'FilterExpr JSON (object): server-side row filter; adds total_filtered.' },
|
|
2080
2364
|
view_id: { ...S, description: 'A saved custom view uuid or a system key (errored_rows/fully_enriched/data_only) from list_table_views. An ad-hoc filter/sort replaces the view\'s.' },
|
|
2081
2365
|
},
|
|
2082
2366
|
['list_id'],
|
|
@@ -2100,7 +2384,7 @@ const TOOLS = {
|
|
|
2100
2384
|
list_table_views: {
|
|
2101
2385
|
def: {
|
|
2102
2386
|
description:
|
|
2103
|
-
"List a table's views
|
|
2387
|
+
"List a table's views: three always-current SYSTEM views (errored_rows / fully_enriched / data_only) plus the user's saved custom views. Pass a returned id (or a system key) as view_id to list_table_rows to read that view (a saved filter + sorts + column overlay).",
|
|
2104
2388
|
inputSchema: obj({ list_id: S }, ['list_id']),
|
|
2105
2389
|
},
|
|
2106
2390
|
run: (a) =>
|
|
@@ -2156,7 +2440,7 @@ const TOOLS = {
|
|
|
2156
2440
|
update_table_view: {
|
|
2157
2441
|
def: {
|
|
2158
2442
|
description:
|
|
2159
|
-
'Update a saved table view
|
|
2443
|
+
'Update a saved table view: any field (name/description/filter_expression/sorts/column_state/row_window); a field set to null clears it. System views (errored_rows/fully_enriched/data_only) are read-only.',
|
|
2160
2444
|
inputSchema: obj(
|
|
2161
2445
|
{ list_id: S, view_id: S, name: S, description: S, filter_expression: O, sorts: ARR(O), column_state: O, row_window: O },
|
|
2162
2446
|
['list_id', 'view_id'],
|
|
@@ -2173,7 +2457,7 @@ const TOOLS = {
|
|
|
2173
2457
|
delete_table_view: {
|
|
2174
2458
|
def: {
|
|
2175
2459
|
description:
|
|
2176
|
-
'Delete a saved table view
|
|
2460
|
+
'Delete a saved table view. Rows in the table are unaffected. Confirm with the user first. System views cannot be deleted.',
|
|
2177
2461
|
inputSchema: obj({ list_id: S, view_id: S }, ['list_id', 'view_id']),
|
|
2178
2462
|
},
|
|
2179
2463
|
run: (a) =>
|
|
@@ -2184,7 +2468,7 @@ const TOOLS = {
|
|
|
2184
2468
|
estimate_table_column: {
|
|
2185
2469
|
def: {
|
|
2186
2470
|
description:
|
|
2187
|
-
"FREE cost preview for running one enrichment column, optionally scoped to a view or selection (view_id + selection{mode:'query', filter:<FilterExpr>, exclude_ids} or {mode:'explicit', ids}). cell_filter picks which cells: 'empty_or_stale' (default in the UI
|
|
2471
|
+
"FREE cost preview for running one enrichment column, optionally scoped to a view or selection (view_id + selection{mode:'query', filter:<FilterExpr>, exclude_ids} or {mode:'explicit', ids}). cell_filter picks which cells: 'empty_or_stale' (default in the UI; skips results still fresh under the current column config), 'failed', or 'all'; n_rows/start_row window the run (1-based). Returns lead_count + estimated_cost_usd + scope_resolved. ALWAYS show this to the user before run_table_column; it spends nothing.",
|
|
2188
2472
|
inputSchema: obj(
|
|
2189
2473
|
{ list_id: S, column_id: S, view_id: S, selection: O, cell_filter: S, n_rows: N, start_row: N, only_failed: B },
|
|
2190
2474
|
['list_id', 'column_id'],
|
|
@@ -2198,7 +2482,7 @@ const TOOLS = {
|
|
|
2198
2482
|
run_table_column: {
|
|
2199
2483
|
def: {
|
|
2200
2484
|
description:
|
|
2201
|
-
"SPENDS vendor credits
|
|
2485
|
+
"SPENDS vendor credits: enrich one column across the scoped rows (view_id + selection + cell_filter + n_rows/start_row, same shape as estimate_table_column). cell_filter='empty_or_stale' re-runs only rows that are empty or out of date; fresh results are never re-billed. Run estimate_table_column first and confirm with the user.",
|
|
2202
2486
|
inputSchema: obj(
|
|
2203
2487
|
{ list_id: S, column_id: S, view_id: S, selection: O, cell_filter: S, n_rows: N, start_row: N, only_failed: B },
|
|
2204
2488
|
['list_id', 'column_id'],
|
|
@@ -2212,7 +2496,7 @@ const TOOLS = {
|
|
|
2212
2496
|
run_scope_summary: {
|
|
2213
2497
|
def: {
|
|
2214
2498
|
description:
|
|
2215
|
-
'FREE counts + estimates for a column run scope
|
|
2499
|
+
'FREE counts + estimates for a column run scope: total, empty_or_stale, stale, failed rows + est_all/est_empty_or_stale/est_first_10 USD + budget. Use to decide what to run (which cell_filter) before estimate/run_table_column. Read-only.',
|
|
2216
2500
|
inputSchema: obj({ list_id: S, column_id: S, view_id: S, selection: O }, ['list_id', 'column_id']),
|
|
2217
2501
|
},
|
|
2218
2502
|
run: (a) =>
|
|
@@ -2226,7 +2510,7 @@ const TOOLS = {
|
|
|
2226
2510
|
estimate_table_run_all: {
|
|
2227
2511
|
def: {
|
|
2228
2512
|
description:
|
|
2229
|
-
'FREE per-column preview + total for running EVERY enrichment column in dependency order, optionally scoped (view_id + selection). Show before run_table_all
|
|
2513
|
+
'FREE per-column preview + total for running EVERY enrichment column in dependency order, optionally scoped (view_id + selection). Show before run_table_all; spends nothing.',
|
|
2230
2514
|
inputSchema: obj(
|
|
2231
2515
|
{ list_id: S, column_ids: ARR(S), view_id: S, selection: O, only_empty: B },
|
|
2232
2516
|
['list_id'],
|
|
@@ -2245,7 +2529,7 @@ const TOOLS = {
|
|
|
2245
2529
|
run_table_all: {
|
|
2246
2530
|
def: {
|
|
2247
2531
|
description:
|
|
2248
|
-
'SPENDS vendor credits
|
|
2532
|
+
'SPENDS vendor credits: run every enrichment column in dependency order over the scoped rows (only empty cells run by default; cached results are free). Run estimate_table_run_all first and confirm with the user.',
|
|
2249
2533
|
inputSchema: obj(
|
|
2250
2534
|
{ list_id: S, column_ids: ARR(S), view_id: S, selection: O, only_empty: B },
|
|
2251
2535
|
['list_id'],
|
|
@@ -2275,7 +2559,7 @@ const TOOLS = {
|
|
|
2275
2559
|
remove_table_rows: {
|
|
2276
2560
|
def: {
|
|
2277
2561
|
description:
|
|
2278
|
-
'Remove rows from a Scrapeloop table (list) by lead id
|
|
2562
|
+
'Remove rows from a Scrapeloop table (list) by lead id. The leads stay in the workspace pool; only the table membership and that table\'s enrichment cells are removed. Get ids from list_table_rows. To delete the whole table use delete_list.',
|
|
2279
2563
|
inputSchema: obj({ list_id: S, lead_ids: ARR(S) }, ['list_id', 'lead_ids']),
|
|
2280
2564
|
},
|
|
2281
2565
|
run: (a) =>
|
|
@@ -2364,7 +2648,7 @@ const TOOLS = {
|
|
|
2364
2648
|
delete_list: {
|
|
2365
2649
|
def: {
|
|
2366
2650
|
description:
|
|
2367
|
-
'Delete a list (the list + its membership; the underlying leads stay in the workspace). Works for any Scrapeloop list. Irreversible
|
|
2651
|
+
'Delete a list (the list + its membership; the underlying leads stay in the workspace). Works for any Scrapeloop list. Irreversible: confirm with the user first.',
|
|
2368
2652
|
inputSchema: obj({ list_id: S }, ['list_id']),
|
|
2369
2653
|
},
|
|
2370
2654
|
run: (a) =>
|
|
@@ -2375,7 +2659,7 @@ const TOOLS = {
|
|
|
2375
2659
|
delete_campaign: {
|
|
2376
2660
|
def: {
|
|
2377
2661
|
description:
|
|
2378
|
-
'Delete a campaign (the Scrapeloop campaign + its ledger; the Instantly campaign itself is not deleted). Irreversible
|
|
2662
|
+
'Delete a campaign (the Scrapeloop campaign + its ledger; the Instantly campaign itself is not deleted). Irreversible. If you only want to stop sending, pause_campaign instead. Confirm with the user first.',
|
|
2379
2663
|
inputSchema: obj({ campaign_id: S }, ['campaign_id']),
|
|
2380
2664
|
},
|
|
2381
2665
|
run: (a) =>
|
|
@@ -2388,7 +2672,7 @@ const TOOLS = {
|
|
|
2388
2672
|
list_replies: {
|
|
2389
2673
|
def: {
|
|
2390
2674
|
description:
|
|
2391
|
-
'List inbound campaign replies, newest first. Filters: sentiment (interested|not_interested|unsubscribed), handled (true = already actioned, false = needs attention), lead_id, campaign_id, status (pending|auto_classified|human_required|human_reviewed
|
|
2675
|
+
'List inbound campaign replies, newest first. Filters: sentiment (interested|not_interested|unsubscribed), handled (true = already actioned, false = needs attention), lead_id, campaign_id, status (pending|auto_classified|human_required|human_reviewed; human_required is the review queue).',
|
|
2392
2676
|
inputSchema: obj({ sentiment: S, handled: B, lead_id: S, campaign_id: S, status: S, limit: N, offset: N }),
|
|
2393
2677
|
},
|
|
2394
2678
|
run: (a) =>
|
|
@@ -2408,7 +2692,7 @@ const TOOLS = {
|
|
|
2408
2692
|
update_reply: {
|
|
2409
2693
|
def: {
|
|
2410
2694
|
description:
|
|
2411
|
-
"Update a reply: mark it handled/unhandled and/or set its sentiment. Setting sentiment is a human classification
|
|
2695
|
+
"Update a reply: mark it handled/unhandled and/or set its sentiment. Setting sentiment is a human classification: it propagates to the lead (reply_sentiment, replied_at, status transition, the unsubscribe guard for 'unsubscribed', and the workspace's auto-suppress feed).",
|
|
2412
2696
|
inputSchema: obj(
|
|
2413
2697
|
{
|
|
2414
2698
|
reply_id: S,
|
|
@@ -2519,7 +2803,7 @@ const TOOLS = {
|
|
|
2519
2803
|
{
|
|
2520
2804
|
slug: S,
|
|
2521
2805
|
status: { ...S, enum: ['planned', 'in_progress', 'deployed'] },
|
|
2522
|
-
pr_url: { ...S, description: 'PR link
|
|
2806
|
+
pr_url: { ...S, description: 'PR link: set it when marking deployed' },
|
|
2523
2807
|
},
|
|
2524
2808
|
['slug', 'status'],
|
|
2525
2809
|
),
|
|
@@ -2569,7 +2853,7 @@ const TOOLS = {
|
|
|
2569
2853
|
roadmap_update_plan: {
|
|
2570
2854
|
def: {
|
|
2571
2855
|
description:
|
|
2572
|
-
"Update a roadmap card's fields
|
|
2856
|
+
"Update a roadmap card's fields, most importantly plan_md (the execution plan). Also: title, summary, kind, track, area, effort, depends_on, files_hint, position, pr_url.",
|
|
2573
2857
|
inputSchema: obj(
|
|
2574
2858
|
{
|
|
2575
2859
|
slug: S,
|
|
@@ -2595,11 +2879,13 @@ const TOOLS = {
|
|
|
2595
2879
|
);
|
|
2596
2880
|
return Object.keys(body).length
|
|
2597
2881
|
? api('PATCH', `/roadmap/${enc(slug)}`, body)
|
|
2598
|
-
: { ok: false, status: 400, error: { detail: 'nothing to update
|
|
2882
|
+
: { ok: false, status: 400, error: { detail: 'nothing to update: pass at least one field' } };
|
|
2599
2883
|
},
|
|
2600
2884
|
},
|
|
2601
2885
|
};
|
|
2602
2886
|
|
|
2887
|
+
TOOLS.preview_pipeline.def.inputSchema = TOOLS.create_pipeline.def.inputSchema;
|
|
2888
|
+
|
|
2603
2889
|
const extractHttpMethods = (run) => [
|
|
2604
2890
|
...run.toString().matchAll(/api\(\s*['"](GET|POST|PUT|PATCH|DELETE)['"]/g),
|
|
2605
2891
|
].map((match) => match[1]);
|
|
@@ -2644,19 +2930,19 @@ for (const [name, tool] of Object.entries(TOOLS)) {
|
|
|
2644
2930
|
}
|
|
2645
2931
|
|
|
2646
2932
|
async function serve() {
|
|
2647
|
-
// Start cleanly even without a key
|
|
2933
|
+
// Start cleanly even without a key: never crash or hang. The first tools/call
|
|
2648
2934
|
// returns a clear, structured auth error (api() handles the missing key), and we
|
|
2649
2935
|
// log exactly one warning to stderr here. The key itself is never logged.
|
|
2650
2936
|
if (!API_KEY) {
|
|
2651
2937
|
warnStartupOnce(
|
|
2652
2938
|
'missing_api_key',
|
|
2653
|
-
'scrapeloop-mcp: SCRAPELOOP_API_KEY is not set
|
|
2939
|
+
'scrapeloop-mcp: SCRAPELOOP_API_KEY is not set, so tools will return an auth error until it is. ' +
|
|
2654
2940
|
'Generate a key in Scrapeloop → Settings → API access.'
|
|
2655
2941
|
);
|
|
2656
2942
|
}
|
|
2657
2943
|
|
|
2658
2944
|
const server = new Server(
|
|
2659
|
-
{ name: 'scrapeloop-mcp', version: '0.
|
|
2945
|
+
{ name: 'scrapeloop-mcp', version: '0.8.0' },
|
|
2660
2946
|
{ capabilities: { tools: {} } }
|
|
2661
2947
|
);
|
|
2662
2948
|
|
|
@@ -2697,8 +2983,8 @@ async function serve() {
|
|
|
2697
2983
|
// Exported for the manifest/tools drift test. Tests set SCRAPELOOP_MCP_NO_SERVE
|
|
2698
2984
|
// before importing so the stdio server (and the API-key requirement) stay dormant;
|
|
2699
2985
|
// the CLI leaves it unset and serves. (An entrypoint-URL check is unreliable when
|
|
2700
|
-
// the install path contains spaces
|
|
2701
|
-
// process.argv[1] does not
|
|
2986
|
+
// the install path contains spaces: import.meta.url percent-encodes them but
|
|
2987
|
+
// process.argv[1] does not, so an explicit opt-out flag is used instead.)
|
|
2702
2988
|
export {
|
|
2703
2989
|
MUTATION_POLICIES,
|
|
2704
2990
|
TOOLS,
|
package/src/mutation-policies.js
CHANGED
|
@@ -40,9 +40,14 @@ export const MUTATION_POLICIES = Object.freeze({
|
|
|
40
40
|
create_integration: keyed('POST', ['list_integrations'], ['vendor', 'plugin_kind']),
|
|
41
41
|
add_credential: reconcile('POST', ['list_credentials'], ['integration_id', 'label']),
|
|
42
42
|
test_credential: idempotent('POST', ['list_credentials'], ['credential_id']),
|
|
43
|
+
preview_pipeline: read(),
|
|
44
|
+
preview_scrape_plan: read(),
|
|
45
|
+
create_scrape_plan: keyed('POST', ['list_scrape_plans'], ['name', 'target_list_id', 'kind']),
|
|
46
|
+
pause_scrape_plan: never('POST', ['get_scrape_plan'], ['plan_id']),
|
|
43
47
|
estimate_scrape: read(),
|
|
44
48
|
submit_scrape: keyed('POST', ['list_jobs'], ['kind', 'integration_id', 'credential_id', 'table_id']),
|
|
45
49
|
cancel_job: never('POST', ['get_job'], ['job_id', 'status']),
|
|
50
|
+
attach_job_to_table: idempotent('POST', ['get_job'], ['job_id']),
|
|
46
51
|
search_leads: read(),
|
|
47
52
|
estimate_leads: read(),
|
|
48
53
|
expand_job_titles: read(),
|
|
@@ -65,6 +70,8 @@ export const MUTATION_POLICIES = Object.freeze({
|
|
|
65
70
|
run_enrich: never('POST', ['list_jobs'], ['preset_slug', 'preset_id', 'lead_ids', 'list_id']),
|
|
66
71
|
test_recipe: never('POST', ['get_credits'], ['lead_id']),
|
|
67
72
|
update_ai_settings: idempotent('PUT', ['get_ai_settings'], ['default_ai_model', 'enabled_models']),
|
|
73
|
+
update_playbook: idempotent('PUT', ['get_playbook'], ['channels', 'scrape', 'tables', 'checks', 'routing', 'campaigns']),
|
|
74
|
+
set_playbook_niches: idempotent('PUT', ['get_playbook'], ['niches']),
|
|
68
75
|
update_ai_context: idempotent('PUT', ['get_ai_context'], ['company_description', 'icp']),
|
|
69
76
|
generate_ai_context: never('POST', ['get_ai_context', 'get_credits'], ['domain']),
|
|
70
77
|
create_strategy: reconcile('POST', ['list_strategies'], ['name']),
|
|
@@ -82,8 +89,19 @@ export const MUTATION_POLICIES = Object.freeze({
|
|
|
82
89
|
pause_campaign: reconcile('POST', ['list_campaigns'], ['campaign_id', 'status']),
|
|
83
90
|
sync_campaign: idempotent('POST', ['campaign_stats'], ['campaign_id']),
|
|
84
91
|
update_sender_config: idempotent('PUT', ['get_sender_config'], ['credential_id']),
|
|
92
|
+
// A full-document PUT: sending it twice leaves the campaign in the same state
|
|
93
|
+
// as sending it once, so a lost response is safe to retry.
|
|
94
|
+
create_sender_fields: idempotent(
|
|
95
|
+
'POST', ['get_campaign_field_mapping'], ['campaign_id', 'names'],
|
|
96
|
+
),
|
|
97
|
+
set_campaign_field_mapping: idempotent(
|
|
98
|
+
'PUT',
|
|
99
|
+
['get_campaign_field_mapping'],
|
|
100
|
+
['campaign_id'],
|
|
101
|
+
),
|
|
85
102
|
create_list: keyed('POST', ['get_lists'], ['name']),
|
|
86
103
|
add_list_members: idempotent('POST', ['get_list_rows'], ['list_id', 'global_person_ids']),
|
|
104
|
+
create_pipeline: idempotent('POST', ['get_pipeline'], ['operation_id']),
|
|
87
105
|
create_workbook: reconcile('POST', ['list_workbooks'], ['name', 'list_ids']),
|
|
88
106
|
add_table_to_workbook: reconcile(
|
|
89
107
|
'POST',
|
|
@@ -123,6 +141,14 @@ export const MUTATION_POLICIES = Object.freeze({
|
|
|
123
141
|
['get_table_columns'],
|
|
124
142
|
['table_id', 'preset_slug', 'preset_id', 'label', 'operation_id'],
|
|
125
143
|
),
|
|
144
|
+
// High-value create: with auto_run it starts a credit-billed backfill, and API
|
|
145
|
+
// idempotency is per (list_id, client_operation_id), so a fresh key on retry
|
|
146
|
+
// would make a second column AND a second paid backfill. One durable key.
|
|
147
|
+
create_table_native_column: keyed(
|
|
148
|
+
'POST',
|
|
149
|
+
['get_table_columns', 'get_table_native_tools'],
|
|
150
|
+
['table_id', 'tool', 'label', 'operation_id'],
|
|
151
|
+
),
|
|
126
152
|
set_table_cells: idempotent('POST', ['list_table_rows'], ['table_id']),
|
|
127
153
|
import_leads: idempotent(
|
|
128
154
|
'POST',
|