Skip to main content
Glama
LBurny
by LBurny

execute_code_async

Destructive

Run background-safe Python code in FreeCAD on a background thread, returning a task_id so you can poll for results without blocking the GUI.

Instructions

Run Python on a background thread and return a task_id; poll the result with get_task_result.

The code must not touch the GUI: no FreeCADGui, views or selection, document objects, recompute or save; use execute_code for those. Output goes through task_print(...); print() is not captured.

Args:
    code: Background-safe Python code.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.4.0

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already declare destructive/openWorld/non-idempotent, and the description adds non-obvious behavior: async threading, output only via task_print, print() silently not captured, and a hard GUI prohibition list. It does not discuss concurrent execution or failure states of the task, but the added runtime semantics are substantial.

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?

Front-loaded with the core action and return value, then constraints ranked by importance (GUI prohibition, output channel), with the arg note last. Every sentence carries actionable information and none is redundant with the schema.

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?

An output schema exists so return values need no explanation, and the description covers execution mode, constraints, result retrieval, and the output channel. What remains thin is failure/error behavior and how a returned task_id should be treated if the thread dies, but the essentials are present.

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 coverage is 0% (the lone 'code' property has only a title), so the description carries the burden and does add meaning: the code must be 'Background-safe Python' with no GUI, document, recompute, or save calls, and must use task_print for output. That is meaningful constraint beyond the bare parameter name, though no format/length expectations are given.

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?

Specific verb + resource with the execution model named: 'Run Python on a background thread and return a task_id'. It also draws a boundary against the sibling execute_code, so an agent can distinguish the two without opening schemas.

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?

Explicit when-to-use routing: use execute_code when GUI/document interaction is needed, and poll this task's result with get_task_result. Both the alternative and the follow-up condition are named, leaving nothing to inference.

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