Skip to main content
Glama

modo_run_python

Destructive

Run Python inside Modo to automate scene edits, inspect geometry, and execute commands; preloaded helpers and current scene access let you query or modify the active scene.

Instructions

Run Python inside Modo. 'lx', 'lxu', 'modo' and 'scene' (the current scene) are preloaded. The value of a trailing expression, or of a variable named RESULT, is returned. Runs on Modo's own Python (3.10 on Modo 17.1, 3.9 on Modo 16); code is checked against that version first. 'mcp' holds workarounds for Modo bugs: mcp.vmaps(item) lists vertex maps where geometry.vmaps fails on 17.1. Keep each call under about 50 s (timeout_ms is capped at 55000): the client gives up after about 60 s while Modo keeps working, so split long builds into steps and never re-run a call that timed out without checking the scene first. Prefer this over long chains of single commands. Code using a command known to crash Modo is refused until repeated with acknowledge_risk=true. Always fill 'purpose' with one plain sentence about the effect: the user reads it, not the code, when deciding whether to approve.

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": {
      "purpose": "<purpose>",
      "code": "<code>"
    },
    "name": "modo_run_python"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYes
purposeYesOne short sentence, in the language of the conversation, saying what this does -- for example 'Creates three cubes joined by a bar'. Shown to the user before they approve the call, and in Modo's event log, so describe the effect, not the code.
instanceNoThis chat's Modo instance token (modo-xxxxxx) from modo_use_instance or modo_launch_instance. Pass it on every call once you have one; leave empty only while a single chat works with Modo.
timeout_msNo
acknowledge_riskNo
rollback_on_errorNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.5.0

TDQS

A4.9/5.0
Behavior5/5

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

Annotations declare destructiveHint=true and readOnlyHint=false, and the description explains the risk mechanics that make those hints actionable: code using crash-prone commands is refused until re-sent with acknowledge_risk, code is version-checked against Modo's bundled Python, and a timeout means the client abandoned the call while the work continues. It also discloses that 'purpose' is shown to the user as an approval gate, which is behavior an agent would otherwise not know.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Dense but front-loaded: what runs, what is preloaded, what is returned, then hazards and timeouts, then the approval contract. Every sentence carries distinct operational information — no restatement of the name or of schema-visible fields.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For an arbitrary-code-execution tool this covers the essentials an agent needs to call it safely: environment, return convention, timeout ceiling, crash-refusal path, and the human approval workflow. An output schema exists, so the description is not obligated to describe return payloads, and the version/RESULT notes already cover the ambiguous part.

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?

With only 33% schema coverage the description must carry weight, and it does for the important ones: purpose's user-facing approval/log role, timeout_ms's 55000 cap and 50 s practical ceiling, and acknowledge_risk's retry-after-refusal semantics. It is silent on instance (the per-chat Modo token) and rollback_on_error, whose defaults an agent would have to infer from the schema titles alone.

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?

Opens with a concrete verb+resource ('Run Python inside Modo') and immediately scopes what that means: preloaded modules ('lx', 'lxu', 'modo', 'scene'), expression/RESULT return semantics, and which Python interpreter executes the code. It also distinguishes itself from chaining alternatives ('Prefer this over long chains of single commands'), which separates it from modo_run_command.

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

Usage Guidelines5/5

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

Explicit routing advice ('prefer this over long chains of single commands'), an explicit timing rule ('keep each call under about 50 s', timeout_ms capped at 55000), and a precise recovery instruction: never re-run a timed-out call without checking the scene, because Modo keeps working after the client gives up. It also names the escape hatch (acknowledge_risk=true) for crash-prone commands.

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