Skip to main content
Glama

send_gcode

Destructive

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

NameRequiredDescriptionDefault
dry_runNoWhen ``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.
commandsYesOne 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_limitNo``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.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.6.0
    • addedInput schema / properties / past_the_melt_limit
      Added value: +{
      +  "description": "``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.",
      +  "title": "Past The Melt Limit",
      +  "type": "boolean"
      +}
  2. Changed2 schema fields changedv1.5.1
    • addedInput schema / properties / commands / description
      Added value: +"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)."
    • changedInput schema / properties / dry_run / description
      Previous value: -"Default: false."New value: +"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."
  3. Changed2 schema fields changedv1.5.0
    • removedInput schema / properties / dry_run / default
      Removed value: -false
    • addedInput schema / properties / dry_run / description
      Added value: +"Default: false."
  4. First observedv0.1.0

TDQS

A4.4/5.0
Behavior4/5

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

Goes well beyond the annotations (readOnlyHint=false, destructiveHint=true) by disclosing the pre-send validation pipeline, that temperature-limit-exceeding and firmware-modifying commands are blocked, sequential execution order, the printer-connection prerequisite, and the feedrate cap tied to the running print's file. The one gap is that it never mentions the auth or printer-lock requirements it alludes to ('auth' in dry_run is mentioned), leaving concurrency behavior unstated for a destructive tool.

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 one-liner followed by an Args block and then behavioral notes, which is easy to scan. There is measurable duplication of the schema's dry_run and past_the_melt_limit text, and the closing paragraph on outcome semantics is dense, but every section carries 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?

With no output schema, the description carries the return-value burden and does so explicitly: outcome is 'accepted' when bytes were taken, 'failed' when transport refused, and execution is not reported, with instructions to confirm via printer_status(). It also mentions commands_sent and speed_floor and the melt-limit capping rule, covering what an agent needs to call and interpret this correctly.

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 coverage is 100% and the parameter descriptions largely duplicate the docstring verbatim, so little new meaning is added per parameter. The description does contribute adjacent behavioral context ('printer must be connected unless dry_run is True', sequential ordering) that helps interpret the params, keeping it at the baseline rather than below.

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?

Opens with a specific verb and resource: 'Send raw G-code commands directly to the printer.' The word 'raw' and 'directly' distinguish it from the sibling validate_gcode, which is named later as the preview-only alternative.

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 routes the agent: use validate_gcode to preview what would be allowed without sending, and use dry_run to run the full validation pipeline without transmission. It also gates past_the_melt_limit on the person having read a prior warning, so the agent knows exactly when not to pass it.

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