Use this guide when you want to drive AXSG hot design from an MCP client against a live Avalonia process.
This is the runtime-attached host surface exposed by XamlSourceGenRuntimeMcpServer, not the standalone workspace tool and not the preview host.
dotnet watch and need live hot design controlYou need:
If you still need to choose the host or wire the transport, start with MCP Servers and Live Tooling.
axsg.hotDesign.enableaxsg.hotDesign.disableaxsg.hotDesign.toggleaxsg.hotDesign.statusaxsg.hotDesign.documentsaxsg.hotDesign.workspaceaxsg.hotDesign.selectDocumentaxsg.hotDesign.selectElementaxsg.hotDesign.setWorkspaceModeaxsg.hotDesign.setPropertyFilterModeaxsg.hotDesign.setHitTestModeaxsg.hotDesign.togglePanelaxsg.hotDesign.setPanelVisibilityaxsg.hotDesign.setCanvasZoomaxsg.hotDesign.setCanvasFormFactoraxsg.hotDesign.setCanvasThemeaxsg.hotDesign.applyDocumentTextaxsg.hotDesign.applyPropertyUpdateaxsg.hotDesign.insertElementaxsg.hotDesign.removeElementaxsg.hotDesign.undoaxsg.hotDesign.redoaxsg://runtime/hotdesign/statusaxsg://runtime/hotdesign/documentsaxsg://runtime/hotdesign/eventsaxsg://runtime/hotdesign/workspace/currentaxsg://runtime/hotdesign/document/selectedaxsg://runtime/hotdesign/element/selectedThe runtime host also publishes one workspace resource per registered hot design document:
axsg://runtime/hotdesign/workspace/by-build-uri/<escaped-build-uri>
Example:
axsg://runtime/hotdesign/workspace/by-build-uri/avares%3A%2F%2FMyApp%2FViews%2FMainView.axaml
These resources appear and disappear as hot design documents register or unregister. Clients should react to notifications/resources/list_changed and then relist resources when they care about per-build snapshots.
Use this rule:
notifications/resources/list_changedRecommended baseline subscriptions:
axsg://runtime/hotdesign/statusaxsg://runtime/hotdesign/eventsaxsg://runtime/hotdesign/workspace/currentaxsg://runtime/hotdesign/document/selectedaxsg://runtime/hotdesign/element/selectedThat gives an editor-like client enough live state to:
without rereading the full workspace tree after every mutation.
{
"jsonrpc": "2.0",
"id": 10,
"method": "resources/subscribe",
"params": {
"uri": "axsg://runtime/hotdesign/workspace/current"
}
}
{
"jsonrpc": "2.0",
"id": 11,
"method": "tools/call",
"params": {
"name": "axsg.hotDesign.selectDocument",
"arguments": {
"buildUri": "avares://MyApp/Views/MainView.axaml"
}
}
}
The tool returns the refreshed workspace snapshot directly. The runtime host also publishes notifications/resources/updated for the focused workspace resources, so subscribed clients can update incrementally.
{
"jsonrpc": "2.0",
"id": 12,
"method": "tools/call",
"params": {
"name": "axsg.hotDesign.applyPropertyUpdate",
"arguments": {
"buildUri": "avares://MyApp/Views/MainView.axaml",
"elementId": "submitButton",
"propertyName": "Content",
"propertyValue": "Save changes",
"persistChangesToSource": true,
"waitForHotReload": false
}
}
}
Result shape:
{
"applyResult": {
"succeeded": true,
"message": "Applied hot design update.",
"buildUri": "avares://MyApp/Views/MainView.axaml",
"sourcePersisted": true,
"minimalDiffApplied": true,
"hotReloadObserved": false,
"runtimeFallbackApplied": false
},
"workspace": {
"activeBuildUri": "avares://MyApp/Views/MainView.axaml",
"selectedElementId": "submitButton"
}
}
{
"jsonrpc": "2.0",
"id": 13,
"method": "resources/read",
"params": {
"uri": "axsg://runtime/hotdesign/element/selected"
}
}
The resource payload includes:
activeBuildUriselectedElementIdelementThat makes it cheaper to refresh inspector-like UI than rereading the entire workspace tree.
Use axsg.hotDesign.applyDocumentText when the client owns the edited XAML text directly.
{
"jsonrpc": "2.0",
"id": 20,
"method": "tools/call",
"params": {
"name": "axsg.hotDesign.applyDocumentText",
"arguments": {
"buildUri": "avares://MyApp/Views/MainView.axaml",
"xamlText": "<UserControl xmlns=\"https://github.com/avaloniaui\"><TextBlock Text=\"Live\"/></UserControl>"
}
}
}
Use this when your client edits the full document buffer.
Prefer applyPropertyUpdate, insertElement, or removeElement when the client is operating structurally and wants AXSG to produce the minimal text diff for that specific mutation.
Use:
axsg.hotDesign.undoaxsg.hotDesign.redoBoth return:
applyResultworkspaceThe workspace payload includes:
canUndocanRedoso clients can keep toolbar state aligned without separate bookkeeping.
These tools all return the refreshed workspace snapshot:
axsg.hotDesign.setWorkspaceModeaxsg.hotDesign.setPropertyFilterModeaxsg.hotDesign.setHitTestModeaxsg.hotDesign.togglePanelaxsg.hotDesign.setPanelVisibilityaxsg.hotDesign.setCanvasZoomaxsg.hotDesign.setCanvasFormFactoraxsg.hotDesign.setCanvasThemeThat means a client can treat them as pure mutations plus snapshot refresh, rather than mixing a mutating call with an immediate follow-up workspace read.
After hot design changes:
notifications/resources/updated is sent for focused resources such as workspace/current, document/selected, and element/selectednotifications/resources/list_changed is sent when the registered document set changes and per-build workspace resources may have appeared or disappearedUse this rule:
Use axsg.hotDesign.workspace or axsg://runtime/hotdesign/workspace/current when you need:
Do not use the full workspace snapshot for every tiny repaint when you only need:
That is what the focused resources are for.