Skip to main content
Glama

intercept_gcode_command

Read-only

Check a single G-code line against session safety rules before sending it to a 3D 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.

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": {
      "session_id": "<session_id>",
      "command": "<command>"
    },
    "name": "intercept_gcode_command"
  }
}

Input Schema

NameRequiredDescriptionDefault
commandYesRaw G-code command string (e.g. "M104 S280", "G1 X10 F6000").
session_idYesActive interception session ID.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv1.5.1
    • addedInput schema / properties / command / description
      Added value: +"Raw G-code command string (e.g. \"M104 S280\", \"G1 X10 F6000\")."
    • addedInput schema / properties / session_id / description
      Added value: +"Active interception session ID."
  2. First observedv0.1.0

TDQS

A4.6/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already say readOnly/non-destructive, and the description goes well beyond them: it discloses that interception is not automatic, that the tool only reports, and that coverage_warnings can make an 'allow' mean merely 'nothing I could check objected'. That caveat is real behavioral context no annotation carries.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the core action, and the action bullet list is well structured and easy to act on. Some material is padding for this audience: the G-code primer ('heat the nozzle to 250C') and the trailing 'Returns the interception result...' sentence duplicate the output schema and would be cut without losing information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Covers everything needed to invoke and interpret results correctly: when to call, what each action means, the modify/pause special cases, and the coverage-warning caveat. With an output schema present, the description is not obliged to explain the return payload in detail, so the remaining omission (error behavior for an invalid session) is minor.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% and the description's parameter notes ('Active interception session ID', example commands) largely restate the schema. It adds a little meaning by implying the session supplies the temperature ceilings, speed caps and build volume used for the check, but nothing about format, validity or edge cases beyond that.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb, resource and scope: check one line of G-code against this session's safety rules before sending. The 'smoke detector, not a sprinkler' framing plus 'it reports; it does not intervene' cleanly separates it from siblings like send_gcode or validate_gcode, so an agent can tell what this tool is and is not.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly says to call it on each line before sending that line, then gives per-outcome instructions for allow/block/modify/pause/alert, including which field to send or show the user. It also warns that unchecked or ignored lines reach the printer untouched, which is the exact failure mode the agent needs to avoid.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools