Skip to main content
Glama

Replace a Lua action inside a scenario

cmo_write_action_script
DestructiveIdempotent

Replace the Lua script text for one matched event action in a Command scenario and write a new .scen file; the original stays unchanged unless output_path points to it.

Instructions

Replace the ScriptText of one Lua event action and write a new .scen file. The original file is left unchanged unless output_path is that same file.

The action is matched by its description, which cmo_read_scenario lists. Load the new file in Command to try it. This rewrites the compressed scenario body, so open the result in Command before you delete the original.

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>",
      "action": "<action>",
      "script": "<script>"
    },
    "name": "cmo_write_action_script"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYesExisting .scen file to read
actionYesDescription of the Lua action to replace
scriptYesNew Lua source for that action
output_pathNoWhere to write the new .scen. Defaults to the original name with .cmo-lua.scen beside it

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.5/5.0
Behavior5/5

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

Annotations already flag destructive=true and readOnly=false, and the description adds real context on top: the original file is left unchanged unless output_path points at it, the compressed scenario body is rewritten, and the agent should open the result in Command before deleting the original. This explains exactly what is destroyed and how to recover, which the annotations alone do not.

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?

Two tight paragraphs, front-loaded with the core operation and followed by the safety guidance. The two mentions of loading the result in Command ('try it' and 'before you delete the original') are slightly repetitive, but they serve distinct purposes — testing versus verifying before deletion.

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 destructive, no-output-schema mutation tool, the description covers what changes, where output goes, how the target is identified, and how to verify. It does not state what the tool returns (e.g., the written path or a summary), which is the only notable gap given there is no output schema.

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 adds meaning beyond the schema by explaining how `action` is matched (by description, enumerable via cmo_read_scenario) and by reinforcing the output_path default location. The `script` parameter's semantics are left entirely to the schema, which is fine.

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: 'Replace the ScriptText of one Lua event action and write a new .scen file.' The scope (one action, one file) is explicit and the fact that it writes a new file rather than mutating in place distinguishes it from sibling writers like cmo_write_script.

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 a concrete prerequisite: the action is matched by its description, 'which cmo_read_scenario lists,' routing the agent to the right sibling for discovery. It also tells the agent to load the result in Command to verify. It stops short of an explicit use-this-instead-of-cmo_write_script exclusion, but the context is clear.

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