Skip to main content
Glama

execute_maya_code

Run arbitrary Python code inside a running Maya session with maya.cmds pre-imported to query scenes and modify objects. Inspect printed or expression results, with tracebacks returned on errors.

Instructions

Execute arbitrary Python code inside Maya. cmds (maya.cmds) is pre-imported. Returns printed output, and the value of the last line if it is an expression (like the Script Editor). On errors, returns the traceback with line numbers.

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

Input Schema

NameRequiredDescriptionDefault
codeYes

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4/5.0
Behavior3/5

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

With no annotations, the description carries the full burden. It usefully discloses the execution environment (cmds pre-imported), that stdout is captured, that a trailing expression's value is returned, and that errors come back as tracebacks with line numbers — genuinely valuable. It says nothing, however, about side effects on the open scene, absence of sandboxing/timeouts, or whether state persists between calls, which matter greatly for arbitrary code execution.

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?

Three short sentences, zero filler, with the core action front-loaded before the return-value and error details. Nothing repeats or pads.

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?

An output schema exists, yet the description still clarifies the return semantics helpfully, and the single required parameter is covered. The remaining gap is risk framing — mutation of the live scene, blocking behavior, or failure modes beyond tracebacks — which an agent needs for a high-blast-radius code execution tool.

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?

Only one parameter and 0% schema description coverage, so the description has to compensate — and it does, explaining what the code string runs against (maya.cmds pre-imported) and how its output/last expression is interpreted. That is meaningful context the bare 'code: string' schema does not provide.

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?

Names a specific verb and resource ('Execute arbitrary Python code inside Maya') and immediately establishes the execution environment. It is clearly distinguished from every sibling, which are structured single-purpose scene operations.

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?

Usage is implied rather than stated: an agent can infer this is the escape hatch for things the structured tools can't do, but the description never says so, nor does it warn to prefer dedicated tools like set_transform or get_attribute when they suffice.

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