pyqt-runtime-mcp

v1.0.0
pyqt-runtime-mcp Checked 4 days ago Published 2 months ago

MCP 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.

ParameterTypeDescription
window_id

qt_resize_window

Resize a top-level window (exits maximized/fullscreen first). Use for responsive layout tests.

ParameterTypeDescription
height *integer
width *integer
window_id

qt_move_window

Move a top-level window to the given screen coordinates.

ParameterTypeDescription
x *integer
y *integer
window_id

qt_activate_window

Raise and activate a top-level window.

ParameterTypeDescription
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.

ParameterTypeDescription
confirm *boolean
forceboolean
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.

ParameterTypeDescription
confirm *boolean
class_name
forceboolean
include_mainboolean
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.

ParameterTypeDescription
include_geometryboolean
include_propertiesboolean
max_depthinteger
root
visible_onlyboolean

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).

ParameterTypeDescription
accessible_description
accessible_name
class_name
compactboolean
limitinteger
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.

ParameterTypeDescription
compactboolean
locator
widget_id
window

qt_get_layout

Inspect the QLayout on a widget: class, margins, spacing, stretches, grid positions.

ParameterTypeDescription
locator
widget_id
window

qt_get_geometry

Local/global/frame geometry, contents rect, size hints, min/max, and size policy.

ParameterTypeDescription
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.

ParameterTypeDescription
locator *object
compactboolean
limitinteger
window

qt_wait_for

Wait for widget state: exists/destroyed/visible/hidden/enabled/disabled/focused/text/property.

ParameterTypeDescription
locator
poll_msinteger
property
statestring
text
text_contains
timeout_msinteger
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.

ParameterTypeDescription
action *string
arguments
locator
widget_id
window

qt_batch

Execute up to 50 allowlisted qt_perform steps in one round trip.

ParameterTypeDescription
steps *array
compactboolean
stop_on_errorboolean

qt_get_ui_changes

Return compact widget additions, removals, renames, visibility, enabled, and parent changes.

ParameterTypeDescription
since_revision *integer
limitinteger

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.

ParameterTypeDescription
name *string
dismiss
timeout_msinteger

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.

ParameterTypeDescription
include_namesboolean
window

qt_catalog_get

Read this app's temp catalog. kind: routes/effects/destinations. Named reads return the recipe.

ParameterTypeDescription
compactboolean
kindstring
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…

ParameterTypeDescription
entry *object
name *string
kindstring
repair_from

qt_path_check

Check currently existing waypoints without executing. Missing lazy widgets are unresolved_now, not proof of a broken route.

ParameterTypeDescription
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.

ParameterTypeDescription
name
route
timeout_msinteger

qt_screen_fingerprint

Hash visible interactive descriptors under a root/window, excluding geometry and live edit/label values.

ParameterTypeDescription
include_namesboolean
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.

ParameterTypeDescription
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.

ParameterTypeDescription
include_frameboolean
output_path
window_id

qt_capture_widget

Capture a single QWidget (panel, page, control) as PNG.

ParameterTypeDescription
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).

ParameterTypeDescription
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.

ParameterTypeDescription
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…

ParameterTypeDescription
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.

ParameterTypeDescription
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).

ParameterTypeDescription
buttonstring
expected_popup
locator
semanticboolean
strictboolean
widget_id
window
x
y

qt_double_click

Double-click a widget via Qt mouse events.

ParameterTypeDescription
buttonstring
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.

ParameterTypeDescription
locator
widget_id
window
x
y

qt_set_focus

Give keyboard focus to a widget.

ParameterTypeDescription
locator
widget_id
window

qt_type_text

Type text by synthesizing key events. Does not call setText. Targets widget_id or the focused widget.

ParameterTypeDescription
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.

ParameterTypeDescription
key *string
locator
modifiers
widget_id
window

qt_set_text

Semantically set text on QLineEdit, QTextEdit, QPlainTextEdit, or QLabel.

ParameterTypeDescription
text *string
locator
widget_id
window

qt_set_value

Set numeric value on QSpinBox, QDoubleSpinBox, QSlider, or QProgressBar.

ParameterTypeDescription
value *number
locator
widget_id
window

qt_set_checked

Set checked state on QCheckBox, QRadioButton, or a checkable QPushButton.

ParameterTypeDescription
checked *boolean
locator
widget_id
window

qt_select_combobox

Select a QComboBox item by index or by item text.

ParameterTypeDescription
index
locator
text
widget_id
window

qt_set_current_page

Switch QStackedWidget page by index, or QTabWidget tab by index or title.

ParameterTypeDescription
index
locator
title
widget_id
window

qt_query_model

Read a bounded page from a list/table/tree view model, including custom models.

ParameterTypeDescription
column_limitinteger
column_startinteger
locator
parent_path
roles
row_limitinteger
row_startinteger
widget_id
window

qt_select_model_item

Select/activate a model item. item_text resolves a unique live display label without caching row indexes.

ParameterTypeDescription
activateboolean
columninteger
item_text
locator
modestring
parent_path
row
selectionstring
widget_id
window

qt_expand_model_item

Expand or collapse a QTreeView model index.

ParameterTypeDescription
row *integer
columninteger
expandedboolean
locator
parent_path
widget_id
window

qt_scroll_to_model_item

Scroll a list/table/tree view to a model index.

ParameterTypeDescription
row *integer
columninteger
locator
parent_path
positionstring
widget_id
window

qt_set_model_item

Edit a model index through setData using an allowlisted Qt item-data role.

ParameterTypeDescription
row *integer
value *
columninteger
locator
parent_path
rolestring
widget_id
window

qt_list_actions

List or filter QAction objects, including menu and toolbar actions.

ParameterTypeDescription
limitinteger
locator
object_name
shortcut
text_contains
window

qt_trigger_action

Trigger one QAction by runtime id or semantic action locator.

ParameterTypeDescription
action_id
forceboolean
locator
window

qt_open_menu

Open the QMenu attached to a QAction and return its child actions.

ParameterTypeDescription
action_id
locator
window

qt_get_stylesheet

Return widget stylesheet, inherited parent sheets, and QApplication stylesheet. Omitting widget_id returns app sheet only.

ParameterTypeDescription
widget_id
window

qt_set_stylesheet

Apply a runtime stylesheet. Does NOT modify source files. Omit widget_id to set the application sheet.

ParameterTypeDescription
stylesheet *string
widget_id

qt_list_properties

List readable Qt meta-object properties (QMetaProperty). Not Python attributes.

ParameterTypeDescription
widget_id *string
include_valuesboolean

qt_get_property

Read one Qt meta-object property.

ParameterTypeDescription
name *string
widget_id *string

qt_set_property

Write a writable Qt meta-object property. Rejects unknown or read-only properties.

ParameterTypeDescription
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.

ParameterTypeDescription
widget_id
window

qt_show_debug_overlay

Draw a removable outline overlay on widgets. Does not permanently change the application UI.

ParameterTypeDescription
show_classboolean
show_geometryboolean
show_idboolean
show_nameboolean
widget_ids
window_id

qt_hide_debug_overlay

Remove the debug overlay.

qt_list_signals

List Qt meta-object signals for a widget.

ParameterTypeDescription
widget_id *string

qt_watch_signal

Watch an allowlisted signal (clicked, toggled, textChanged, valueChanged, ...). Events go to a bounded buffer.

ParameterTypeDescription
signal *string
widget_id *string
enableboolean

qt_get_event_log

Recent MCP interaction events and watched-signal firings (bounded).

ParameterTypeDescription
contains
limitinteger

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.

ParameterTypeDescription
contains
level
limitinteger
source

qt_get_exceptions

Recent unhandled Python exceptions in the GUI process (chained onto existing hooks).

ParameterTypeDescription
contains
limitinteger