pyqt-runtime-mcp
v1.0.0MCP server and in-app bridge for inspecting and controlling PyQt5/PyQt6 applications
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
qt_get_application_info
Return Qt/PyQt version, platform, active window, and top-level windows of the running app.
qt_list_windows
List every top-level QWidget/QMainWindow/QDialog with geometry and visibility.
qt_get_ui_snapshot
Compact UI overview: focused widget, visible/interactive widgets, and layout warnings.
| Parameter | Type | Description |
|---|---|---|
window_id |
qt_resize_window
Resize a top-level window (exits maximized/fullscreen first). Use for responsive layout tests.
| Parameter | Type | Description |
|---|---|---|
height * | integer | |
width * | integer | |
window_id |
qt_move_window
Move a top-level window to the given screen coordinates.
| Parameter | Type | Description |
|---|---|---|
x * | integer | |
y * | integer | |
window_id |
qt_activate_window
Raise and activate a top-level window.
| Parameter | Type | Description |
|---|---|---|
window_id |
qt_close_window
Close one window and verify it went away. Dialogs are rejected so a modal exec_() loop unwinds. The reply reports closed=false when the window refused; force=true then hides and deletes it. confirm must be true to prevent accidental application shutdown.
| Parameter | Type | Description |
|---|---|---|
confirm * | boolean | |
force | boolean | |
window_id |
qt_close_windows
Close several windows at once and report which ones actually closed. With no filter it closes every visible top-level window except the main window, which is the way to clean up detached views, popups, and leftover dialogs after a test run. Narrow it with windows (ids or objectNames), class_name, or title_contains. Set include_main=true to shut the app's main window as well, force=true to delete windows that refuse to close. confirm must be true.
| Parameter | Type | Description |
|---|---|---|
confirm * | boolean | |
class_name | ||
force | boolean | |
include_main | boolean | |
title_contains | ||
windows |
qt_get_widget_tree
Return a hierarchical JSON tree of QWidget descendants. Diagnostic fallback for understanding hierarchy and layout relationships. The in-app bridge already maintains a live searchable widget index, so normal workflows should start with qt_find_widgets and then use names/IDs directly. Optional: visible_only=true, or root=<panel> to shrink the payload.
| Parameter | Type | Description |
|---|---|---|
include_geometry | boolean | |
include_properties | boolean | |
max_depth | integer | |
root | ||
visible_only | boolean |
qt_find_widgets
Find widgets by objectName, class, text, accessible fields, or window title. Filters combine with AND. Preferred starting point for locating controls; no full-tree call is required. The bridge searches its automatically maintained live index. window restricts the search to one window's subtree (needed when objectNames are duplicated across detached views).
| Parameter | Type | Description |
|---|---|---|
accessible_description | ||
accessible_name | ||
class_name | ||
compact | boolean | |
limit | integer | |
object_name | ||
root | ||
text_contains | ||
window | ||
window_title |
qt_get_widget
Compact widget identity/state. Pass compact=false for detailed text, value, tabs, and geometry.
| Parameter | Type | Description |
|---|---|---|
compact | boolean | |
locator | ||
widget_id | ||
window |
qt_get_layout
Inspect the QLayout on a widget: class, margins, spacing, stretches, grid positions.
| Parameter | Type | Description |
|---|---|---|
locator | ||
widget_id | ||
window |
qt_get_geometry
Local/global/frame geometry, contents rect, size hints, min/max, and size policy.
| Parameter | Type | Description |
|---|---|---|
locator | ||
widget_id | ||
window |
qt_locate
Resolve a semantic locator against the live widget index without retrieving the full tree. Locator fields: runtime_id/widget_id, object_name, class_name, text, text_contains, accessible_name, path, window/root, visible, enabled, nth.
| Parameter | Type | Description |
|---|---|---|
locator * | object | |
compact | boolean | |
limit | integer | |
window |
qt_wait_for
Wait for widget state: exists/destroyed/visible/hidden/enabled/disabled/focused/text/property.
| Parameter | Type | Description |
|---|---|---|
locator | ||
poll_ms | integer | |
property | ||
state | string | |
text | ||
text_contains | ||
timeout_ms | integer | |
value | ||
widget_id | ||
window |
qt_perform
Perform one typed allowlisted operation using a semantic locator or widget id. Actions include click, type_text, key_press, semantic setters, widget/property inspection, model operations, QAction triggering, menus, and wait_for. Put action-specific fields in arguments.
| Parameter | Type | Description |
|---|---|---|
action * | string | |
arguments | ||
locator | ||
widget_id | ||
window |
qt_batch
Execute up to 50 allowlisted qt_perform steps in one round trip.
| Parameter | Type | Description |
|---|---|---|
steps * | array | |
compact | boolean | |
stop_on_error | boolean |
qt_get_ui_changes
Return compact widget additions, removals, renames, visibility, enabled, and parent changes.
| Parameter | Type | Description |
|---|---|---|
since_revision * | integer | |
limit | integer |
qt_use_effect
Run a learned opener using its cached possible effects. New outcomes are recorded and reported without dismissal. dismiss: reject, accept, or ok_button; omitted means observe only. Combine with follow_route in qt_batch to navigate, click, and dismiss in one round trip.
| Parameter | Type | Description |
|---|---|---|
name * | string | |
dismiss | ||
timeout_ms | integer |
qt_catalog_scan
Index unique stable interactive destinations, including hidden ones, without clicking or dumping a tree. Reports unnamed/ambiguous targets. Does not infer routes or claim functional coverage.
| Parameter | Type | Description |
|---|---|---|
include_names | boolean | |
window |
qt_catalog_get
Read this app's temp catalog. kind: routes/effects/destinations. Named reads return the recipe.
| Parameter | Type | Description |
|---|---|---|
compact | boolean | |
kind | string | |
name |
qt_catalog_put
Save a stable recipe. Route: steps, arrival conditions, optional fingerprint and arrival_hash. Each step: action, locator with window scope, action arguments, optional before/after/skip_if conditions. Each condition: locator, state (default actionable), optional timeout_ms. Actions: click, trigger_action, open_menu, set_current_page (page locator/title), select_model_item (item_text resolved live), wait_for. No runtime IDs, widget ancestry, or model rows. repair_from replaces only a route suffix. Saving is not verification; qt_goto verifies arri…
| Parameter | Type | Description |
|---|---|---|
entry * | object | |
name * | string | |
kind | string | |
repair_from |
qt_path_check
Check currently existing waypoints without executing. Missing lazy widgets are unresolved_now, not proof of a broken route.
| Parameter | Type | Description |
|---|---|---|
route * | object |
qt_goto
Follow a saved or inline route incrementally; verify arrival. Never automatically retry failed actions. Use qt_batch with follow_route then click (expected_popup for modal dismissal) for one round trip. Window scopes may be strings or descriptors: object_name/class_name/title/title_contains.
| Parameter | Type | Description |
|---|---|---|
name | ||
route | ||
timeout_ms | integer |
qt_screen_fingerprint
Hash visible interactive descriptors under a root/window, excluding geometry and live edit/label values.
| Parameter | Type | Description |
|---|---|---|
include_names | boolean | |
locator | ||
window |
qt_learn_effect
Explicitly execute a click/QAction opener and append its observed popup outcome to the app catalog. expected_popup: class_name/title/title_contains/kind, dismiss=reject|accept|ok_button, timeout_ms (1..10000), allow_none. Omit dismiss to observe without closing. Unknown or ambiguous popups are reported. Timeout is an observation, not QA success.
| Parameter | Type | Description |
|---|---|---|
opener * | object | |
expected_popup | ||
name |
qt_capture_window
Capture a top-level window as PNG. Returns path/size plus image content for the MCP client. Prefer qt_capture_widget / qt_capture_region / qt_capture_sections for focused checks; use full-window capture when overall composition matters.
| Parameter | Type | Description |
|---|---|---|
include_frame | boolean | |
output_path | ||
window_id |
qt_capture_widget
Capture a single QWidget (panel, page, control) as PNG.
| Parameter | Type | Description |
|---|---|---|
widget_id * | string | |
output_path | ||
window |
qt_capture_region
Capture a rectangle in widget-local coordinates (default base: active/top window). Use this when you need a crop of a window or panel — e.g. status bar, footer rail, or a map corner — without grabbing the entire widget tree. Coordinates are relative to `widget_id` / `window_id` (or the active window if omitted).
| Parameter | Type | Description |
|---|---|---|
height * | integer | |
width * | integer | |
x * | integer | |
y * | integer | |
label | ||
output_path | ||
widget_id | ||
window | ||
window_id |
qt_capture_screen_region
Capture a rectangle of the primary screen. Coordinates are in screen pixels.
| Parameter | Type | Description |
|---|---|---|
height * | integer | |
width * | integer | |
x * | integer | |
y * | integer | |
output_path |
qt_capture_sections
Capture multiple labeled UI sections for focused visual QA. Each section object may include: - `label` (recommended): short name agents use when referring to the crop - `widget_id`: capture that widget; optional `x/y/width/height` crops it further - `x`, `y`, `width`, `height`: crop relative to `widget_id` / window / active window - `window`: scope objectName lookup when names are duplicated across windows - `output_path`: optional PNG path inside the screenshot sandbox Example: status bar + emergency rail + a map region in one call so…
| Parameter | Type | Description |
|---|---|---|
sections * | array | |
window | ||
window_id |
qt_visual_snapshot
Full-window screenshot plus compact widget metadata (geometry for pixel correlation). Heavier than a targeted crop. Prefer after orientation, or when you need one image + widget map; for routine checks use qt_capture_widget / qt_capture_region / qt_capture_sections.
| Parameter | Type | Description |
|---|---|---|
output_path | ||
window_id |
qt_click
Click a widget via Qt mouse events (center if x/y omitted). semantic=true uses QAbstractButton.click(). Every interaction tool takes window=<window id or objectName>, which scopes the lookup when an objectName repeats across windows (detached views do this).
| Parameter | Type | Description |
|---|---|---|
button | string | |
expected_popup | ||
locator | ||
semantic | boolean | |
strict | boolean | |
widget_id | ||
window | ||
x | ||
y |
qt_double_click
Double-click a widget via Qt mouse events.
| Parameter | Type | Description |
|---|---|---|
button | string | |
locator | ||
widget_id | ||
window | ||
x | ||
y |
qt_move_mouse
Move the pointer over a widget (center if x/y omitted) and send a mouse-move event.
| Parameter | Type | Description |
|---|---|---|
locator | ||
widget_id | ||
window | ||
x | ||
y |
qt_set_focus
Give keyboard focus to a widget.
| Parameter | Type | Description |
|---|---|---|
locator | ||
widget_id | ||
window |
qt_type_text
Type text by synthesizing key events. Does not call setText. Targets widget_id or the focused widget.
| Parameter | Type | Description |
|---|---|---|
text * | string | |
locator | ||
widget_id | ||
window |
qt_key_press
Press a key or combo (Enter, Escape, Tab, Ctrl+A, F1-F12, arrows). Optional widget_id, else focused widget.
| Parameter | Type | Description |
|---|---|---|
key * | string | |
locator | ||
modifiers | ||
widget_id | ||
window |
qt_set_text
Semantically set text on QLineEdit, QTextEdit, QPlainTextEdit, or QLabel.
| Parameter | Type | Description |
|---|---|---|
text * | string | |
locator | ||
widget_id | ||
window |
qt_set_value
Set numeric value on QSpinBox, QDoubleSpinBox, QSlider, or QProgressBar.
| Parameter | Type | Description |
|---|---|---|
value * | number | |
locator | ||
widget_id | ||
window |
qt_set_checked
Set checked state on QCheckBox, QRadioButton, or a checkable QPushButton.
| Parameter | Type | Description |
|---|---|---|
checked * | boolean | |
locator | ||
widget_id | ||
window |
qt_select_combobox
Select a QComboBox item by index or by item text.
| Parameter | Type | Description |
|---|---|---|
index | ||
locator | ||
text | ||
widget_id | ||
window |
qt_set_current_page
Switch QStackedWidget page by index, or QTabWidget tab by index or title.
| Parameter | Type | Description |
|---|---|---|
index | ||
locator | ||
title | ||
widget_id | ||
window |
qt_query_model
Read a bounded page from a list/table/tree view model, including custom models.
| Parameter | Type | Description |
|---|---|---|
column_limit | integer | |
column_start | integer | |
locator | ||
parent_path | ||
roles | ||
row_limit | integer | |
row_start | integer | |
widget_id | ||
window |
qt_select_model_item
Select/activate a model item. item_text resolves a unique live display label without caching row indexes.
| Parameter | Type | Description |
|---|---|---|
activate | boolean | |
column | integer | |
item_text | ||
locator | ||
mode | string | |
parent_path | ||
row | ||
selection | string | |
widget_id | ||
window |
qt_expand_model_item
Expand or collapse a QTreeView model index.
| Parameter | Type | Description |
|---|---|---|
row * | integer | |
column | integer | |
expanded | boolean | |
locator | ||
parent_path | ||
widget_id | ||
window |
qt_scroll_to_model_item
Scroll a list/table/tree view to a model index.
| Parameter | Type | Description |
|---|---|---|
row * | integer | |
column | integer | |
locator | ||
parent_path | ||
position | string | |
widget_id | ||
window |
qt_set_model_item
Edit a model index through setData using an allowlisted Qt item-data role.
| Parameter | Type | Description |
|---|---|---|
row * | integer | |
value * | ||
column | integer | |
locator | ||
parent_path | ||
role | string | |
widget_id | ||
window |
qt_list_actions
List or filter QAction objects, including menu and toolbar actions.
| Parameter | Type | Description |
|---|---|---|
limit | integer | |
locator | ||
object_name | ||
shortcut | ||
text_contains | ||
window |
qt_trigger_action
Trigger one QAction by runtime id or semantic action locator.
| Parameter | Type | Description |
|---|---|---|
action_id | ||
force | boolean | |
locator | ||
window |
qt_get_stylesheet
Return widget stylesheet, inherited parent sheets, and QApplication stylesheet. Omitting widget_id returns app sheet only.
| Parameter | Type | Description |
|---|---|---|
widget_id | ||
window |
qt_set_stylesheet
Apply a runtime stylesheet. Does NOT modify source files. Omit widget_id to set the application sheet.
| Parameter | Type | Description |
|---|---|---|
stylesheet * | string | |
widget_id |
qt_list_properties
List readable Qt meta-object properties (QMetaProperty). Not Python attributes.
| Parameter | Type | Description |
|---|---|---|
widget_id * | string | |
include_values | boolean |
qt_get_property
Read one Qt meta-object property.
| Parameter | Type | Description |
|---|---|---|
name * | string | |
widget_id * | string |
qt_set_property
Write a writable Qt meta-object property. Rejects unknown or read-only properties.
| Parameter | Type | Description |
|---|---|---|
name * | string | |
value * | ||
widget_id * | string |
qt_analyze_layout
Heuristic layout diagnostics: overflow, overlap, zero-size, min/max conflicts, missing layouts, and widgets rendered smaller than their minimumSizeHint.
| Parameter | Type | Description |
|---|---|---|
widget_id | ||
window |
qt_show_debug_overlay
Draw a removable outline overlay on widgets. Does not permanently change the application UI.
| Parameter | Type | Description |
|---|---|---|
show_class | boolean | |
show_geometry | boolean | |
show_id | boolean | |
show_name | boolean | |
widget_ids | ||
window_id |
qt_hide_debug_overlay
Remove the debug overlay.
qt_list_signals
List Qt meta-object signals for a widget.
| Parameter | Type | Description |
|---|---|---|
widget_id * | string |
qt_watch_signal
Watch an allowlisted signal (clicked, toggled, textChanged, valueChanged, ...). Events go to a bounded buffer.
| Parameter | Type | Description |
|---|---|---|
signal * | string | |
widget_id * | string | |
enable | boolean |
qt_get_event_log
Recent MCP interaction events and watched-signal firings (bounded).
| Parameter | Type | Description |
|---|---|---|
contains | ||
limit | integer |
qt_get_logs
Runtime log records from a bounded ring buffer. Covers Qt messages captured via qInstallMessageHandler and the application's own stdlib `logging` records. Each entry carries source="qt" or "python"; pass source to read only one of them, level to filter by severity.
| Parameter | Type | Description |
|---|---|---|
contains | ||
level | ||
limit | integer | |
source |
qt_get_exceptions
Recent unhandled Python exceptions in the GUI process (chained onto existing hooks).
| Parameter | Type | Description |
|---|---|---|
contains | ||
limit | integer |