Skip to main content
Glama
computercraft-mcp
by slashracer5

cc_exec

Runs Lua code on a ComputerCraft computer and returns printed output, return values, and errors; variables persist between calls until reset, enabling iterative in-game scripting and debugging.

Instructions

Run Lua on the computer and return its output, return values and any error.

code may be an expression (os.getComputerID()) or statements. Variables persist between calls until reset=True. Syntax errors, runtime errors (with traceback), printed text and printError lines all come back. A script that never yields is aborted by CC after ~7 s.

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": "cc_exec"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYes
resetNo
timeoutNo
computerNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.7/5.0
Behavior4/5

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

Annotations already declare a non-read-only, open-world, non-destructive operation, and the description adds genuinely new behavior: variable state persists across calls, reset clears it, errors return with tracebacks, and a non-yielding script is killed after ~7 s. The remaining gap is that the relationship between the ~7 s script abort and the 30 s `timeout` parameter is left ambiguous, and no security/permission expectations for arbitrary code execution are stated.

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 action and return shape, then statefulness, then error behavior, then the abort caveat — each sentence adds information with no filler. Slightly dense in a single paragraph, but nothing is redundant.

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?

The description goes beyond a typical exec tool by covering state persistence, error surfacing and the abort window, and an output schema exists so return values need no further explanation. It is only incomplete in not defining `timeout` and `computer`, which matter for a tool that may target multiple machines.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must carry parameter meaning; it does explain `code` (expression vs statements, with an example) and effectively explains `reset`. It says nothing about `timeout` or `computer`, leaving half the parameters undocumented anywhere.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description gives a specific verb+resource: 'Run Lua on the computer' and explicitly names the return payload (output, return values, errors). It does not differentiate from siblings such as cc_shell or cc_batch, which also execute code remotely, so an agent must infer the split itself.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It clarifies usage mechanics — `code` can be an expression or statements, and state carries over between calls until reset=True — which tells the agent how to drive it. However, it never states when to pick this over cc_shell/cc_batch, nor any precondition about the target computer.

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