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
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| document | No |