Skip to main content
Glama

Write a temporary Lua file

lua_file_write
Idempotent

Writes or overwrites Lua files in the game's lua/mcpagent_tmp/ folder, creating subfolders, so code can be run with lua_exec_file when direct disk access is unavailable.

Instructions

Writes (or overwrites) a file in the game's lua/mcpagent_tmp/ folder, creating subfolders. Useful when you do not share the game's disk; if you do, write there directly. Run it with lua_exec_file {path: name}; from game code it is include("mcpagent_tmp/"). Result: {path (absolute), bytes, exec_path}.

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": {
      "name": "<name>",
      "content": "<content>"
    },
    "name": "lua_file_write"
  }
}

Input Schema

NameRequiredDescriptionDefault
nameYesName relative to the lua/mcpagent_tmp/ directory (e.g. 'scan.lua', 'lib/util.lua').
contentYesFile content.
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
nextNo
noteNo
pathYes
bytesYes
warningNo
exec_pathNo
next_callNo
answered_byNo
truncated_noteNo
version_warningNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.7

TDQS

A4.3/5.0
Behavior4/5

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

Adds real behavior beyond the annotations: overwrite semantics, automatic subfolder creation, and the returned fields (path, bytes, exec_path). With idempotentHint/destructiveHint already declaring the safety profile, the useful addition is the overwrite disclosure. Missing limits such as content size, encoding, or failure modes when the disk is unavailable.

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 operation and scope, then usage, then execution, then return shape — a logical order with no filler. The 'Result: {path, bytes, exec_path}' sentence is somewhat redundant given an output schema exists, and the middle clauses are densely packed.

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 three-parameter write tool with full schema coverage, annotations, and an output schema, the description covers what an agent needs to call it and then use the result. The only gap is error behavior, which is minor given the structured fields already provided.

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 100%, so the baseline is 3, but the description goes further by showing how the relative `name` is consumed downstream ('lua_exec_file {path: name}' and include("mcpagent_tmp/<name>")), which clarifies the path semantics the schema only implies. It does not explain the `instance` relay parameter, though the schema already covers it.

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 (writes/overwrites) and a precisely scoped resource: a file under the fixed lua/mcpagent_tmp/ folder, with subfolder creation. It also disambiguates from lua_exec_file by explaining that writing does not execute and that running requires a separate call.

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 an explicit when-to-use condition ('useful when you do not share the game's disk') and a when-not ('if you do, write there directly'). It also names the follow-up call (lua_exec_file) and the in-game equivalent (include). No exclusion against lua_file_read/delete siblings, but those are self-evidently different operations.

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