mcp

v2.0.0
@gtkx/mcp Checked 6 hours ago Published 18 hours ago

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

ParameterTypeDescription
timeoutnumberTimeout in milliseconds when waitForApps is true (default: 10000)
waitForAppsbooleanIf 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.

ParameterTypeDescription
appTimeoutintegerMilliseconds to wait for the requested app to register, or for the project's app to reconnect before falling back to another app (default: 10000).
applicationIdstringApplication 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…
maxDepthintegerLimit 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.
rootIdstringRender 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`.

ParameterTypeDescription
by *stringWhat 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 | numberValue to search for, matched whole unless options.exact is false
appTimeoutintegerMilliseconds to wait for the requested app to register, or for the project's app to reconnect before falling back to another app (default: 10000).
applicationIdstringApplication 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…
optionsobjectQuery 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…

ParameterTypeDescription
widgetId *stringWidget 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…
appTimeoutintegerMilliseconds to wait for the requested app to register, or for the project's app to reconnect before falling back to another app (default: 10000).
applicationIdstringApplication 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…
maxDepthintegerHow 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…
propertiesarrayGObject 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.

ParameterTypeDescription
appTimeoutintegerMilliseconds to wait for the requested app to register, or for the project's app to reconnect before falling back to another app (default: 10000).
applicationIdstringApplication 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…
pathstringAbsolute path to write the PNG to on the app's machine. If set, the screenshot is saved there in addition to being returned.
returnImagebooleanReturn the PNG as image content (default: true). Set false with `path` to save the image and return only its file location.
windowIdstringWindow 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…

ParameterTypeDescription
widgetId *stringWidget 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…
appTimeoutintegerMilliseconds to wait for the requested app to register, or for the project's app to reconnect before falling back to another app (default: 10000).
applicationIdstringApplication 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.

ParameterTypeDescription
text *stringText to type
widgetId *stringWidget 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…
appTimeoutintegerMilliseconds to wait for the requested app to register, or for the project's app to reconnect before falling back to another app (default: 10000).
applicationIdstringApplication 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…
clearbooleanClear 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…

ParameterTypeDescription
keys *stringKeys 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…
appTimeoutintegerMilliseconds to wait for the requested app to register, or for the project's app to reconnect before falling back to another app (default: 10000).
applicationIdstringApplication 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…
widgetIdstringWidget 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.

ParameterTypeDescription
input *stringOne 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 *stringWidget 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…
appTimeoutintegerMilliseconds to wait for the requested app to register, or for the project's app to reconnect before falling back to another app (default: 10000).
applicationIdstringApplication 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.

ParameterTypeDescription
signal *stringGObject signal name to emit
widgetId *stringWidget 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…
appTimeoutintegerMilliseconds to wait for the requested app to register, or for the project's app to reconnect before falling back to another app (default: 10000).
applicationIdstringApplication 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…
argsarrayArguments 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.

ParameterTypeDescription
namespacestringNamespace to list (e.g. `Adw`, `Gtk`, `Gio`). Omit for an overview of all namespaces.
projectRootstringDirectory 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`.

ParameterTypeDescription
query *stringCase-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…
kindstringRestrict matches to one symbol or member kind.
limitintegerMaximum number of results (default: 20).
namespacestringRestrict matches to one namespace (e.g. `Adw`).
projectRootstringDirectory 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.

ParameterTypeDescription
symbol *stringQualified 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…
kindstringDisambiguate when several kinds share the name, such as a class and its JSX element, or a signal and a method.
projectRootstringDirectory 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.…