app_context
Check the live editor state before running any tool: focused document, script/disk match, unsaved changes, and bridge status. Run first to explain why a previous tool call failed or acted on the wrong document.
Instructions
Where you are, in one call. Run this before anything else.
THE FOUR FACTS THAT EXPLAIN MOST "WHY DIDN'T THAT WORK". Each has cost a session on its own, and each was individually available and individually unasked for:
Which document is focused, and what kind it is. Nearly every tool acts on the focused document. A pcb_ tool aimed while a library is focused does not always fail; it can resolve some other open document and report success for work you did not ask for.
Whether the running script matches the one on disk. DelphiScript caches compiled units, so a deployed fix does nothing until the script project is reopened. Symptom: a fix that "did not work".
What is unsaved. An edit that is real in memory and absent from disk reads as a tool that silently did nothing.
Whether the bridge is answering at all, as opposed to Altium being up.
This composes existing reads rather than adding a bridge call, so it is cheap and cannot disagree with the tools it summarises.
WHAT IT DOES NOT TELL YOU: which library component is current.
That is editor state with no read exposed, and the library
authoring tools depend on it. If a lib_add_* call lands somewhere
unexpected, set the target explicitly with
lib_set_current_component rather than assuming.
Returns:
{"backend": ..., "bridge_answering": bool, "script_version_match": bool, "active_document": {...}, "open_document_count": N, "unsaved": [paths], "warnings": [...], "next_step": ...}.
``warnings`` is empty when nothing needs attention.
``next_step`` is the single thing worth doing first, or empty.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||