send_gcode
Send raw G-code commands to a connected 3D printer, with safety validation and an optional dry run to preview commands before execution.
Instructions
Send raw G-code commands directly to the printer.
Args:
commands: One or more G-code commands separated by newlines or spaces.
Examples: ``"G28"`` (home all axes), ``"G28\nG1 Z10 F300"``
(home then move Z up 10mm), ``"M104 S200"`` (set hotend to 200C).
dry_run: When ``True``, run the full validation pipeline (auth,
rate-limit, G-code safety) but do **not** actually send commands
to the printer. Returns what *would* have been sent.
past_the_melt_limit: ``True`` sends a feedrate override
(``M220 S<n>``) as written even past what the nozzle can melt,
for this request only. Pass it only when the person has read
the warning a capped answer gave and still wants the faster
speed. Every other check on the commands still applies.
The commands are sent sequentially in order. The printer must be
connected (unless ``dry_run`` is ``True``).
G-code is validated before sending. Commands that exceed temperature
limits or modify firmware settings are blocked. Use ``validate_gcode``
to preview what would be allowed without actually sending. A feedrate
override (``M220 S<n>``) above the sliced speed is held to what the
running print's file lets the nozzle melt; ``commands_sent`` and
``speed_floor`` say what was sent.
Raw G-code has no general read-back, so ``outcome`` here is
``"accepted"`` whenever the command was sent: the printer took the
bytes, and whether it EXECUTED them is not reported. Observe the
printer (``printer_status()``, or the machine itself) before building
on a G-code send. ``"failed"`` means the transport refused it.
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": {
"commands": "<commands>"
},
"name": "send_gcode"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dry_run | No | When ``True``, run the full validation pipeline (auth, rate-limit, G-code safety) but do **not** actually send commands to the printer. Returns what *would* have been sent. Default: false. | |
| commands | Yes | One or more G-code commands separated by newlines or spaces. Examples: ``"G28"`` (home all axes), ``"G28\nG1 Z10 F300"`` (home then move Z up 10mm), ``"M104 S200"`` (set hotend to 200C). | |
| past_the_melt_limit | No | ``True`` sends a feedrate override (``M220 S<n>``) as written even past what the nozzle can melt, for this request only. Pass it only when the person has read the warning a capped answer gave and still wants the faster speed. Every other check on the commands still applies. Default: false. |