Skip to main content
Glama

Run Lua in the live game

dos2_live_lua
Destructive

Runs arbitrary Lua code on a running Divinity: Original Sin 2 server via Script Extender, returning JSON-serializable results for custom GM tasks beyond dedicated live tools.

Instructions

Runs arbitrary Lua on the game server through Script Extender, in the bridge mod's context, and returns the value of its return statement. The Ext and Osi APIs are available. This is the escape hatch for anything the other live tools do not cover: items, statuses, combat, level changes.

It can change or break anything in the running session, so prefer the dedicated tools (dos2_live_characters,
dos2_live_spawn, dos2_live_move, dos2_live_set, dos2_live_stage) when they fit. The returned value must be
JSON-serializable. Lua errors come back as an error with the message; a call that outlives timeout fails. Needs
the bridge (see dos2_live_status). Do not call Osi functions while a level is still loading.

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": {
      "code": "<code>"
    },
    "name": "dos2_live_lua"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYesLua source to run. Use return to send a value back, e.g. return Osi.CharacterGetHostCharacter().
timeoutNoSeconds to wait for the game's answer (default 5).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.1.1
    • addedInput schema / properties / code / description
      Added value: +"Lua source to run. Use return to send a value back, e.g. return Osi.CharacterGetHostCharacter()."
    • addedInput schema / properties / timeout / description
      Added value: +"Seconds to wait for the game's answer (default 5)."
  2. First observedv0.1.0

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already declare destructiveHint=true, readOnlyHint=false and idempotentHint=false; the description adds real context beyond that — it can change or break anything in the session, the return value must be JSON-serializable, Lua errors surface as errors with the message, and a call exceeding timeout fails. The bridge prerequisite and the level-loading caveat are behaviors no annotation conveys.

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 the core action, then follows with caution, alternatives, and constraints in a sensible order. It is denser than most definitions but nearly every sentence carries a distinct operational fact; the sibling list is the only slight bulk.

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?

For an arbitrary-code-execution tool with no output schema, the description covers invocation context (which APIs, which bridge), failure modes (Lua errors, timeout), output constraints (JSON-serializable), and the unsafe-timing caveat. Nothing an agent needs to call it safely is missing.

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 description coverage is 100%, so the baseline is 3, but the description adds meaning the schema does not: the return-statement convention for sending values back, the JSON-serializability constraint on what code may return, and what happens when the timeout parameter is exceeded. The 'Ext and Osi APIs are available' note further clarifies what code may reference.

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 — runs arbitrary Lua on the game server via Script Extender, in the bridge mod's context — and explicitly frames itself as the escape hatch for what the other live tools do not cover. An agent can distinguish it from dos2_live_set or dos2_live_spawn 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 names the preferred alternatives (dos2_live_characters, dos2_live_spawn, dos2_live_move, dos2_live_set, dos2_live_stage) and the condition that selects them over this tool. It also gives a when-not: do not call Osi functions while a level is still loading, plus a prerequisite pointer to dos2_live_status.

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