send_gcode
Sends raw G-code commands to a connected 3D printer in sequence, validating safety limits and optionally previewing commands with a dry run 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.
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.
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). |