Write a project Lua file
cmo_write_scriptWrites a Lua script into a cmo-lua project and adds or updates the matching event in cmo-project.json when needed, keeping all file paths inside the project directory.
Instructions
Write a .lua file inside a cmo-lua project and, if needed, add or update the matching event in cmo-project.json. Paths cannot leave the project directory.
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": {
"directory": "<directory>",
"file": "<file>",
"contents": "<contents>"
},
"name": "cmo_write_script"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file | Yes | Relative .lua path, for example scripts/setup.lua | |
| contents | Yes | Full Lua source | |
| directory | Yes | Project folder | |
| event_name | No | Event description. Required when this file is not already in the project. | |
| trigger_name | No | Trigger description. Defaults to the trigger type | |
| trigger_type | No | Trigger type used when creating a new event | ScenLoaded |