Skip to main content
Glama

execute_python_script

Execute Python scripts within 3ds Max to automate modeling, material setup, lighting adjustments, and animation tasks directly from external applications.

Instructions

在 3ds Max 中执行一段 Python 脚本并返回执行结果。

该工具允许你发送任意 Python 代码到 3ds Max 中执行。 脚本在 3ds Max 的 Python 环境中运行,可以访问 pymxs、MaxPlus 等模块。

使用说明:

  • 脚本中可以通过 import pymxs; rt = pymxs.runtime 来访问 MAXScript 运行时。

  • 脚本中可以使用 print() 输出调试信息(会打印到 3ds Max 控制台)。

  • 如果需要返回结果,请将结果赋值给 _mcp_max_results 变量(字典或可 JSON 序列化的对象)。

  • 如果脚本没有设置 _mcp_max_results,则返回 {"success": True, "message": "脚本已执行完成"}

示例脚本 - 获取场景中所有对象的名称: import pymxs rt = pymxs.runtime names = [str(obj.name) for obj in rt.objects] _mcp_max_results = {"success": True, "object_names": names, "count": len(names)}

示例脚本 - 创建一个球体: import pymxs rt = pymxs.runtime sphere = rt.Sphere(radius=30, pos=rt.Point3(0, 0, 0)) sphere.name = "MCP_Sphere" _mcp_max_results = {"success": True, "name": str(sphere.name), "radius": 30}

Args: script: 要在 3ds Max 中执行的 Python 脚本代码字符串。

Returns: dict: 包含执行结果的字典。 - success (bool): 脚本是否执行成功。 - 其他字段取决于脚本中 _mcp_max_results 的内容。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scriptYes
Behavior5/5

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

With no annotations provided, the description carries full burden and delivers comprehensive behavioral details: it explains the execution environment (3ds Max's Python environment), how to return results (via `_mcp_max_results` variable), default return behavior when no results are set, and includes practical examples showing both read and write operations (getting object names vs creating a sphere).

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?

The description is well-structured and front-loaded with purpose, followed by usage instructions, examples, and parameter/return documentation. Every section adds value: the examples are particularly helpful for understanding script structure, and the Args/Returns sections clarify input/output expectations without redundancy.

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 a complex execution tool with no annotations, 0% schema coverage, and no output schema, the description provides complete context: it explains the execution environment, return mechanism, debugging approach, includes practical examples, and documents both input and output expectations. The sibling tool context (execute_maxscript) is appropriately addressed through the Python-specific focus.

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

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage for the single parameter 'script', the description fully compensates by explaining the parameter's purpose ('要在 3ds Max 中执行的 Python 脚本代码字符串' - Python script code string to execute in 3ds Max), providing syntax guidance, and showing two detailed examples that demonstrate proper script structure and content.

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?

The description clearly states the tool's purpose: '在 3ds Max 中执行一段 Python 脚本并返回执行结果' (execute a Python script in 3ds Max and return the execution result). It specifies the verb '执行' (execute) and resource 'Python 脚本' (Python script), and distinguishes from sibling tools like 'execute_maxscript' by focusing on Python rather than MAXScript.

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 description provides explicit usage guidelines under '使用说明' (usage instructions), including how to access MAXScript runtime, use print() for debugging, and return results via `_mcp_max_results`. It also distinguishes from 'execute_maxscript' by specifying Python execution environment with access to pymxs and MaxPlus modules.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/317431629/3dsMaxMCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server