Skip to main content
Glama

exec_python

Run Python code in a live Nuke session as one undoable step, with Nuke modules imported and a persistent namespace; returns expression results plus stdout/stderr.

Instructions

Run Python inside the live Nuke session as ONE undo step. nuke and nukescripts are imported; the namespace persists between calls. The value of a trailing expression (or a result variable) is returned, along with captured stdout/stderr. Prefer the dedicated tools when one fits.

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

Input Schema

NameRequiredDescriptionDefault
codeYes
reset_namespaceNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.1/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does substantial work: it discloses the execution context (live session), the undo grouping, pre-imported modules, namespace persistence across calls, and the return channel (trailing expression or `result`, plus captured stdout/stderr). What it omits is the risk profile of arbitrary code in an open document — that mutations are possible and that a failed script may still leave the session changed.

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?

Four short sentences, front-loaded with the execution context and undo semantics before the return contract and the routing hint. No filler, and the highest-value constraint (single undo step) appears first.

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?

No output schema exists, and the description compensates by explaining what is returned and that stdout/stderr are captured. The remaining gap is the undocumented `reset_namespace` parameter and the absence of any error-behavior note for a tool that executes arbitrary code.

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

Parameters2/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 explain both parameters. It never mentions `reset_namespace` by name, only implying it via 'the namespace persists between calls', and gives no guidance on what `code` should contain or how errors surface. An agent reading the schema alone sees an unexplained boolean.

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 ('Run Python inside the live Nuke session') plus a defining constraint ('as ONE undo step'), which is far more than the name exec_python conveys. The closing sentence distinguishes it from the dedicated tools that make up the sibling catalog.

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?

'Prefer the dedicated tools when one fits' gives a clear selection rule: reach for this only when no purpose-built sibling covers the task. It stops short of naming which siblings those are or giving an example case, so the agent must still map its task to the catalog itself.

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