Skip to main content
Glama

Lint GLua Static Code

lint_glua
Read-onlyIdempotent

Detect syntax errors, realm violations, global pollution, and missing AddCSLuaFile calls in Garry's Mod Lua code with read-only static analysis.

Instructions

Perform deep static analysis and AST validation on Garry's Mod Lua (GLua) source code to detect syntax errors, realm boundary violations (server/client/menu mismatches), global namespace pollution, and missing AddCSLuaFile calls. Purely read-only static analysis requiring zero credentials or network access. Does NOT execute code and does NOT modify files on disk; when fix_formatting is true, the formatted code is returned strictly inside the result envelope without overwriting the source file. Provide either file_path (workspace-relative or absolute) or code_content (raw Lua snippet); when both are supplied, file_path takes precedence. If target_realm is 'auto', automatically detects the execution realm from file path prefixes (sv_, cl_, sh_) or defaults to 'shared'. Use this tool before committing code or running tests to ensure syntax and realm hygiene. Do NOT use for runtime performance profiling (use analyze_performance instead to detect GC allocations in render hooks), network vulnerability scanning (use audit_net_security instead), or functional test execution (use run_glua_test instead). Returns a GModToolResult envelope containing status ('success' or 'failed'), summary, data with valid (boolean), error_count, warning_count, realm_detected, diagnostics list (line, column, severity, rule code, message, suggestion), and optional formatted_code.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathNoWorkspace-relative or absolute path to .lua file to lint. Takes precedence over code_content when both are provided.
code_contentNoDirect GLua source code string to analyze statically. Used when file_path is omitted.
target_realmNoTarget execution realm context for static analysis ('server', 'client', 'shared', 'menu', or 'auto'). 'auto' infers realm from filename conventions (sv_, cl_, sh_) or defaults to 'shared'.auto
fix_formattingNoWhen true, runs glualint auto-fixer and returns formatted_code in the result data without mutating or overwriting the file on disk (default is false).

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataYesDomain-specific typed payload returned by the tool.
statusYesExecution status of the tool call ('success', 'partial', 'blocked', or 'failed').
summaryYesConcise, human-readable summary of operational findings, diagnostics, or execution outcome.
evidenceYesTraceability evidence including cited documentation and generated artifacts.
warningsYesList of non-fatal warnings, lint advisories, engine caveats, or security notices.
nextActionsNoActionable, ordered recommendations for the agent's immediate next steps.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changed
    • changedInput schema / properties / code_content / description
      Previous value: -"Direct Lua code string to analyze (if file_path omitted)"New value: +"Direct GLua source code string to analyze statically. Used when file_path is omitted."
    • changedInput schema / properties / file_path / description
      Previous value: -"Workspace-relative or absolute path to .lua file"New value: +"Workspace-relative or absolute path to .lua file to lint. Takes precedence over code_content when both are provided."
    • changedInput schema / properties / fix_formatting / description
      Previous value: -"Auto-fix code if possible"New value: +"When true, runs glualint auto-fixer and returns formatted_code in the result data without mutating or overwriting the file on disk (default is false)."
    • changedInput schema / properties / target_realm / description
      Previous value: -"Target realm context"New value: +"Target execution realm context for static analysis ('server', 'client', 'shared', 'menu', or 'auto'). 'auto' infers realm from filename conventions (sv_, cl_, sh_) or defaults to 'shared'."
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "properties": {
      +    "data": {
      +      "description": "Domain-specific typed payload returned by the tool.",
      +      "properties": {
      +        "diagnostics": {
      +          "description": "Detailed list of static analysis findings with line coordinates and remediation suggestions.",
      +          "items": {
      +            "properties": {
      +              "code": {
      +                "description": "Diagnostic rule identifier (e.g. 'GLUALINT', 'REALM_MISMATCH', 'GLOBAL_POLLUTION').",
      +                "type": "string"
      +              },
      +              "column": {
      +                "description": "1-based column number.",
      +                "type": "integer"
      +              },
      +              "line": {
      +                "description": "1-based line number.",
      +                "type": "integer"
      +              },
      +              "message": {
      +                "description": "Explanation of the syntax or realm violation.",
      +                "type": "string"
      +              },
      +              "severity": {
      +                "description": "Issue severity level.",
      +                "enum": [
      +                  "error",
      +                  "warning",
      +                  "info"
      +                ],
      +                "type": "string"
      +              },
      +              "suggestion": {
      +                "description": "Recommended remediation or code replacement.",
      +                "type": "string"
      +              }
      +            },
      +            "required": [
      +              "line",
      +              "column",
      +              "severity",
      +              "code",
      +              "message"
      +            ],
      +            "type": "object"
      +          },
      +          "type": "array"
      +        },
      +        "error_count": {
      +          "description": "Total count of fatal syntax, parsing, and realm boundary errors.",
      +          "type": "integer"
      +        },
      +        "formatted_code": {
      +          "description": "Pretty-printed code if fix_formatting was enabled (the original file on disk is never modified).",
      +          "type": "string"
      +        },
      +        "realm_detected": {
      +          "description": "Effective execution realm evaluated.",
      +          "enum": [
      +            "server",
      +            "client",
      +            "shared",
      +            "menu"
      +          ],
      +          "type": "string"
      +        },
      +        "valid": {
      +          "description": "True if code passed static analysis with zero errors.",
      +          "type": "boolean"
      +        },
      +        "warning_count": {
      +          "description": "Total count of style, global pollution, and non-fatal hygiene warnings.",
      +          "type": "integer"
      +        }
      +      },
      +      "required": [
      +        "valid",
      +        "error_count",
      +        "warning_count",
      +        "realm_detected",
      +        "diagnostics"
      +      ],
      +      "type": "object"
      +    },
      +    "evidence": {
      +      "description": "Traceability evidence including cited documentation and generated artifacts.",
      +      "properties": {
      +        "artifacts": {
      +          "description": "Files, packages, or manifests generated on disk or in memory.",
      +          "items": {
      +            "properties": {
      +              "label": {
      +                "description": "Descriptive label of the generated artifact.",
      +                "type": "string"
      +              },
      +              "sha256": {
      +                "description": "SHA-256 hash of the generated file.",
      +                "type": "string"
      +              },
      +              "uri": {
      +                "description": "File path or URI of the generated artifact.",
      +                "type": "string"
      +              }
      +            },
      +            "required": [
      +              "label",
      +              "uri"
      +            ],
      +            "type": "object"
      +          },
      +          "type": "array"
      +        },
      +        "inputsDigest": {
      +          "description": "SHA-256 digest of normalized tool inputs for auditability.",
      +          "type": "string"
      +        },
      +        "sources": {
      +          "description": "Cited documentation, wiki pages, or external web sources supporting the result.",
      +          "items": {
      +            "properties": {
      +              "label": {
      +                "description": "Display name or title of the cited resource.",
      +                "type": "string"
      +              },
      +              "retrievedAt": {
      +                "description": "ISO-8601 timestamp of source retrieval.",
      +                "type": "string"
      +              },
      +              "uri": {
      +                "description": "Canonical URI or URL of the documentation or source.",
      +                "type": "string"
      +              }
      +            },
      +            "required": [
      +              "label"
      +            ],
      +            "type": "object"
      +          },
      +          "type": "array"
      +        }
      +      },
      +      "required": [
      +        "sources",
      +        "artifacts"
      +      ],
      +      "type": "object"
      +    },
      +    "nextActions": {
      +      "description": "Actionable, ordered recommendations for the agent's immediate next steps.",
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    },
      +    "status": {
      +      "description": "Execution status of the tool call ('success', 'partial', 'blocked', or 'failed').",
      +      "enum": [
      +        "success",
      +        "partial",
      +        "blocked",
      +        "failed"
      +      ],
      +      "type": "string"
      +    },
      +    "summary": {
      +      "description": "Concise, human-readable summary of operational findings, diagnostics, or execution outcome.",
      +      "type": "string"
      +    },
      +    "warnings": {
      +      "description": "List of non-fatal warnings, lint advisories, engine caveats, or security notices.",
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    }
      +  },
      +  "required": [
      +    "status",
      +    "summary",
      +    "data",
      +    "warnings",
      +    "evidence"
      +  ],
      +  "type": "object"
      +}
  2. First observedv1.0.0

TDQS

A4.6/5.0
Behavior5/5

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

The description goes well beyond the annotations by stating that the tool requires zero credentials or network access, does not execute code, and does not modify files on disk. It also discloses the non-obvious behavior of fix_formatting: formatted code is returned inside the result envelope rather than overwriting the source. These statements are consistent with readOnlyHint=true, idempotentHint=true, and destructiveHint=false, adding valuable safety context.

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?

The description is well-structured and front-loaded: purpose first, safety guarantees second, input semantics third, usage guidance fourth, and output format last. It is lengthy but each sentence carries meaningful information, with only minor redundancy around 'read-only', 'does not execute code', and 'does not modify files'. The explicit exclusions and output envelope enumeration earn their place.

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?

Given the annotations, 100% schema coverage, and an output schema, the description covers all essential decision factors: what the tool does, what it detects, its side-effect-free behavior, input selection rules, realm detection behavior, exclusions, and result envelope contents. No critical context is missing for an agent to invoke this tool safely and 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?

The input schema already achieves 100% parameter description coverage, including file_path precedence over code_content, the target_realm enum with auto-detection semantics, and fix_formatting's non-mutating behavior. The description largely restates these schema details rather than adding substantial new parameter-level meaning. This aligns with the baseline of 3 for high schema coverage.

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?

The description opens with a specific verb and resource: 'Perform deep static analysis and AST validation on Garry's Mod Lua (GLua) source code'. It enumerates concrete detections (syntax errors, realm boundary violations, global namespace pollution, missing AddCSLuaFile calls) and explicitly distinguishes itself from sibling tools by naming what it does not do. This leaves no ambiguity about the tool's role versus run_glua_test, analyze_performance, or audit_net_security.

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?

The description gives explicit when-to-use guidance ('before committing code or running tests') and explicit when-not-to-use guidance with named alternatives: analyze_performance for runtime profiling, audit_net_security for network vulnerability scanning, and run_glua_test for functional test execution. These exclusions map directly to sibling tool names and make the selection decision nearly foolproof.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.