Skip to main content
Glama

max_python

Runs Python code inside 3ds Max for computation, string processing, data shaping, and MaxPlus-only APIs, returning a JSON-serializable result; use it for logic, not scene edits.

Instructions

Execute Python inside Max (2.7 + MaxPlus) -- a second engine, chosen explicitly.

WHEN TO USE THIS (measured on real Max 2016, see tests/bench_*):

  • pure computation, string building, dict/list work: Python is 7-100x faster than MAXScript (100k loop 6 ms vs 55 ms; 5k string concat <1 ms vs 177 ms)

  • scene access is the opposite: creating 200 boxes MAXScript 30 ms vs MaxPlus ~260 ms; walking 200 nodes MAXScript 1 ms vs ~2 ms. So: never drive the scene from here. Use it for logic, parsing, data shaping, or MaxPlus-only APIs, then hand the result back.

The script runs with result as the value that gets returned: result = [n.GetName() for n in ...] Set result on the last line; anything JSON-serializable works.

CAVEATS on Max 2016: Python is 2.7 and the object API is MaxPlus, which Autodesk removed in 2017 (replaced by pymxs). Code written against MaxPlus will not survive a Max upgrade, unlike MAXScript.

Args: code: Python source. Assign to result for the return value. timeout_seconds: how long to wait before giving up.

Input Schema

NameRequiredDescriptionDefault
codeYes
timeout_secondsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.5

TDQS

A4.6/5.0
Behavior4/5

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

With no annotations at all, the description carries the full disclosure burden and does most of it: it names the Python version, the MaxPlus object API, the fact that Autodesk removed MaxPlus in 2017 so code won't survive an upgrade, the timeout behavior, and the `result` return convention. The main remaining gap is that it says nothing about the execution sandbox, error propagation, or what a timeout returns.

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?

Well front-loaded and sectioned (purpose, when-to-use, result contract, caveats, args), and the benchmark numbers are load-bearing because they justify the routing decision. It runs long, though, and the parenthetical timings could be trimmed without losing the conclusion.

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?

There is no output schema, so the description must explain return values, and it does via the `result` convention plus 'anything JSON-serializable works'. Combined with the upgrade caveat and the performance routing for a two-parameter code-execution tool, an agent has everything needed to call it correctly and interpret the response.

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?

Schema coverage is 0%, so the description must compensate, and it does for the critical parameter: it explains that `code` must assign to `result` and that anything JSON-serializable works, which is semantics the schema does not convey. `timeout_seconds` is only glossed as 'how long to wait before giving up' without stating the default or the effect on long scripts, leaving one parameter partly under-explained.

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 runtime ('Execute Python inside Max (2.7 + MaxPlus)') and explicitly frames itself as 'a second engine, chosen explicitly', which separates it from the MAXScript-based sibling max_eval. An agent can identify the tool's role without opening the schema.

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?

The 'WHEN TO USE THIS' block gives measured criteria for each side of the decision: pure computation/string/dict work goes here, scene traversal and object creation go to MAXScript, reinforced by the blunt instruction 'never drive the scene from here'. It also carves out the MaxPlus-only API case, so the positive and negative conditions are both explicit.

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