Skip to main content
Glama
ahelja

FreeCAD MCP

by ahelja

run_python

Execute Python code within FreeCAD to extend capabilities, automate workflows, and directly manipulate documents. Returns output, errors, and return values.

Instructions

Execute Python inside FreeCAD. The escape hatch for anything the typed tools cannot do.

Preloaded names: App/FreeCAD, Gui/FreeCADGui, and doc (the active document). Globals persist between calls, so you can build state incrementally. A trailing expression is returned like a REPL; in statement mode, assign to result to return a value. The document is recomputed afterwards.

Returns stdout, stderr, the value, and a full traceback on failure.

Example -- a sketch-based pad: body = doc.addObject("PartDesign::Body", "Body") sketch = body.newObject("Sketcher::SketchObject", "Sketch") import Part sketch.addGeometry(Part.Circle(App.Vector(0,0,0), App.Vector(0,0,1), 10), False) pad = body.newObject("PartDesign::Pad", "Pad") pad.Profile = sketch pad.Length = 25 result = pad.Name

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes
documentNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior5/5

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

With no annotations, the description fully carries the transparency burden. It discloses preloaded names, global state persistence, REPL-like expression evaluation, the need to assign to `result` in statement mode, document recomputation, and return value structure including traceback on failure.

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 the core purpose. Every sentence adds value, the example is directly useful, and there is no redundant filler. It earns its length.

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?

For such a powerful and open-ended tool, the description covers execution semantics, state persistence, return values, and recomputation. The main gaps are the undocumented `document` parameter and lack of safety caveats for arbitrary code execution, but overall it is highly complete.

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?

The description thoroughly explains the primary `code` parameter through REPL semantics, the `result` variable, and a detailed example. However, the optional `document` parameter is never mentioned, and with 0% schema coverage this leaves a notable gap in understanding its purpose.

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 'Execute Python inside FreeCAD,' giving a specific verb, resource, and action. It further distinguishes itself as 'the escape hatch for anything the typed tools cannot do,' clearly separating it from sibling typed tools.

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?

It states that this tool is the escape hatch for anything the typed tools cannot do, implying it should be used when typed tools are insufficient. While it doesn't explicitly say 'use typed tools first,' the context is clear enough for an agent to decide.

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/ahelja/FreeCAD-MCP'

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