Table enrichment workflows
Build and enrich a LeadMagic table through MCP: map product inputs, preview a sample, run dependent columns, inspect outcomes, and retry selected rows.
These workflows use the typed tools in the LeadMagic Tables reference. Connect with OAuth first. Examples show tool arguments, not REST request bodies.
All UUIDs, column keys, company values, and names below are illustrative. Replace them with the IDs and keys returned by your tools. A sample run can spend credits; reading and configuring a table does not itself start a run.
Open an existing table
Find the table
Call list_sheets with q to find the table by name. If several match, choose the exact table before changing it.
Read its columns
Call get_sheet with its ID. Read the column keys, actions, input mappings, and any automatic AI triggers.
Read only what you need
Use get_sheet_stats for table-wide counts. Read a small page of the needed columns with read_sheet_rows:
Use the returned next_cursor for an unsorted next page, or next_offset for a sorted page. Keep the filter, search, and sort unchanged while paging. Row position is useful for presentation; row_id is the address for writes.
Create a table and add inputs
create_sheet creates an empty table. Its optional columns are manual column names, not enrichment definitions:
Read the resulting table with get_sheet to obtain the generated keys. Append inputs with add_sheet_rows; each row is a map of those keys to strings:
The response returns row_ids in order and, when available, columns_to_fill. Appending does not submit a manual enrichment run. Existing AI auto-run rules may trigger on new rows; columns marked runs_automatically should not be submitted again just because they are temporarily blank.
Batch up to 100 new rows per call. Cell text is limited to 4,000 characters and each row can carry at most 200 column values. For a file upload, use the app, then return to MCP to configure and enrich the imported table.
Correct existing inputs
Use one set_sheet_cells call for up to 500 edits, rather than one tool call per cell. The first call returns a summary and confirmation token; show the summary and wait for the user's approval, then repeat the same arguments with that token:
An empty string clears a cell. Inspect applied, skipped, and rejected in the response; a tool response can contain a partial result. Refresh the card if a row or column was removed while you were editing. Fixing an input is preferable to overwriting a computed result, and may activate an existing AI inputs-changed rule.
Add an enrichment column
For add_sheet_column, map the product's API input fields to the table's stable column keys:
Map every useful input the table actually has. Do not invent a column or a value to complete the mapping. Work Email can use name and company/domain inputs as well as a profile URL; mapping only the profile column leaves useful inputs unused.
add_sheet_columns creates and configures up to 50 columns in one call. configure_sheet_column can change an existing column's action. Read the card after either operation to get the current keys and configuration. Configuration alone does not fill the enrichment column.
Available enrichment products
These are LeadMagic Tables product slugs and their supported mapping fields. The fields below are available inputs, not a claim that every field is required in every lookup.
| Product | Input fields |
|---|---|
email_validation | email |
email_finder | first_name, last_name, domain, company_name, profile_url |
personal_email_finder | profile_url |
profile_search | profile_url |
mobile_finder | profile_url |
role_finder | domain, company_name, job_title |
job_change_detector | profile_url, domain, company_name |
email_to_b2b_profile | email |
b2b_profile_to_email | profile_url |
company_search | domain, company_name |
company_funding | domain, company_name |
technographics | domain |
Table enrichment has no job-postings product. For jobs, use the MCP job tools, then write selected results into manual columns if that is the requested task. Work-email finder results are already verified; a second validation column is generally useful for existing or imported emails rather than revalidating every finder result.
Run a sample and verify it
Use run_sheet_column with the returned Work Email key:
sample_size takes the first eligible rows in the selected scope, up to 1,000. confirm_max_credits caps the quote; it does not approve a larger run or bypass confirmation. In this example, a quote above 5 credits stops with a budget reason. It does not silently enlarge the budget.
A known quote of at most 5 credits can start immediately. Larger quotes return needs_confirmation. An unknown price cannot start a run, even with a token; wait for a valid quote. Show the requested work and quoted maximum to the user; after approval, repeat the same arguments with the returned confirmation_token. Do not treat the token's presence as user approval. Tokens expire after 10 minutes, and changed arguments or configuration require a fresh quote.
After a run starts:
Check whether it settled
Inspect whether the run has settled or still has running work.
Wait on the run
Use get_sheet_run with its run_id and a bounded wait if needed:
Read the sample results
Read sample result cells and their states. A completed run may include no-result or failed rows.
Expand the run
Check that the output is suitable before asking to expand the run to the intended scope.
Waiting costs no enrichment credits. A response with still_running: true means the wait ended before all work finished, not that the run failed. Avoid a loop of immediate status calls.
Run dependent columns as a pipeline
Suppose a company lookup fills a structured profile, a JSON projection extracts a useful field, and an AI column reads that field. Configure the dependencies first, then request the run-backed columns together:
The tool supports up to 10 requested columns total. It orders stages using their inputs, including dependencies through formula and JSON columns. Independent requested columns can start together; downstream columns wait for upstream values. Do not submit one run per row or start a downstream column while its inputs are blank.
The first quote covers the stage that can start now. During the bounded wait, the tool can continue eligible stages and return their results. If a later stage needs approval, the response includes next_step and next_arguments. Show next_step.summary, then submit exactly next_arguments plus next_step.confirmation_token only after approval. A larger pipeline does not grant blanket approval to all later stages.
If the upstream stage is still running, use list_sheet_runs with wait_seconds, then continue using the returned next_arguments. Follow the response's next guidance; do not rebuild the continuation from guessed column IDs.
Extract structured fields
After an enrichment or API result has populated, call list_sheet_column_fields to discover actual paths. Pass a discovered path to extract_sheet_json_field, along with the source column key and the new column name. The tool creates a JSON projection column and fills it from existing source values without another paid lookup. It recomputes when the source changes.
Do not guess that a result has first_name, website, or another field. Field discovery needs populated source rows; run a sample first. See AI columns and supported recipes for structured output. Configure custom HTTP integrations in the LeadMagic app; the hosted public MCP does not create or run arbitrary HTTP requests.
Work on selected or filtered rows
- Selected rows
- Filter or search
For a fixed set of returned row IDs, use scope: "selection" and row_ids:
Do not combine selection row_ids with filter or q. For a row window, start_row and end_row are one-based positions in the chosen scope; keep the selection stable and use IDs for subsequent writes.
Retry the right failures
Use list_sheet_run_rows to inspect run outcomes and errors without retrieving every cell value. Inspect read_sheet_rows when you need the actual result. get_sheet_stats gives table-wide counts for a filter or search.
| Outcome or skip reason | Next action |
|---|---|
| Failed request | Read the error. Correct the input, credential, or configuration before retrying failed rows. |
| Insufficient credits | Resolve the credit or budget issue, then retry that state. |
| No result | Keep the value empty and report it accurately. Retry only if new inputs or a deliberate second attempt justify it. |
| Not run / missing inputs | Fill or run upstream inputs before submitting downstream work. |
| Existing or unchanged result | Keep the result unless a refresh is intended. force: true can repeat work and spend again. |
| Active claim / queued | Check the active run rather than submitting duplicates. |
| Condition not met | Review the column's run condition and the intended selection. |
For a targeted retry with run_sheet_column:
The other retry selectors are insufficientCredits, noResult, and notRun. A retry still follows the cost and approval rules. Supply an idempotency_key when retrying the same run submission after a timeout; reuse it for that submission rather than creating a new key on each attempt. Before retrying an append after an uncertain response, read the table to avoid adding duplicate rows.
Pause, cancel, delete, and restore
Pause or cancel a run
Pause or cancel a run
Use pause_sheet_run or cancel_sheet_run with the exact table and run IDs. Pausing stops further work immediately and keeps completed cells. Canceling first returns a confirmation summary; after the user approves, repeat the same call with its token. Cancel ends the run permanently; resume a paused run in the app.
Delete and restore rows or columns
Delete and restore rows or columns
delete_sheet_rows and delete_sheet_column ask for confirmation before removing data. Retain the original IDs or key if a restore may be needed: restore_sheet_rows takes row IDs, and restore_sheet_column takes the deleted key and optional placement key. Restoring data does not refund completed enrichment or create a new run.
Rename, move, or archive a table
Rename, move, or archive a table
update_sheet can rename, move, archive, or unarchive a table. folder: null removes the folder assignment. Archived tables leave the normal list but retain their data.
Refresh the card after structural changes and describe the final state, including any incomplete work, to the user.
Was this page helpful?
We value your feedback.