Set Import Mapping
set_import_mappingSet (or replace) the declarative column mapping for a staged import session and validate it against EVERY staged row. Author the mapping from the profile get_import_session returns. For salesOrderHistory: fields keyed by canonical name (orderNumber, customerPurchaseOrder, orderDate, sku, upc, itemName, quantity, price, uomName, customerName, customerEmail); requires an identity field (orderNumber or customerPurchaseOrder), orderDate, quantity, and an item reference (sku/upc/itemName). For purchaseOrderHistory: fields (poNumber, supplierName, orderDate, receivedDate, expectedDate, status, supplierInvoiceNumber, note, sku, upc, itemName, quantity, unitCost, uom, minimumOrderQuantity); requires poNumber, supplierName, orderDate, quantity, and an item reference. For customerReturnHistory (one row per returned item): fields (returnNumber, returnDate, salesOrderReference, note, sku, upc, quantity, reason); requires returnNumber, returnDate, quantity and sku or upc; reason must be one of not_needed, wrong_product, other, cancelled (net demand), defective, damaged, fulfillment_error, refunded_not_returned (do not) — translate the export's own values with valueMap, e.g. {"Restock": "not_needed"}; unmapped blanks are treated as lost demand. Each field is bound to a source column (or a const), with optional dateFormats (orderDate/receivedDate/returnDate) and valueMap; filters include/exclude rows by column value (e.g. exclude Status=Cancelled). dateFormats are .NET custom format strings (MM-dd-yy, yyyy-MM-dd), NOT strftime — prefer a format the profile already reported in detectedDateFormats, or omit dateFormats and let the loose invariant parse handle it. The response is a bucketed validation report over the full dataset — iterate on the mapping until the skip rate is acceptable, then preview via commit_import_session. Invalid rows are excluded from the import, never silently fixed. Treat validation.warnings as blocking.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"importSessionId": "<importSessionId>",
"mapping": "<mapping>"
},
"name": "set_import_mapping"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mapping | Yes | The declarative mapping (fields + filters). | |
| importSessionId | Yes | The import session id (GUID). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | No | ||
| validation | No | ||
| readyToPreview | No |