Skip to main content
Glama
fusion-cam

fusion-cam

execute_python

Run Python scripts inside Fusion to automate CAD/CAM workflows, inspect geometry, and create toolpaths using preloaded API objects and persistent variables.

Instructions

Run Python inside Fusion on its main thread.

Pre-bound (refreshed each call): app, ui, adsk, math, doc (active document), design, root (design.rootComponent), cam (CAM product or None), mm(v) mm->cm, deg(v) deg->rad. Variables persist between calls. Raw API lengths are CENTIMETERS. print() output is returned; a trailing bare expression is echoed like a REPL. Never close or save documents you did not create. Avoid long loops: the main thread is blocked while this runs.

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_python"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYes
timeout_sNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.2/5.0
Behavior5/5

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

With no annotations present, the description carries the full burden and does so well: it discloses that execution blocks Fusion's main thread, that variables persist between calls, that lengths are in centimeters, what names are pre-bound, how output is surfaced (print plus REPL-style echo of a trailing expression), and two explicit safety rules about documents and long loops. This is exactly the behavioral context an agent needs before running arbitrary code against a live CAD session.

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 text is dense but front-loaded, leading with what the tool is and the threading constraint, then layering pre-bound names, unit conventions, persistence, and safety rules. Every line supplies information the agent would otherwise have to discover by trial and error, so nothing feels padded.

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 and is complemented by the note that print output is returned and a trailing bare expression is echoed, so return behavior is well covered. The main remaining hole is the undocumented timeout_s parameter and the absence of any hint about when to reach for a dedicated sibling instead; otherwise the definition is complete for a high-risk arbitrary-code executor.

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

Parameters3/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 compensate, and it only partly does. It richly explains the execution environment the 'code' parameter runs in, but never mentions the 'timeout_s' parameter at all, despite warning that the main thread is blocked while the script runs, which is precisely when a timeout matters.

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 opens with a specific verb and resource, 'Run Python inside Fusion on its main thread', which is unambiguous and clearly distinct from the domain-specific siblings such as import_step, screenshot, and cam_post. The phrase 'on its main thread' also communicates the execution context that makes this tool unique.

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 routed: the agent must infer that this is the general-purpose escape hatch when a dedicated sibling tool does not exist, since no alternative is named or excluded. The description does supply real operational guardrails ('Never close or save documents you did not create', 'Avoid long loops'), but these are constraints on how to use it rather than guidance on when to prefer it.

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