Write a temporary Lua file
lua_file_writeWrites 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
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name relative to the lua/mcpagent_tmp/ directory (e.g. 'scan.lua', 'lib/util.lua'). | |
| content | Yes | File content. | |
| instance | No | Optional. 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
| Name | Required | Description | Default |
|---|---|---|---|
| next | No | ||
| note | No | ||
| path | Yes | ||
| bytes | Yes | ||
| warning | No | ||
| exec_path | No | ||
| next_call | No | ||
| answered_by | No | ||
| truncated_note | No | ||
| version_warning | No |