Skip to main content
Glama

validate_gcode

Read-only

Validate G-code syntax and basic safety before sending, returning blocking errors, warnings, and blocked commands so you can preview what will be accepted or rejected.

Instructions

Validate G-code syntax and basic safety (generic, no printer-specific limits).

        For printer-specific safety validation (PTFE temp caps, speed limits),
        use ``validate_gcode_safe`` with a ``printer_id`` instead.

        Args:
            commands: One or more G-code commands: a newline-separated
                string, or a list of command strings.

        Returns a JSON object with:
        - ``valid``: whether all commands passed safety checks
        - ``commands``: the parsed command list
        - ``errors``: blocking issues (temperature limits, firmware commands)
        - ``warnings``: non-blocking advisories (Z below bed, high feedrate)
        - ``blocked_commands``: specific commands that were blocked

        Use this to preview what ``send_gcode`` would accept or reject.
        

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": "validate_gcode"
  }
}

Input Schema

NameRequiredDescriptionDefault
commandsYesOne or more G-code commands: a newline-separated string, or a list of command strings.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.5.1
    • addedInput schema / properties / commands / description
      Added value: +"One or more G-code commands: a newline-separated string, or a list of command strings."
  2. Changed2 schema fields changedv1.5.0
    • addedInput schema / properties / commands / anyOf
      Added value: +[
      +  {
      +    "type": "string"
      +  },
      +  {
      +    "items": {
      +      "type": "string"
      +    },
      +    "type": "array"
      +  }
      +]
    • removedInput schema / properties / commands / type
      Removed value: -"string"
  3. First observedv0.1.0

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true and destructiveHint=false, so the safety profile is covered. The description adds meaningful context beyond that: it is generic (no printer-specific limits), and it explains what errors, warnings, and blocked_commands represent, plus its relationship to send_gcode. It stops short of stating rate limits or exact blocking rules, so not a 5.

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 purpose and the sibling alternative, then structured Args/Returns sections. The Args block largely duplicates the schema, which is mild waste, but the Returns enumeration earns its place since there is no output schema.

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 fully documents the return object (valid, commands, errors, warnings, blocked_commands), and it covers the single parameter and the sibling relationship. Nothing an agent needs to call it correctly is missing.

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 Args block restates the schema's commands description almost verbatim (newline-separated string or list of strings). It adds no syntax or format detail beyond the schema, so the baseline 3 applies.

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 ('Validate G-code syntax and basic safety') and immediately scopes it as generic with no printer-specific limits, then names the sibling validate_gcode_safe as the printer-specific alternative. An agent can distinguish it from validate_gcode_safe without opening either schema.

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_safe with a printer_id for printer-specific safety (PTFE temp caps, speed limits), and use this tool to preview what send_gcode would accept or reject. Both the when-to-use and the alternative are named with the selecting condition.

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