Skip to main content
Glama
Lumitorus

FreeCAD MCP Next

by Lumitorus

execute_code_async

Run heavy Python computations asynchronously in FreeCAD, returning immediately. Use for background-safe CPU-bound tasks that do not touch the GUI or document tree.

Instructions

Execute Python code in FreeCAD without waiting for completion.

Use this ONLY for long-running background computations that do NOT touch the
FreeCAD GUI or mutate the FreeCAD document tree directly.

This tool runs the submitted code in a background thread and returns
immediately. Because it does not run on FreeCAD's main GUI thread, the code
must NOT call FreeCADGui APIs, manipulate the active view or selection, create
or edit document objects, change object properties, call doc.recompute(), or
save documents.

For code that touches FreeCAD documents, document objects, FreeCADGui, the
active view, selection, recompute, or save operations, use execute_code instead.
execute_code runs on the FreeCAD GUI thread and is the safe default for normal
FreeCAD automation.

Use execute_code_async only for background-safe work such as long-running
pure OCCT geometry calculations (e.g. fuse/cut/loft on already-fetched shapes)
or other CPU-bound computations that do not interact with the document or GUI.

Typical usage pattern:
1. Fetch shapes into local variables first (via execute_code on the GUI thread).
2. Store intermediate results in a module-level Python variable (not in the
   FreeCAD document) so execute_code can read them later.
3. Run the heavy computation via execute_code_async.
4. After the expected computation time has elapsed, apply results to the
   document via execute_code (which runs on the GUI thread).

Args:
    code: Background-safe Python code to execute.

Returns:
    A message confirming that background execution has started.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes
Behavior5/5

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

There are no annotations, so the description carries the full burden of behavioral disclosure. It clearly explains background-thread execution, immediate return, restrictions on FreeCADGui/document operations, and what the return message will be. This is far more transparent than a typical tool description.

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 long but well-structured with an opening one-line definition, followed by a focused restriction block and a numbered workflow. Some repetition between the restriction examples and the alternative-tool guidance is useful for safety-critical boundaries, though slightly more than strictly necessary.

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?

Despite having no output schema and no annotations, this description is unusually complete for a single-parameter background execution tool. It defines the async behavior, unsafe but also safe use cases, how to coordinate with execute_code, and what the return confirmation is. The agent has enough context to safely invoke and choose this tool.

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?

The schema has 0% description coverage, listing only 'code' as a string, while the description compensates fully by defining it as 'Background-safe Python code to execute' and explaining what kinds of code are allowed versus forbidden. Despite there being only one parameter, the description gives strong semantic guidance about what the code parameter may contain.

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: 'Execute Python code in FreeCAD without waiting for completion.' It clearly distinguishes this tool from the sibling execute_code by contrasting background versus GUI-thread execution, so an agent can tell them apart.

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 gives explicit when-to-use and when-not-to-use guidance: 'Use this ONLY for long-running background computations' and 'use execute_code instead' for anything touching the GUI/document. It also provides a numbered typical usage pattern, making the selection and invocation workflow highly actionable.

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/Lumitorus/freecad-mcp-next'

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