Skip to main content
Glama

revit_execute_python

Run Python code inside Autodesk Revit on the UI thread to automate model tasks, query documents, and store results. Wrap modifications in a Transaction.

Instructions

Executes arbitrary Python code inside Autodesk Revit on the main UI thread.

Provides:

  • doc: Active Revit Document

  • uidoc: Active UIDocument

  • uiapp: UIApplication

  • app: Application

  • response_data: Dict to store return values (e.g. response_data['my_key'] = ...)

Always wrap model modifications in a Transaction: t = Transaction(doc, 'Action Name') t.Start() ... t.Commit()

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes
portNo
doc_nameNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.5/5.0
Behavior4/5

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

With no annotations, the description must carry behavioral disclosure. It states execution occurs on the main UI thread and provides a transaction pattern for modifications, which are important behavioral traits. However, it does not mention permissions, side effects, error handling, or threading implications beyond 'main UI thread'.

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?

Bulleted list of available variables is concise and front-loaded with behavior. The transaction example is helpful but slightly verbose; however, it earns its place by showing a critical pattern. Overall efficient.

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 a tool that executes arbitrary code, the description covers usage context (main thread) and a required pattern (Transaction) to prevent errors. It does not explain 'port' or 'doc_name' parameters, which is a gap, but with an output schema present, return values need not be described. Mostly complete but missing key parameter details.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so the description must compensate. It explains the injected variables (doc, uidoc, etc.) but does not describe the 'code' parameter (beyond implied), 'port', or 'doc_name'—the latter two have no explanation at all. The description only partially addresses parameter semantics, leaving significant gaps.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific action ('Executes arbitrary Python code inside Autodesk Revit on the main UI thread') and distinguishes itself from siblings like revit_list_instances or revit_get_selection, which are read-only. It doesn't explicitly compare, but the purpose is clear and unique.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides critical context (main UI thread) and a required pattern for model modifications (Transaction), but does not say when to prefer this tool over others or what limitations exist (e.g., security, allowed modules). Implied usage for advanced scenarios, but no explicit alternatives or exclusions.

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