Repository navigation
Conversation
close_document posts the Close command. On a modified document Revit then shows TaskDialog_Save_File, which nothing answers from an API call: it blocks the UI thread and every later MCP call times out. When the document has unsaved changes, attach a one-shot DialogBoxShowing handler that answers that prompt with No, then detaches. It only matches TaskDialog_Save_File and gives up after 60 s, so prompts from closes the user starts are left alone. The response now reports discarded changes. With save=True, a failed save now returns an error and leaves the document open, instead of closing and discarding the work. Tested on Revit 2027 with a sample model: modified close, unmodified close, and a later user-style close still shows the prompt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jmcouffin
approved these changes
Oct 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
close_documentcloses the active document by posting theClosecommand. If the document has unsaved changes, Revit then shows the "Save File" prompt (TaskDialog_Save_File). Nothing answers it from an API call, so it blocks Revit's UI thread. Every later MCP call that needs the API context times out until someone clicks the dialog by hand. This happens even withsave=False, which is meant to discard changes.Fix
close_documentattaches a one-shotDialogBoxShowinghandler before postingClose. It answers onlyTaskDialog_Save_File, with No, and then detaches.PostCommandfails, the handler is removed straight away.discarded_changes).save=True, a failed save now returns a 500 and leaves the document open. Before, it logged a warning and closed anyway, which discarded the work.Workshared-close prompts (sync / relinquish) are deliberately not handled.
Testing
Revit 2027.3, Snowdon Towers HVAC sample:
save=False🤖 Generated with Claude Code