Skip to main content
Glama

Run Python Script

run_script
Destructive

Execute custom Python in FreeCAD's worker with App, Part, and ObjectsFem in scope. Set result to return JSON-serializable data; new shape objects auto-register for immediate use by other tools.

Instructions

Escape hatch: execute Python in the worker with App/Part/ObjectsFem in scope.

Set __result__ in the script to return a JSON-serializable value.

auto_register (default True): any new shape-bearing object the script creates is automatically registered into the handle table. The result includes a registered list of {handle, name, type} entries so the next tool call (render_view, list_faces, fillet_edges, mass_properties, etc.) can address script-created objects via handle without a separate register_handle round-trip.

Disabled unless ANKUSDRIVE_ALLOW_RUN_SCRIPT permits it (the Claude Desktop extension defaults it off); when disabled this tool is not registered at all.

Returns {result, registered}.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes
auto_registerNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already signal destructiveness, but the description adds substantial behavioral context: arbitrary Python execution, the __result__ return contract, automatic registration of created objects into the handle table, the security gate, and the exact return shape. This goes well beyond what the structured hints provide.

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?

The description is well-structured and front-loaded with the 'Escape hatch' characterization. It is packed with useful details, though the final 'Returns {result, registered}' is slightly redundant with the earlier registered-list explanation.

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 powerful tool with no output schema and no parameter descriptions, this is nearly complete: it covers the execution environment, the required __result__ convention, auto_register behavior, the environment variable gate, and the exact return structure. An agent has enough information to call it correctly.

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 description coverage is 0%, so the description must compensate. It explains auto_register's default and side effects in detail, and it defines the code contract through the __result__ requirement. The code parameter is described somewhat implicitly, but the script-execution framing makes its meaning clear.

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 the core behavior with a specific verb and object: execute Python in the worker, and names the in-scope resources (App/Part/ObjectsFem). It also differentiates itself from siblings like register_handle by explaining that auto_register removes the need for a separate registration round-trip.

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?

The 'Escape hatch' label and the auto_register discussion give clear context for when this tool is useful, and it explicitly contrasts with register_handle. It also documents the environment-gating condition (ANKUSDRIVE_ALLOW_RUN_SCRIPT), though it does not explicitly enumerate when not to use the tool.

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

Deploy Server

Other Tools