Skip to main content
Glama

run_lua

Execute Lua in Tabletop Simulator's global script context to manipulate game objects and return results as JSON-compatible values. Use return statements; userdata must be returned as fields.

Instructions

Execute Lua in the TTSim Global script context and return the result.

Use return to get a value back. Tables arrive as JSON objects/arrays; numbers, strings, booleans and nil (null) work too. TTSim objects (userdata) cannot be returned directly: return their fields instead, e.g. local o = getObjectFromGUID("abc123") return {name = o.getName(), pos = o.getPosition()}. Lua runtime and syntax errors come back as tool errors with the TTSim message. Changes made here are visible to the player immediately, so act deliberately.

Input Schema

NameRequiredDescriptionDefault
codeYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.2/5.0
Behavior4/5

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

With no annotations present, the description carries the full burden and does well: it discloses serialization behavior (tables as JSON, scalars pass through, userdata cannot be returned), the error channel (Lua runtime/syntax errors as tool errors with the TTSim message), and the critical side effect that changes are immediately visible to players. Gaps remain around permissions, execution limits/timeouts, and whether the environment is sandboxed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the core action in one sentence, then return-value rules, then error behavior, then the safety caution. The inline code example is compact and earns its place by demonstrating the userdata workaround, which would be hard to convey in prose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a one-parameter arbitrary-code-execution tool with no output schema and no annotations, the description covers return encoding, error propagation, and mutation visibility — the essentials. It leaves out execution constraints (timeouts, permissions, sandbox scope) that an agent calling arbitrary code would want to know.

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

Parameters4/5

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

Schema coverage is 0% for the single `code` parameter, so the description must compensate — and it does, explaining that the body must use `return` to produce a value, which types serialize, and giving a concrete getObjectFromGUID example with field extraction. It stops short of stating size limits or whether top-level awaits/wait patterns are permitted.

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 and resource — execute Lua in the TTSim Global script context — and names the outcome (return the result). This clearly distinguishes it from read-oriented siblings such as get_scripts, get_events, inspect_object, and list_objects.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives operational guidance (use `return`, how to convert userdata, errors surface as tool errors) and a caution to 'act deliberately' because changes are visible immediately. However, it never says when to prefer this over siblings like inspect_object or list_objects for simple reads, nor what to avoid running. Usage is implied rather than routed.

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