mcp
v2.0.0MCP server that inspects running GTKX apps and their generated bindings.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
gtkx_list_apps
List connected GTKX applications and their open windows. An app whose windows cannot be read, such as one an error stopped under `gtkx dev`, has `error` in place of `windows`. Returns the current snapshot unless waitForApps is true; only the first seconds of a new server session wait for running apps to reconnect.
| Parameter | Type | Description |
|---|---|---|
timeout | number | Timeout in milliseconds when waitForApps is true (default: 10000) |
waitForApps | boolean | If true, wait for at least one app to register before returning. Useful when app is still starting. |
gtkx_get_widget_tree
Get the widget hierarchy for a connected GTKX app. Returns a tree of widgets with their IDs, types, roles, and properties. For large apps, pass `maxDepth` for a shallow overview and/or `rootId` to render just one subtree instead of the whole (possibly truncated) tree.
| Parameter | Type | Description |
|---|---|---|
appTimeout | integer | Milliseconds to wait for the requested app to register, or for the project's app to reconnect before falling back to another app (default: 10000). |
applicationId | string | Application ID to query. If not specified, uses the connected app from this server's project, or the first connected app when none is from it. `gtkx storybook` registers its explorer under the project… |
maxDepth | integer | Limit how many levels deep to render, and 0 for the root widget on its own; deeper descendants are summarized with a count. Combine with rootId to drill in without dumping the whole tree. |
rootId | string | Render only the subtree rooted at this widget ID (from a prior tree or query). Omit for the whole app. |
gtkx_query_widgets
Find widgets by role, text, name, or label. Returns each match with its ID and the same fixed summary `gtkx_get_widget_props` returns, with no descendants: a match that has children carries `hiddenChildren`, the count of its direct children left out. Read a match's subtree with `gtkx_get_widget_props` or `gtkx_get_widget_tree`.
| Parameter | Type | Description |
|---|---|---|
by * | string | What to compare value with: "role" the accessible role (such as "button" or "checkbox"), "text" the text the widget renders, "labelText" its label, and "name" the widget name (the GType name when none… |
value * | string | number | Value to search for, matched whole unless options.exact is false |
appTimeout | integer | Milliseconds to wait for the requested app to register, or for the project's app to reconnect before falling back to another app (default: 10000). |
applicationId | string | Application ID to query. If not specified, uses the connected app from this server's project, or the first connected app when none is from it. `gtkx storybook` registers its explorer under the project… |
options | object | Query options |
gtkx_get_widget_props
Read a widget's type, accessible role, accessible name, text, sensitivity, visibility, CSS classes, and descendants. Defaults to 8 levels; `maxDepth` changes the depth. Results contain at most 30 widgets, in breadth-first order. `hiddenChildren` counts omitted direct children; query that widget's ID to expand it. Use `gtkx_get_widget_tree` for an overview. Requested GObject `properties` appear first, keyed by canonical kebab-case name with `{type, value}`. Enum/flags values use GType value names, 64-bit integers use decimal strings, boxed values such as `GdkRGBA` use their string form, and obj…
| Parameter | Type | Description |
|---|---|---|
widgetId * | string | Widget ID obtained from `gtkx_get_widget_tree`, `gtkx_query_widgets`, or `gtkx_get_widget_props`. IDs are scoped to a single app. An ID stays valid for as long as its widget is mounted and stops resol… |
appTimeout | integer | Milliseconds to wait for the requested app to register, or for the project's app to reconnect before falling back to another app (default: 10000). |
applicationId | string | Application ID to query. If not specified, uses the connected app from this server's project, or the first connected app when none is from it. `gtkx storybook` registers its explorer under the project… |
maxDepth | integer | How many levels of descendants to include: 8 by default, and 0 for the widget on its own. At most 30 widgets come back whatever the depth, and any widget whose own direct children were left out carrie… |
properties | array | GObject property names to read as well, in kebab-case or camelCase ("current-breakpoint" or "currentBreakpoint"). Omit for the summary alone. |
gtkx_take_screenshot
Capture a screenshot of a window. Returns base64-encoded PNG image data, and optionally writes the PNG to `path` on the app's machine. You can't target widgets from a screenshot; use `gtkx_get_widget_tree` to find widget IDs for interaction. A screenshot taken right after an interaction can catch an animation midway; take another once it finishes.
| Parameter | Type | Description |
|---|---|---|
appTimeout | integer | Milliseconds to wait for the requested app to register, or for the project's app to reconnect before falling back to another app (default: 10000). |
applicationId | string | Application ID to query. If not specified, uses the connected app from this server's project, or the first connected app when none is from it. `gtkx storybook` registers its explorer under the project… |
path | string | Absolute path to write the PNG to on the app's machine. If set, the screenshot is saved there in addition to being returned. |
returnImage | boolean | Return the PNG as image content (default: true). Set false with `path` to save the image and return only its file location. |
windowId | string | Window ID to capture. If not specified, captures the first window. |
gtkx_click
Click a widget through userEvent.click. Works with buttons, checkboxes, switches, list and grid rows, tree expanders, and column headers: a row is selected, an expander toggles its row's expansion, and a header sorts its column. A widget a pointer cannot reach, such as one behind an open dialog, is refused with an error naming what blocks it. A widget inside one that cannot receive pointer input, such as a tab overview title, is refused with the widget ID of the ancestor a pointer lands on instead; click that ID. The result says when nothing on the widget or its ancestors handled the click, as…
| Parameter | Type | Description |
|---|---|---|
widgetId * | string | Widget ID obtained from `gtkx_get_widget_tree`, `gtkx_query_widgets`, or `gtkx_get_widget_props`. IDs are scoped to a single app. An ID stays valid for as long as its widget is mounted and stops resol… |
appTimeout | integer | Milliseconds to wait for the requested app to register, or for the project's app to reconnect before falling back to another app (default: 10000). |
applicationId | string | Application ID to query. If not specified, uses the connected app from this server's project, or the first connected app when none is from it. `gtkx storybook` registers its explorer under the project… |
gtkx_type
Type text into an editable widget like Entry or TextView. A newline is typed as text and does not submit; use `gtkx_press_keys` with {Enter} to activate an entry. Typing replaces text that is already selected, as it does for a user: GTK selects an entry's whole text when focus moves into it, such as when a dialog opens on it. Pass `clear` with the full text to set a value. A widget behind an open dialog is refused with an error naming the dialog, and typing while `gtkx_press_keys` holds a modifier is refused with an error naming it.
| Parameter | Type | Description |
|---|---|---|
text * | string | Text to type |
widgetId * | string | Widget ID obtained from `gtkx_get_widget_tree`, `gtkx_query_widgets`, or `gtkx_get_widget_props`. IDs are scoped to a single app. An ID stays valid for as long as its widget is mounted and stops resol… |
appTimeout | integer | Milliseconds to wait for the requested app to register, or for the project's app to reconnect before falling back to another app (default: 10000). |
applicationId | string | Application ID to query. If not specified, uses the connected app from this server's project, or the first connected app when none is from it. `gtkx storybook` registers its explorer under the project… |
clear | boolean | Clear existing text before typing |
gtkx_press_keys
Press keys through userEvent.keyboard, as a user would on the keyboard: {Enter} activates an entry and the dialog's default response, {Escape} closes a dialog or popover, and shortcuts such as `{Control>}s{/Control}` run the actions bound to them. Keys reach the widget's own key bindings first, such as arrows in a list or slider; otherwise {Tab}, `{Shift>}{Tab}{/Shift}` and arrows move focus between widgets. {Space} or {Enter} also selects or activates GTK's own widgets, such as a color chooser's swatches. The result names the keys that nothing on the widget or its ancestors handled. A modifie…
| Parameter | Type | Description |
|---|---|---|
keys * | string | Keys to press in order. A plain character presses that key. Name other keys in braces: {Enter}, {Escape}, {Tab}, {Backspace}, {Delete}, {Space}, {ArrowUp}, {ArrowDown}, {ArrowLeft}, {ArrowRight}, {Hom… |
appTimeout | integer | Milliseconds to wait for the requested app to register, or for the project's app to reconnect before falling back to another app (default: 10000). |
applicationId | string | Application ID to query. If not specified, uses the connected app from this server's project, or the first connected app when none is from it. `gtkx storybook` registers its explorer under the project… |
widgetId | string | Widget ID obtained from `gtkx_get_widget_tree`, `gtkx_query_widgets`, or `gtkx_get_widget_props`. IDs are scoped to a single app. An ID stays valid for as long as its widget is mounted and stops resol… |
gtkx_pointer
Press a mouse button on a widget through userEvent.pointer, with one pointer token in `input`. `[MouseRight]` right-clicks: it reaches the click gestures on the widget and its ancestors that listen for the secondary button, such as a `GtkGestureClick` with `button={Gdk.BUTTON_SECONDARY}` that opens a context menu. `[MouseMiddle]` does the same for the middle button, and `[MouseLeft]` clicks like `gtkx_click`. Hold a button with `[MouseRight>]` and release it with `[/MouseRight]`. A widget behind an open dialog is refused with an error naming the dialog.
| Parameter | Type | Description |
|---|---|---|
input * | string | One pointer token: [MouseLeft], [MouseRight] or [MouseMiddle] clicks that button, a trailing > presses and holds it ([MouseRight>]) and a leading / releases it ([/MouseRight]). click, down and up are… |
widgetId * | string | Widget ID obtained from `gtkx_get_widget_tree`, `gtkx_query_widgets`, or `gtkx_get_widget_props`. IDs are scoped to a single app. An ID stays valid for as long as its widget is mounted and stops resol… |
appTimeout | integer | Milliseconds to wait for the requested app to register, or for the project's app to reconnect before falling back to another app (default: 10000). |
applicationId | string | Application ID to query. If not specified, uses the connected app from this server's project, or the first connected app when none is from it. `gtkx storybook` registers its explorer under the project… |
gtkx_fire_event
Emit a GObject signal on a widget. Use this for custom interactions.
| Parameter | Type | Description |
|---|---|---|
signal * | string | GObject signal name to emit |
widgetId * | string | Widget ID obtained from `gtkx_get_widget_tree`, `gtkx_query_widgets`, or `gtkx_get_widget_props`. IDs are scoped to a single app. An ID stays valid for as long as its widget is mounted and stops resol… |
appTimeout | integer | Milliseconds to wait for the requested app to register, or for the project's app to reconnect before falling back to another app (default: 10000). |
applicationId | string | Application ID to query. If not specified, uses the connected app from this server's project, or the first connected app when none is from it. `gtkx storybook` registers its explorer under the project… |
args | array | Arguments to pass to the signal |
gtkx_list_api
List the project's generated bindings API (`@gtkx/gi` and `@gtkx/jsx`), including Adwaita, GTK4, and its declared GIR libraries. Without a namespace, returns every namespace with symbol counts; with a namespace, lists all of its symbols grouped by kind.
| Parameter | Type | Description |
|---|---|---|
namespace | string | Namespace to list (e.g. `Adw`, `Gtk`, `Gio`). Omit for an overview of all namespaces. |
projectRoot | string | Directory of the GTKX project whose bindings to document, absolute or relative to the working directory. Any directory inside the project works; its `gtkx.config.ts` decides the documented libraries.… |
gtkx_search_api
Search the project's generated bindings API by name: classes, interfaces, records, enums, functions and other symbols, and the constructors, static methods, properties, signals, methods and record fields of classes, interfaces and records. Returns the best matches first, with namespace, kind and a one-line summary; a member's name is `Owner.member`. Read one with `gtkx_get_api_docs`.
| Parameter | Type | Description |
|---|---|---|
query * | string | Case-insensitive substring of a symbol or member name, e.g. `headerbar`, `replaceContentsAsync` or `close-request`. Include the owner, or the JSX element of a class, to list its members: `Gio.File.rep… |
kind | string | Restrict matches to one symbol or member kind. |
limit | integer | Maximum number of results (default: 20). |
namespace | string | Restrict matches to one namespace (e.g. `Adw`). |
projectRoot | string | Directory of the GTKX project whose bindings to document, absolute or relative to the working directory. Any directory inside the project works; its `gtkx.config.ts` decides the documented libraries.… |
gtkx_get_api_docs
Get the reference page for one symbol of the project's generated bindings: JSX elements (props, signals, methods) or `@gtkx/gi` classes, interfaces, records, enums, callbacks, aliases, functions, and constants. A class page can run to hundreds of kilobytes; pass a member name such as `Gio.File.replaceContentsAsync` to get only that member's section.
| Parameter | Type | Description |
|---|---|---|
symbol * | string | Qualified symbol name (`Adw.Toast`, `Gtk.Orientation`, `GLib.idleAdd`), JSX element name (`AdwToast`), bare symbol name when unambiguous (`Toast`), or a class, interface or record member named after i… |
kind | string | Disambiguate when several kinds share the name, such as a class and its JSX element, or a signal and a method. |
projectRoot | string | Directory of the GTKX project whose bindings to document, absolute or relative to the working directory. Any directory inside the project works; its `gtkx.config.ts` decides the documented libraries.… |