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

  1. 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.
  2. 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.
  3. 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.
  4. Persists the field map row with status='draft' and all entries on success, or status='failed' with error_message on failure.
  5. Poll via get_field_map until status='draft'; entries are only included once status is draft.

Input Parameters

ParameterTypeRequiredDescription
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

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.

Tips

Run analyze_ingestion_file with a job_id first to create the source file record.
Use user_hints to guide the LLM on ambiguous fields specific to this store.
Poll get_field_map every 5-10 seconds — typical end-to-end is 30-120s. Do NOT re-call this kickoff while status is 'running' or 'queued'.
On a 'failed' status, read error_message from get_field_map before retrying. Validation errors won't fix themselves on retry.
Once 'draft', confirm via confirm_field_map. Each source file + target combination gets a unique mapping.

Related Tools