Skip to main content
Glama
freecad-mcp-headless

freecad-mcp-headless

by pitbuild

execute_python

Run Python code inside a headless FreeCAD worker to access the open document and FreeCAD API, then return stdout and a result value for custom CAD automation tasks.

Instructions

Run Python inside the FreeCAD worker and return stdout plus result.

The document is available as doc, the FreeCAD module as FreeCAD (alias App). Assign to a variable named result to return data. This tool is the escape hatch for anything the other tools do not cover; it can be disabled on the server with --no-execute.

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
documentNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.8/5.0
Behavior3/5

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

With no annotations, the description carries the full burden, and it does disclose the execution environment (the FreeCAD worker), the pre-bound globals (``doc``, ``FreeCAD``/``App``), the ``result`` return convention, and that the tool may be disabled server-side. It does not disclose what happens to document state after arbitrary code runs, whether mutations persist or are reversible, or any timeout/resource limit — meaningful gaps for an unrestricted code-execution tool.

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?

Three short sentences, front-loaded with the action and return contract, followed by environment bindings and availability caveat. The ``--no-execute`` note slightly dilutes focus but carries real operational value, and there is no filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

There is no output schema, and the description does cover the return shape (stdout plus ``result``), which is the most important missing piece. For an arbitrary-code-execution tool with zero annotation coverage, though, it should also say how errors surface and whether the code can mutate the open document — details an agent would need before calling it.

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% with two parameters, so the description must compensate. It implies ``code`` is Python executed in the worker and that assigning ``result`` is how data is returned, and hints that a document is bound as ``doc``, but it never explicitly ties the ``document`` parameter to document selection or explains what happens when it is null.

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 a specific verb and resource: run Python inside the FreeCAD worker and return stdout plus ``result``. It also positions itself against the siblings by calling itself 'the escape hatch for anything the other tools do not cover', so an agent can tell it apart from the dedicated domain tools without inspecting schemas.

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?

Gives clear usage context: use it only for work the other tools do not cover, which implicitly routes the agent to the dedicated tools first, and notes the server may disable it with ``--no-execute``. It stops short of an explicit when-not list or naming which specific sibling to prefer for a given task.

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