In-process MCP (Model Context Protocol) inspector for AI agents building UI with Avalonia.Markup.Declarative. In a debug build it exposes the running app to an agent over loopback: visual-tree dumps with bounds, window/control screenshots, the active component list, and build/binding errors. Debug/dev only β do not ship in Release.
Install
| Product | Versions |
|---|---|
| .NET |
README
Declarative.Avalonia.AgentTools
In-process MCP (Model Context Protocol) inspector for AI agents that build UI with
Avalonia.Markup.Declarative.
In a debug build it exposes the running app to an agent over loopback so the agent can close the feedback loop while iterating on a view:
get_app_infoβ windows, focus, popups, theme, versions, hot-reload/interaction state (call first)get_visual_treeβ text visual tree with names/bounds;maxDepth/filterto trim; open popups includedget_layoutβ detailed layout for one control: bounds, window-relative position, requested vs actual size, alignment, margin/padding, visibility, off-screen/clipped flags, and the ancestor chainget_propertiesβ effective state + every locally-set styled propertyget_property_sourcesβ where each value came from (local / style / template / animation / inherited)get_data_contextβ the control's view-model rendered as text (debug bindings)get_sourceβ theViewBasecomponent that built a control (which class to edit); optionalfile:linefind_text/hit_testβ locate controls by visible text or by pixel coordinatelayout_auditβ automated layout lint (zero-size, off-screen, overlap, out-of-parent, text-clipped)list_componentsβ active declarative viewsscreenshot_window(withannotate) /screenshot_controlβ PNG screenshots (image content blocks)compare_screenshots/list_screenshotsβ before/after pixel diff (red diff image + % changed)highlightβ draw a frame around a control (or all of a type) and screenshot it;action='clear'clearswait_for/wait_idleβ sync after an interaction or hot reloadget_errorsβ recent build / binding / converter / runtime errors (incl. exceptions in handlers)invoke,set_window_size,set_theme,click_atβ (optional, off by default) remote control: invoke / select / select_item / toggle / set / expand / collapse / focus / scroll / scroll_by / context_menu / key / type, plus resize, theme switch, and click-by-coordinate
Usage
var appBuilder = AppBuilder.Configure<App>()
.UsePlatformDetect()
#if DEBUG
.UseAgentInspector() // loopback MCP server on 127.0.0.1:5599
#endif
.SetupWithLifetime(lifetime);
Point your agent's MCP client at the streamable-HTTP endpoint http://127.0.0.1:5599.
Show a live "agent connected" status in your UI (like Chrome DevTools) by subscribing to
AgentConnectionMonitor β events are raised on the UI thread:
#if DEBUG
AgentConnectionMonitor.StatusChanged += (_, e) =>
window.Title = e.IsConnected ? "π’ Agent connected β My App" : "My App";
#endif
Dev only. Keep the call under
#if DEBUG. This package pulls in the ASP.NET Core web stack and a remote-control surface; it must not ship in Release. The server binds to loopback only, and the tier-2 tools (invoke,set_window_size,set_theme,click_at) stay disabled unless you setEnableInteraction = true.
See the repository's docs/agent-tools.md for the full guide.
Changes from Previous Version
Adoption Assessment
Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.