Skip to main content
Glama

Run Lua tests

tests_run
Destructive

Runs GLuaTest files in a chosen realm and returns structured pass/fail results, so you can validate Lua code without leaving the game.

Instructions

Runs test files in GLuaTest format in one realm and returns structured results. A file returns {groupName, beforeAll, beforeEach, afterEach, afterAll, cases = {{name, func, skip?, when?, timeout?}}}; inside, expect(x).to.equal(y) / .notTo / .beTrue / .beNil / .exist / .beA(type) / .beValid / .beGreaterThan / .beLessThan / .beBetween / .aboutEqual(x, tol) / .haveLength / .contain / .err / .errWith(msg) / .succeed. Steps share a state table (their first argument). path: a file or a pattern in the file name (*.lua, or **/.lua for subfolders), relative to lua/mcpagent_tmp/ or absolute. Result: {files: [{file, group, cases: [{name, status: pass|fail|error|skip, message?, line?, traceback?, duration_ms}], error?, setup_error?}], totals {pass, fail, error, skip}, ok}. The whole run is one call on the main thread (the game is frozen meanwhile): for multi-frame tests use lua_job. Full format: resource mcpagent://tests-format. Example: {"realm": "server", "path": "tests/.lua"}.

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": {
      "path": "<path>"
    },
    "name": "tests_run"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYesFile or pattern, relative to lua/mcpagent_tmp/ or absolute.
realmNoDefault server.
budgetNoTime limit per step (load, beforeAll, each case...) in seconds (default 10).
instanceNoOptional. Instance identifier (see instances_list). If present and different from the local instance, the call is relayed by the coordinator to that instance.

Output Schema

NameRequiredDescriptionDefault
okYes
nextNo
noteNo
filesYes
totalsYes
warningNo
next_callNo
answered_byNo
truncated_noteNo
version_warningNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.7

TDQS

A4/5.0
Behavior4/5

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

Adds non-obvious behavior beyond the annotations: the run happens on the main thread and freezes the game meanwhile, each step is subject to a time budget, and a resource is provided for the full format. It does not say whether test execution mutates persistent realm state, which is the main remaining ambiguity given destructiveHint=true.

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

Conciseness3/5

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

Front-loaded purpose and constraints are good, but the long inline catalogue of expect matchers and the step 'state' table description is authoring guidance, not run guidance, and duplicates what the cited mcpagent://tests-format resource covers. The result-shape recitation is also redundant with the output schema.

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 four-parameter tool with full schema coverage and an output schema, the description covers the important gaps: realm scope, main-thread freeze, per-step budget semantics, path pattern syntax, and the lua_job alternative. Only the mutability/persistence question around destructiveHint is left unaddressed.

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%, so baseline is 3. The description does add the glob syntax ('*.lua', '**/*.lua' for subfolders) and the resolution base directory plus a concrete example call, which goes slightly beyond the schema but largely restates parameter documentation.

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+resource+scope: 'Runs test files in GLuaTest format in one realm and returns structured results.' The 'one realm' constraint and 'structured results' are stated up front, so an agent can distinguish this from lua_exec/lua_check without consulting the schema.

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

Usage Guidelines4/5

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

Gives one explicit routing rule: 'for multi-frame tests use lua_job', plus the constraint that the entire run is a single main-thread call. It stops short of stating when NOT to use it (e.g., for ad-hoc code execution use lua_exec), so it is clear but not fully exhaustive on alternatives.

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