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
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |