map_source_database_to_target AI
LLM-driven field mapping from source data to target platform schema
Overview
ASYNC KICKOFF. Triggers a background 3-pass (Generate → Review → Revise) LLM field mapping from a source file analysis to a target platform schema. The kickoff returns within ~1s with a field_map_id and status='queued' (or 'running' if a worker has already claimed it); the actual pipeline runs in the background and typically completes in 30-120s. Poll get_field_map until status flips to 'draft' (success) or 'failed' (with error_message). Calling the kickoff again while a run is still 'queued' or 'running' returns the SAME field_map_id rather than starting a redundant background run — do not retry the kickoff to 'speed it up'.
How It Works
- Validates inputs (source_file_id ownership, target active, user_hints size) and returns immediately with { field_map_id, status: 'queued' } — no MCP 30s timeout risk.
- If a previous kickoff for the same (job, source_file, target) is still running/queued, returns that existing field_map_id instead of starting a duplicate run.
- In the background: Pass 1 (Generate) calls the primary model with the source analysis + target schema; Pass 2 (Review) sends the result to an adversarial reviewer; Pass 3 (Revise) feeds the critique back to the generator for a final mapping.
- Persists the field map row with status='draft' and all entries on success, or status='failed' with error_message on failure.
- Poll via get_field_map until status='draft'; entries are only included once status is draft.
Input Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
job_id |
string |
required | Clone job ID |
source_file_id |
string |
required | ID of an analyzed source file (returned by analyze_ingestion_file with job_id) |
target |
string |
required | Target platform ID (e.g. medusa_v2) |
user_hints |
object |
optional | Optional field-specific hints (e.g. { 'pa_color': 'This is a product color option' }) |
What You Get Back
- field_map_id — id to poll via get_field_map
- status — 'queued' (newly enqueued or existing queued run) or 'running' (worker has already claimed it; same id returned for dedup)
- message — human-readable guidance for the calling agent
- deduplicated — true when the same id was returned because a run was already in flight
Example Use Case
After analyzing a WooCommerce XML export, call this tool with target='medusa_v2'. You'll get { field_map_id, status: 'queued' } in under a second. Poll get_field_map every 5-10s until status becomes 'draft', then review the entries (e.g. '_regular_price' → money_amount.amount with multiply_100, 'pa_color' → product_option, '_wp_page_template' → metadata) and call confirm_field_map.
