MCP server for Qt application introspection and automation
qt-commander defines 7 tools with complete input schemas and detailed descriptions. Naming follows verb_noun convention (qt_list_*, qt_attach, qt_detach, qt_build, qt_snapshot). Descriptions are comprehensive (200-800 chars), exceeding the 10-1024 baseline, with explicit prerequisites and error codes documented. However, output schemas are not formally documented, responses are JSON strings without declared field types. Error handling includes numeric codes (2001, 2002, 2006) but lacks actionable recovery guidance in most cases. Parameters have types and descriptions, but some lack constraints (e.g., build_type accepts 'Debug' or 'Release' but no enum). Tool composition is sound: each tool has one responsibility, and outputs include IDs for chaining (session_id, pid). Security: no credentials exposed as parameters. Main gaps: no output schema documentation, missing enum constraints, and error messages could be more prescriptive.
Inject the helper library into a running Qt process and open a session. Find the target pid with qt_list_processes first (only Qt processes are listed, each with its qt_version/arch/bitness). The build artifacts in .qt-commander/bin must match the target process: same Qt major (qt_major used in qt_build), same toolchain (msvc/mingw), same Debug/Release build type, same 64/32-bit — a mismatch makes injection fail with code 2002. A process that is already attached fails with 2006; detach first. If the build has not been completed, this returns error code 2001 with the steps to follow (qt_detect_msvc_and_qt → AskUserQuestion → qt_build → qt_attach again); it does not build automatically. Injection modifies the target process (loads a DLL, starts a local RPC thread/listener). If the target process exits, the session goes dead: operations then fail with connection/timeout errors — check qt_list_sessions and re-attach.
Build the Qt injection library and injector for the specified environment. ``toolchain`` selects the compiler: ``"msvc"`` (default; ``vcvars_path`` is a vcvars bat, ``qt_env`` a qtenv2.bat) or ``"mingw"`` (``vcvars_path`` is the MinGW bin dir; ``qt_env`` the kit's qtenv2.bat — MinGW Qt kits ship one too; the Qt-bundled Ninja is used automatically). Before calling this tool, the AI MUST present available build environments (from ``qt_detect_msvc_and_qt``) to the user and let them choose. Do NOT guess or auto-pick paths — the user decides which VS or MinGW toolchain and which Qt installation to use. The AI MUST also ask the user whether to enable QML/QQuick support (``with_qml``). QML support is required for inspecting QML/Qt Quick applications but adds build dependencies. The AI MUST also ask the user to choose the ``build_type`` (Debug or Release). The build type must match the target process — a Debug process requires a Debug build, a Release process requires Release. ``qt_major`` (default 5) must match the target application's Qt major version — read it from qt_list_processes' ``qt_version`` field or from the qt_detect_msvc_and_qt result; a Qt6 target built with qt_major=5 fails to inject. ``vcvars_args`` — extra args for the VS vcvars batch (e.g. "-arch x64"). ``generator`` — CMake generator override; omit to auto-select. Before rebuilding, detach any session that still holds the old DLL (qt_detach with purge=True) or the build fails on a locked file.
Output schemas not formally documented. Tools return JSON strings (via _dumps) but no schema definition for response fields. LLMs cannot plan downstream calls or extract nested data reliably.
Enum constraints missing for constrained parameters. build_type accepts 'Debug' or 'Release', detail accepts 'core'/'extended'/'full', toolchain accepts 'msvc'/'mingw', but no enum declarations in schema. LLMs may hallucinate invalid values.
Error messages lack actionable recovery guidance. Error codes (2001, 2002, 2006) are returned but descriptions are terse. E.g., 'Build required' does not tell the LLM the exact sequence of tools to call.
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-23 | C | 61 | 2026-07-28+ | v2 |
Disconnect from a Qt process session. ``purge=True`` (default False) also **ejects the injected DLL from the target process** and **deletes the session's saved files** (snapshots, screenshots, session metadata) — irreversible. Use purge=True before rebuilding the library: otherwise the DLL file stays locked by the target process and qt_build fails. With purge=False the DLL stays loaded in the target until that process exits.
Detect MSVC (Visual Studio), MinGW toolchains, and Qt installations available for building. IMPORTANT — this tool only *discovers* and *displays* what is found on this machine. It does NOT select an environment automatically. After calling this tool, the AI MUST use ``AskUserQuestion`` to present the found installations to the user and let them choose which compiler and Qt to use with ``qt_build``. For an MSVC Qt kit (``kit == "msvc"``) pass the VS ``vcvars_path`` + the kit's ``qtenv_path`` with ``toolchain="msvc"``; for a MinGW kit (``kit == "mingw"``) pass a MinGW toolchain's bin dir (from ``mingw_toolchains``) + the kit's ``qtenv_path`` (MinGW kits ship qtenv2.bat too) with ``toolchain="mingw"``. If detection finds nothing (or misses an installation the user knows about), the user can type the paths manually. Returns three lists: ``vs_installations``, ``mingw_toolchains``, and ``qt_installations``.
List running Qt processes that may be attachable.
List all active sessions.
Capture the UI element tree of the session's windows. The tree is NOT in this result — it is written to the file exposed at the returned ``uri``, an absolute ``file://`` path to the written snapshot file (e.g. ``file:///path/.qt-commander/sessions/<sid>/ snapshots/snapshot_N.json``); read that file to inspect the tree. The result carries only session_id / snapshot_id / uri. Node fields: className, objID, objectName, qml_id (QML ``id`` from the QML source, omitted when empty), rect (window-local logical px), global_rect (screen coords), z_order, visible/enabled/opacity/color_alpha/clip, text, topLevelId, windowTitle, properties (per ``detail``). ``detail`` — property tier per node: "core" (first-class fields only, no properties), "extended" (DEFAULT; common interaction-state properties like text/checked/value), "full" (every Q_PROPERTY; slow on large UIs). ``include_hidden`` (default False) — hidden elements are pruned together with their whole subtree (hidden tabs, unopened dialogs). Set True to include them; note hidden elements are still rejected by
qt_snapshot description is truncated in source (ends mid-sentence at 'rejected by'). Full description not visible; cannot assess completeness.
No pagination support documented. qt_list_processes and qt_list_sessions return all results without limit or cursor. Large process/session lists could exhaust context window.