Skip to main content
Glama

run_lua

Destructive

Execute arbitrary Lua code in Civilization VI to query or modify game state, using gamecore for read-only access or ingame for full API commands.

Instructions

Run arbitrary Lua code in the game. Advanced escape hatch — prefer built-in tools.

Args:
    code: Lua code to execute. Use print() for output, end with print("---END---").
    context: "gamecore" (default) for read-only state queries.
             "ingame" for commands and UI-dependent queries.

Context differences:
  gamecore: Players[], GameInfo.*, Map.*, Game.* — safe read-only access.
            CANNOT use: UI.*, UnitManager.*, CityManager.*, notifications.
  ingame:   All APIs including UI.*, UnitManager.*, CityManager.*.
            Use for: moving units, setting research, diplomacy actions.

Always use print() for output (not return).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes
contextNogamecore

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

Annotations provide destructiveHint=true, and the description adds critical behavioral details: code execution model (print for output, '---END---' marker), context-specific API restrictions, and that it's an escape hatch implying risk. No contradiction with annotations.

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 with a clear purpose, args list, and context differences. It is slightly verbose (e.g., 'Context differences:' section could be more concise), but every sentence adds value. Could be tightened slightly without losing meaning.

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 tool's complexity (arbitrary Lua execution), the description covers all essential aspects: output mechanism, context selection, API restrictions, and the escape hatch nature. Output schema (present) documents return values, so description need not repeat that.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema has 0% description coverage, but the description fully compensates by explaining the 'code' parameter (Lua code, use print, end marker) and 'context' parameter (two values with detailed differences). This adds essential meaning beyond the raw schema.

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?

Description clearly states 'Run arbitrary Lua code in the game' and labels it as an 'advanced escape hatch' for when built-in tools are insufficient. This uniquely distinguishes it from all sibling tools like 'end_turn' or 'unit_action', which are specific game actions.

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 instructs to 'prefer built-in tools' and details when to use 'gamecore' vs 'ingame' context, including which APIs are available in each. This provides clear when-to-use and when-not-to-use guidance.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/lmwilki/civ6-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server