Skip to main content
Glama

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

NameRequiredDescriptionDefault

No arguments

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.6.1

TDQS

A4.8/5.0
Behavior5/5

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

With no annotations present, the description carries the full burden and does so: it discloses the failure modes it exists to catch (pcb_ tools silently resolving a different open document, DelphiScript unit caching masking a deployed fix, in-memory edits absent from disk), states the call is cheap and derived from existing reads so it cannot disagree with the tools it summarises, and defines the empty-warnings and next_step semantics.

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?

Front-loaded with the imperative and the one-line purpose, then a scannable bulleted list of the four facts, followed by the exclusion and return shape. Slightly verbose in places ("Each has cost a session on its own, and each was individually available and individually unasked for"), but nearly every sentence carries actionable information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Although an output schema exists and would excuse omitting return values, the description still sketches the response fields and explains how to read warnings and next_step. Combined with the explicit non-coverage caveat, an agent has everything needed to decide to call it and to interpret the result.

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?

The tool takes zero parameters, so there is no parameter semantics to document — the baseline for a no-arg tool applies. The description correctly spends no words on inputs and instead invests in output interpretation.

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?

States a specific verb and resource — a single-call situational read — and enumerates exactly the four facts it returns (focused document and kind, script/disk version match, unsaved edits, bridge health). It also explicitly bounds scope against nearby capabilities ("composes existing reads rather than adding a bridge call"), so an agent can tell it apart from app_get_status or app_get_active_document.

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?

"Run this before anything else" is an unambiguous when-to-use directive, and the closing section names an explicit exclusion with a concrete alternative: library component state is not covered, so use lib_set_current_component instead of assuming. Both the positive and negative routing conditions are spelled out.

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

Deploy Server

Other Tools