Create, update, complete or delete an assembly
distru-mutate-assemblyWriteMetrcCreates, updates, completes or deletes one manufacturing assembly. Completing a Metrc output creates its package in Metrc; a Metrc processing job is created in Metrc, adjusted when its inputs change and finished when the assembly completes.
Inputs
Every tool also takes the common inputs.
| Field | Type | Required | Description |
|---|---|---|---|
| action | enumCREATEUPDATEDELETE | Yes | |
| id | string | No | Required for UPDATE and DELETE. Resolve via distru-search-assemblies. |
| status | enumPENDINGCOMPLETED | No | CREATE defaults to PENDING. COMPLETED completes every output and input: consumes the inputs and makes each output's package (in Metrc, with its tag, for a Metrc product) or batch; on a processing job it needs metrcProcessingJob.notes and finishes the job in Metrc. Can't go back to PENDING. |
| description | string | No | |
| color | enum or null18 valuesREDLIGHT_REDORANGELIGHT_ORANGEGOLDYELLOWGREENLIGHT_GREENBLUELIGHT_BLUECYANLIGHT_CYANINDIGOLIGHT_INDIGOPURPLELIGHT_PURPLEGRAYLIGHT_GRAY | No | Calendar color. Null, or omitted when creating, gives the company's default assembly color. Set only when the user asks for one. |
| estimatedStartDatetime | string | No | Planned start; Distru records no actual start. ISO 8601 with a UTC offset, e.g. "2026-09-01T00:00:00-07:00"; the company timezone is on distru-get-me. |
| estimatedWorkMinutes | integer | No | |
| ownerId | string | No | Defaults to the caller. Resolve via distru-search-users. |
| outputLocationId | string | No | Where outputs without their own locationId are made; their location's license is the assembly's. Not stored: on UPDATE a new output needs it again or its own locationId. Resolve via distru-search-locations. |
| metrcProcessingJob | object | No | Makes the assembly a Metrc processing job; only on a license that records them. It is created in Metrc, adjusted when its inputs change and finished with its waste when the assembly completes. |
| metrcProcessingJob. | string | No | Unique on the license. Set with typeId; frozen once set. Metrc text: ASCII letters, digits, spaces and .,:?'!@#$%^&*()[]/\|>+-_ only, and never the sequence (). |
| metrcProcessingJob. | string | No | Metrc processing job type. Set with name; frozen once set. Resolve via distru-search-metrc-processing-job-types (licenseId). |
| metrcProcessingJob. | string | No | Required to complete the assembly. Metrc text: ASCII letters, digits, spaces and .,:?'!@#$%^&*()[]/\|>+-_ only, and never the sequence (). |
| metrcProcessingJob. | object | No | Reported to Metrc when the job finishes; editable only while PENDING. Each quantity goes with its Metrc unit name (e.g. Grams) and stays below what the inputs total in that kind of unit. |
| metrcProcessingJob. | string or number | No | |
| metrcProcessingJob. | string | No | |
| metrcProcessingJob. | string or number | No | |
| metrcProcessingJob. | string | No | |
| metrcProcessingJob. | string or number | No | |
| metrcProcessingJob. | string | No | |
| outputs | object[] or null | No | Required for CREATE. On UPDATE the complete list: stored outputs left out are deleted with their inputs; send a stored output with just its id to keep it unchanged. Omitted or null leaves the outputs as they are. Read current rows with distru-get-assembly first (includeAssemblyLines); packages there is output only. |
| outputs[]. | string | No | UPDATE only: an output line already on the assembly; only the fields sent change, and a grouped line stands for all its packages. Omit to add one. |
| outputs[]. | string | No | Required to add an output. Resolve via distru-search-products. |
| outputs[]. | string or number | No | In the product's unit type. Required to add an output, unless each of its packages has its own. On a group, each package's, except those that send their own. |
| outputs[]. | string | No | Where this output is made; overrides outputLocationId. Resolve via distru-search-locations. |
| outputs[]. | enumPENDINGCOMPLETED | No | Only on a Metrc processing job, for a package-tracked output: COMPLETED creates this output's packages in Metrc now (with their tags) and consumes its inputs while the assembly stays PENDING. Every other output completes with the assembly: set the assembly's status instead. Can't be undone. |
| outputs[]. | string | No | Existing batch the output joins (batch-tracked products); omitted: a new batch (batch-tracked) or the product's default batch. Resolve via distru-search-batches. |
| outputs[]. | string | No | The package's free-text batch number, not a Distru batch. |
| outputs[]. | string | No | Use-by date of the package. ISO 8601 with a UTC offset, e.g. "2026-09-01T00:00:00-07:00"; the company timezone is on distru-get-me. |
| outputs[]. | string | No | Within 360 days of today; defaults to today. |
| outputs[]. | string | No | Package-tracked products only, not in the future. Omitted: with useSameItem and no productionBatchNumber, the oldest input package's; else today, or packageDate when earlier. |
| outputs[]. | string | No | An unused Metrc package tag on the license of the output's location. Required to complete a Metrc output; may be set while PENDING to reserve it. Resolve via distru-search-available-metrc-tags (licenseId). Not on a group: its tags go on packages. |
| outputs[]. | string | No | The Metrc item the package gets. A Metrc output takes exactly one of metrcItemId, pendingMetrcItemId or useSameItem; others take none. Resolve via distru-search-metrc-items (licenseId). |
| outputs[]. | string | No | A Metrc item Distru has queued but Metrc hasn't created yet. Resolve via distru-search-pending-metrc-items. |
| outputs[]. | boolean | No | The package takes its input package's Metrc item; for repackaging the same product. |
| outputs[]. | string | No | Metrc room for the package. Only on a license whose Metrc facility can assign locations to packages; any other license refuses it (must be blank), and omitting it is never refused. A location's metrcLocation from distru-search-locations is no reason to send it: send it only when the user names a Metrc room. Resolve via distru-search-metrc-locations (licenseId). |
| outputs[]. | string | No | Package note sent to Metrc. |
| outputs[]. | string or null | No | Marks the output a Metrc production batch (lab-testing and traceability consequences), so set it only when it is one. Required on every output of a processing job; on a license that records processing jobs, allowed only on one. null clears. Metrc text: ASCII letters, digits, spaces and .,:?'!@#$%^&*()[]/\|>+-_ only, and never the sequence (). |
| outputs[]. | boolean | No | Metrc finished good (states that use it); count-based units only. |
| outputs[]. | boolean | No | Metrc trade sample. |
| outputs[]. | object[] | No | Makes a group of Metrc packages (package-tracked Metrc products) from this line, one entry per package with its tag and, when they differ, its size; it comes back as one line with packages[]. When the packages are the same size, each consumes this line's inputs and costs as sent: an input quantity of 3.5 with 50 packages takes 175 from its package. When they differ, each input's and cost's quantity is the group's total, which Distru splits between the packages by size. On UPDATE the complete list for the group: each package kept by its id (with only what changes), new ones without; packages left out are deleted with their share of inputs and costs. Can't add a package once one of the group is completed, nor drop a completed one. New sizes keep the totals of the inputs and costs not sent or sent by id alone, and a call that resizes packages that already differ takes the new totals too. Only a call that turns same-size packages into different sizes, or back, can't also carry input or cost quantities, as their meaning changes with it: that change alone first, then the quantities. An assembly holds at most 300 packages, 2,000 inputs and 1,000 costs, each package's counted. |
| outputs[]. | string | No | UPDATE only: a package already in this line's group (its packages[].id in distru-get-assembly); only the fields sent change. Omit to add a package. |
| outputs[]. | string | No | This package's unused Metrc tag, on the license of the output's location. Required to complete it. Resolve via distru-search-available-metrc-tags (licenseId). |
| outputs[]. | string or number | No | This package's size, in the product's unit type. Omitted: the line's quantity, else (a stored package) its own. A new package needs it when the line sends no quantity and its group's packages differ in size. |
| outputs[]. | integer | No | In place of packages while their tags aren't known: makes this many packages of the line's quantity. On UPDATE a larger number adds packages, a smaller one drops the last ones. Send packages, each with its metrcLabel, to complete them. |
| outputs[]. | object[] or null | No | What this output consumes; on a group, what each package consumes (the group's totals when its packages differ in size). Required to add an output: every output consumes at least one input. On UPDATE the complete list for this output: stored inputs left out are deleted and their stock released; send a stored input with just its id to keep it. Omitted or null leaves them as they are. Read current rows with distru-get-assembly first (includeAssemblyLines). |
| outputs[]. | string | No | UPDATE only: an input already on this output; only the fields sent change. Omit to add one. |
| outputs[]. | string | No | Consume from this package (package-tracked products); its product, batch and location follow. Resolve via distru-search-packages. |
| outputs[]. | string | No | Consume from this batch (batch- and product-tracked products); its product follows. Resolve via distru-search-batches. |
| outputs[]. | string | No | A new input takes one of packageId, batchId or productId. Alone: a DRAFT input, or stock of a product-tracked product at locationId. Resolve via distru-search-products. |
| outputs[]. | string or number | No | In the input product's unit type (convert a bill of materials' anyProductMatching quantity from its unitType): what this output consumes in total; on a group (packages), what each package consumes, or, when its packages differ in size, the group's total, split by size. Required to add an input. |
| outputs[]. | string | No | Where the stock is taken from. Omitted on a package input: the package's; required otherwise. Resolve via distru-search-locations. |
| outputs[]. | enumPENDINGDRAFT | No | PENDING (default) claims the stock now, so the input needs its package or batch and enough stock. DRAFT plans a quantity of productId at locationId, claiming none; before the assembly completes, send it by id with its packageId or batchId and status PENDING. Never DRAFT when the stock should be claimed. |
| outputs[]. | object[] or null | No | Costs added on this output (labor, packaging, every cost of its product's bill of materials), carried into what it makes when it completes; on a group, each package's (the group's totals when its packages differ in size). On UPDATE the complete list for this output: stored costs left out are deleted; send a stored cost with just its id to keep it. Omitted or null leaves them as they are. Needs the permission to apply costs to assemblies. Read current costs with distru-get-assembly (includeOutputAddedCosts). |
| outputs[]. | string | No | UPDATE only: a cost already on this output (its addedCosts[].id); only the fields sent change. Omit to add one. |
| outputs[]. | string | No | Required to add a cost. Resolve via distru-search-lookups (type COST_TYPE). |
| outputs[]. | string or number | No | In the cost type's unit type, e.g. hours of labor: the total for this output; on a group (packages), each package's, or, when its packages differ in size, the group's total, split by size. A bill of materials gives it per unit. Required to add a cost. |
| outputs[]. | string or number | No | Defaults to the cost type's; only a cost type that allows inline edits takes another. |
| outputs[]. | string | No | |
| customFields | object[] | No | Only the fields listed change. Required custom fields must be set, on update too, while still blank. |
| customFields[]. | string | Yes | Resolve via distru-search-custom-fields (entityType ASSEMBLY). |
| customFields[]. | string or string[] | Yes | TEXT: the text. DROPDOWN: the option name. CHECKBOX: an array of option names. DATE: YYYY-MM-DD, company timezone. "" or [] clears the field. |
Output
This tool returns one of 2 shapes, depending on its inputs.
Presence on a nested field assumes its parent exists.
Result with assembly
| Field | Type | Presence | Description |
|---|---|---|---|
| assembly | object | Always | |
| assembly. | string | Always | |
| assembly. | object[] | Always | |
| assembly. | object | Always | |
| assembly. | string | Always | |
| assembly. | string | Always | |
| assembly. | enumCHECKBOXDATEDROPDOWNTEXT | Always | |
| assembly. | string | Can be null | |
| assembly. | string | Always | |
| assembly. | enum18 valuesREDLIGHT_REDORANGELIGHT_ORANGEGOLDYELLOWGREENLIGHT_GREENBLUELIGHT_BLUECYANLIGHT_CYANINDIGOLIGHT_INDIGOPURPLELIGHT_PURPLEGRAYLIGHT_GRAY | Can be null | Calendar color. A record saved without one shows the company's default. |
| assembly. | enumCOMPLETEDPENDING | Always | |
| assembly. | enumBIOTRACKMETRCNONE | Always | |
| assembly. | string | Can be null | |
| assembly. | string | Can be null | |
| assembly. | string | Can be null | |
| assembly. | number | Can be null | |
| assembly. | string | Can be null | |
| assembly. | string | Always | |
| assembly. | string | Always | |
| assembly. | object | Can be null | |
| assembly. | string | Always | |
| assembly. | string | Always | |
| assembly. | object | Can be null | |
| assembly. | string | Always | |
| assembly. | string | Always | |
| assembly. | object | Always | |
| assembly. | string | Always | |
| assembly. | enumMANUFACTURINGPACKAGE_SPLITTEST_SAMPLESALES_ORDER_REPACKAGE | Always | |
| assembly. | object | Can be null | |
| assembly. | string | Can be null | |
| assembly. | string | Can be null | |
| assembly. | object | Can be null | |
| assembly. | string | Always | |
| assembly. | string | Always | |
| assembly. | string | Can be null | |
| assembly. | string | Can be null | |
| assembly. | object | Always | |
| assembly. | string | Can be null | |
| assembly. | string | Can be null | |
| assembly. | string | Can be null | |
| assembly. | string | Can be null | |
| assembly. | string | Can be null | |
| assembly. | string | Can be null | |
| assembly. | object[] | Always | |
| assembly. | string | Always | |
| assembly. | enumCOMPLETEDPENDING | Always | |
| assembly. | string | Can be null | In the product's unit type; for an output group, each package's. Null when the group's packages differ in size: read each one's in packages[]. |
| assembly. | string | Can be null | |
| assembly. | string | Can be null | |
| assembly. | string | Can be null | |
| assembly. | string | Can be null | |
| assembly. | string | Can be null | |
| assembly. | string | Can be null | |
| assembly. | boolean | Always | |
| assembly. | boolean | Always | |
| assembly. | boolean | Can be null | |
| assembly. | object | Can be null | |
| assembly. | string | Always | |
| assembly. | string | Always | |
| assembly. | object | Can be null | |
| assembly. | string | Always | |
| assembly. | string | Always | |
| assembly. | object | Always | |
| assembly. | string | Always | |
| assembly. | string | Always | |
| assembly. | object | Always | |
| assembly. | string | Always | |
| assembly. | string | Always | |
| assembly. | object | Can be null | |
| assembly. | string | Always | |
| assembly. | string | Always | |
| assembly. | object | Can be null | |
| assembly. | string | Always | |
| assembly. | string | Always | |
| assembly. | object | Can be null | |
| assembly. | string | Always | |
| assembly. | string | Always | |
| assembly. | object | Can be null | |
| assembly. | string | Always | |
| assembly. | string | Always | |
| assembly. | string | Can be null | In the output's packageUnitType, as tracked in Metrc; null when complianceType is NONE or the group's packages differ in size. |
| assembly. | integer | Always | Packages this line makes: more than 1 for an output group. When its packages are the same size, quantity, assemblyInputs and addedCosts are per package (multiply by packageCount for the group's total). When they differ (quantity null), sizes are in packages[], and assemblyInputs and addedCosts are the group's totals, split between the packages by size; their ids are the first package's. |
| assembly. | object[] | Can be null | Each package of an output group, lowest ID first; null for a single package. |
| assembly. | string | Always | |
| assembly. | enumCOMPLETEDPENDING | Always | |
| assembly. | string | Can be null | |
| assembly. | string | Always | |
| assembly. | string | Can be null | |
| assembly. | object | Can be null | |
| assembly. | string | Always | |
| assembly. | string | Always | |
| assembly. | object[] | Can be absent | |
| assembly. | string | Always | |
| assembly. | enumCOMPLETEDDRAFTPENDING | Always | |
| assembly. | string | Always | |
| assembly. | object | Always | |
| assembly. | string | Always | |
| assembly. | string | Always | |
| assembly. | object | Always | |
| assembly. | string | Always | |
| assembly. | string | Always | |
| assembly. | object | Can be null | |
| assembly. | string | Always | |
| assembly. | string | Always | |
| assembly. | object | Can be null | |
| assembly. | string | Always | |
| assembly. | string | Always | |
| assembly. | object | Can be null | |
| assembly. | string | Always | |
| assembly. | string | Always | |
| assembly. | object | Always | |
| assembly. | string | Always | |
| assembly. | string | Always | |
| assembly. | string | Can be null | |
| assembly. | object[] | Can be absent | |
| assembly. | string | Always | |
| assembly. | string | Always | |
| assembly. | string | Can be null | |
| assembly. | object | Can be null | |
| assembly. | string | Always | |
| assembly. | string | Always | |
| assembly. | string | Always | |
| assembly. | string | Always | |
| assembly. | object | Always | |
| assembly. | string | Always | |
| assembly. | string | Always | |
| assembly. | string | Can be null | |
| assembly. | string | Can be null |
Result with id
| Field | Type | Presence |
|---|---|---|
| id | string | Always |
What the AI reads
Creates, updates, completes or deletes one manufacturing assembly: a job that consumes inputs (packages, batches or products) and makes outputs, each output with the inputs it consumes. While PENDING, inputs claim their stock (a DRAFT input only plans a quantity). Completing the assembly (status COMPLETED) completes every output and input: it consumes the inputs and makes each output's package (created in Metrc with its tag, for a Metrc product) or batch. Completion can't be undone, and a completed assembly can't be deleted or changed beyond its description, color, owner, estimatedWorkMinutes and custom fields. Several Metrc packages from one output: packages, one entry per package with its tag (and its size when they differ); they come back as one output line with packages[]. To split one package into packages of the same product use distru-split-package. A Metrc processing job (metrcProcessingJob) is finished in Metrc with its waste when the assembly completes; its package outputs may complete one at a time before that. Unless the user names the inputs, read each output product's bill of materials first (distru-get-product includeBillOfMaterials) and send all of it, inputs and costs; its quantities are per unit, so multiply by the output's quantity. DELETE removes a pending assembly with no completed output for good and releases what its inputs claimed. CREATE and UPDATE return the assembly as distru-get-assembly does with includeAssemblyLines and includeOutputAddedCosts; DELETE returns its id. Sparse update: on UPDATE only the fields passed change; outputs, and inputs and costs on an output, replace the whole list when passed — read the assembly with distru-get-assembly first and resend every row you keep.