Fab order pack
fab_exportGenerates zipped Gerbers, Excellon drill, BOM and placement CSVs for a PCB fab profile, running ERC/DRC checks first and blocking orders until blockers are fixed or waived.
Instructions
Produce the order pack for a PCB fab: Gerbers + Excellon drill zipped, a BOM CSV and a placement (centroid/CPL) CSV, all in the format of a fab PROFILE. Writes to /copper-out/fab/. profile: omit to use the project's configured profile (fab.profile in the Copper config; 'jlcpcb' out of the box). Built in: 'jlcpcb' (Protel gerbers; BOM 'Comment, Designator, Footprint, LCSC Part #'; CPL 'Designator, Mid X, Mid Y, Layer, Rotation' with JLC rotation corrections), 'pcbway', 'oshpark' (bare boards) and 'generic' (Gerber X2 + Excellon + KiCad position file + plain BOM with MPN/Manufacturer — for any other fab). Users add their own as JSON in $COPPER_HOME/fabs/ or /.copper/fabs/. profile='list' returns every available profile with its rules and notes (nothing is exported).
It first runs ERC + DRC (zones refilled, schematic parity) and REFUSES (error FAB_BLOCKED, listing blockers with fixes) for whatever
the profile says blocks an order: ERC errors, DRC errors, unrouted nets, parity issues, no board outline, an empty board and — for
profiles that need one per part, like jlcpcb — assembled parts without the profile's part number.
Fix the blockers (each comes with the next tool call); pass waive=[codes] ONLY for things the user consciously accepts:
'erc','drc','unrouted','parity','parts','outline','empty' or 'all'. assembly=false skips BOM + placement (bare PCB order).
With assembly it also asks the parts provider for live stock of every BOM part (for boards boards, default 5): parts with zero /
too little stock or not listed come back in warnings (code 'stock': affected refs + a ready parts_alternatives fix per part). That never blocks;
waive=['stock'] acknowledges it. Offline (or with check_stock=false), stock.not_checked and the first order note say stock was NOT checked.
Every output is checked (non-empty, complete layer set, zip readable). Returns board size, layers, min track/drill, part counts,
summary.assembly_fees (Basic / Preferred / Extended counts, the fee total, extended_refs = which parts cause it) when the
profile has part classes, and order notes.
Examples: fab_export() · fab_export(profile='generic') · fab_export(waive=['parts']) · fab_export(assembly=false)
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "fab_export"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| waive | No | ||
| boards | No | boards in the order, for the stock check (default 5) | |
| layers | No | override gerber layer list (rarely needed) | |
| out_dir | No | output folder (default <project>/copper-out/fab) | |
| profile | No | fab profile name (default: the project's configured one); 'list' shows them | |
| project | No | project path (default: active) | |
| assembly | No | also write BOM + placement files (default: true when the fab assembles) | |
| check_stock | No | ask the parts provider for live stock (default true) |