Wait For Inventory Job
cnc_wait_for_inventory_jobPoll an inventory job until it reaches a terminal state or times out, instead of rechecking it in a loop after a write returns JOB_RUNNING. Reports success, warnings, or failure.
Instructions
Poll an inventory job until it reaches a terminal state or the timeout elapses.
Read-only. Use it right after a write that came back JOB_RUNNING instead of calling cnc_get_inventory_job in a loop. Terminal states are the verified ones: JOB_COMPLETED and JOB_COMPLETED_WITH_WARNING (both successes; the latter carries an advisory, e.g. a no-op or partially applied write), and JOB_FAILED / JOB_CANCELLED / JOB_ABORTED (failures). Any other state (JOB_RUNNING or an in-progress state not seen before) keeps the tool polling until the timeout.
Returns: str: "Inventory job completed after s." followed by the job JSON (with "impacted_objects" parsed from "impacted") on success; for JOB_COMPLETED_WITH_WARNING the line also carries "Warning: " and the JSON gains a "warning" key. A timeout is NOT an error: "Inventory job not finished after s; current state: JOB_RUNNING. ..." followed by the job JSON — call again to keep waiting. "Error: Inventory job failed (job , state JOB_FAILED): " when the job ended unsuccessfully; "Error: No inventory job with id ..." when the id matches nothing; other API failures: "Error: ...".
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| job_id | Yes | Inventory job id to wait for (e.g. '0f6c1a2e-...'). | |
| timeout_seconds | No | Give up after this many seconds (e.g. 120). | |
| interval_seconds | No | Seconds between polls (e.g. 5). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |