Execute C# Code
revit_execute_codeRun C# code on the Revit thread to automate live Revit models, with dry-run rollback and controlled transactions.
Instructions
Run a C# body or public static Script.Execute(ScriptContext ctx) on the Revit thread. revit_api_lookup supplies API metadata. Auto owns a Transaction; group lets scripts own Transactions and edit scopes inside one Undo group. Close all scopes before returning; transaction="none" is refused. Needs confirm_token except dry_run, which rolls back. May commit; revit_jobs polls; retry repeats.
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": "revit_execute_code"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| dry_run | No | ||
| document | No | Title or file name substring of the target open document; needed when several are open. | |
| transaction | No | auto | |
| confirm_token | No | ||
| timeout_seconds | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||