intercept_gcode_command
Check a single G-code command against session safety rules to determine if it can be safely sent to the printer, returning allow, block, modify, pause, or alert.
Instructions
Check one line of G-code for danger before you send it to a printer.
G-code is the language printers take orders in -- "heat the nozzle to
250C", "move to X=100". One bad line can cook a hotend or drive the
nozzle into the bed. This checks a single line against the safety
rules for this session (temperature ceilings, speed caps, the
printer's build volume) and says whether it looks safe to send.
It is a smoke detector, not a sprinkler. It reports; it does not
intervene. Kiln does not quietly pipe outgoing G-code through it, so
a line gets checked only when you call this on it, and gets stopped
only if you act on the answer. A line you never checked, or one you
checked and sent anyway, reaches the printer untouched.
So call it on each line before sending that line, and do what the
answer says:
- ``allow`` -- looks safe; send as-is.
- ``block`` -- dangerous; do not send.
- ``modify`` -- send ``modified_command`` instead, never the original.
- ``pause`` -- hold, and ask the user before sending.
- ``alert`` -- may be sent, but show the user ``reasons`` first.
A session can also come back with ``coverage_warnings`` (see
``start_gcode_interception``), meaning some checks could not be set up
at all -- usually because Kiln does not know which printer model it is
guarding. An ``allow`` from a session like that means "nothing I was
able to check objected", not "this is safe". Tell the user that
rather than reporting a clean pass.
Args:
session_id: Active interception session ID.
command: Raw G-code command string (e.g. "M104 S280", "G1 X10 F6000").
Returns the interception result including action, modified command
(if applicable), triggered rules, and human-readable reasons.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| command | Yes | ||
| session_id | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||