Send G-code to Printer
send_to_printerUse this when you need to upload a .gcode file (e.g. written by export with target: "model", format: "gcode") to a real network printer and, by default, start the print. protocol: 'octoprint' (POST /api/files/local with an X-Api-Key), 'moonraker' (Klipper's POST /server/files/upload), or 'bambu-lan' (Bambu Lab LAN-mode: FTPS implicit-TLS upload on port 990 as user 'bblp' with the printer's LAN access code, then an MQTT print-start command on port 8883 — requires access_code and, unless start_print is false, serial). Pass { dry_run: true } to validate connectivity/authentication only, without uploading or starting a print. Never logs or echoes api_key/access_code.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| host | Yes | Printer hostname or IP. | |
| port | No | Override the protocol default port. | |
| serial | No | Bambu printer serial number (required to start a print unless start_print is false). | |
| api_key | No | OctoPrint API key (Settings -> API). | |
| dry_run | No | Validate connectivity/auth only; never uploads or starts a print. | |
| filename | No | Uploaded file name (default: 'kernelcad.gcode'). | |
| protocol | Yes | ||
| gcode_path | Yes | Path to the .gcode file on disk. | |
| access_code | No | Bambu LAN-mode access code (printer settings -> LAN Only Mode). | |
| start_print | No | Start the print immediately after upload (default: true). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | ||
| error | No | ||
| dry_run | No | True when only connectivity/auth was validated (no upload, no print start). | |
| diagnostics | No | ||
| uploaded_path | No | Path/name the G-code was stored under on the printer. |