Use this guide when you want AXSG language-service operations over MCP from the standalone workspace host.
This guide is about:
axsg-mcpIt is not about the live runtime host inside a running Avalonia process.
Install:
dotnet tool install --global XamlToCSharpGenerator.McpServer.Tool --version x.y.z
Run:
axsg-mcp --workspace /Users/wieslawsoltes/GitHub/XamlToCSharpGenerator
For repo development:
dotnet run --project src/XamlToCSharpGenerator.McpServer -- --workspace /Users/wieslawsoltes/GitHub/XamlToCSharpGenerator
The workspace host is query-oriented.
Use this rule:
tools/call or resources/readThe host does expose the same runtime-shaped snapshot resources as the shared catalog, but on the standalone workspace tool those are only snapshots of the tool process itself. They are not a live bridge into a separate Avalonia runtime.
axsg.preview.projectContextaxsg.workspace.metadataDocumentaxsg.workspace.inlineCSharpProjectionsaxsg.workspace.csharpReferencesaxsg.workspace.csharpDeclarationsaxsg.workspace.renamePropagationaxsg.workspace.prepareRenameaxsg.workspace.renameUse axsg.preview.projectContext when a client needs to know which project and project-relative path the preview system should use.
Example:
{
"jsonrpc": "2.0",
"id": 10,
"method": "tools/call",
"params": {
"name": "axsg.preview.projectContext",
"arguments": {
"uri": "file:///Users/wieslawsoltes/GitHub/XamlToCSharpGenerator/samples/ControlCatalog/Pages/ListBoxPage.xaml",
"workspaceRoot": "/Users/wieslawsoltes/GitHub/XamlToCSharpGenerator"
}
}
}
Typical response fields include:
projectPathtargetPathprojectRelativeXamlPathtargetFrameworkUse this before you start a preview session from a custom client.
Use axsg.workspace.metadataDocument when you already have either:
Example:
{
"jsonrpc": "2.0",
"id": 11,
"method": "tools/call",
"params": {
"name": "axsg.workspace.metadataDocument",
"arguments": {
"metadataUri": "axsg-metadata://document?id=ExternalControl"
}
}
}
Response shape:
{
"text": "namespace ExternalLibrary { public partial class ExternalControl : UserControl { ... } }"
}
Use axsg.workspace.inlineCSharpProjections when a custom editor or tool needs the synthetic C# documents derived from inline AXSG code regions.
Example:
{
"jsonrpc": "2.0",
"id": 12,
"method": "tools/call",
"params": {
"name": "axsg.workspace.inlineCSharpProjections",
"arguments": {
"uri": "file:///Users/wieslawsoltes/GitHub/XamlToCSharpGenerator/samples/SourceGenXamlCatalogSample/Pages/InlineCodeCDataPage.axaml",
"workspaceRoot": "/Users/wieslawsoltes/GitHub/XamlToCSharpGenerator",
"documentText": "<UserControl ... />",
"version": 7
}
}
}
Each projection item includes:
idkindxamlRangeprojectedCodeRangeprojectedTextUse documentText when the client has unsaved in-memory edits and wants projection results against that text instead of the file on disk.
Use axsg.workspace.csharpReferences to map a C# symbol position back to XAML references.
{
"jsonrpc": "2.0",
"id": 13,
"method": "tools/call",
"params": {
"name": "axsg.workspace.csharpReferences",
"arguments": {
"uri": "file:///Users/wieslawsoltes/GitHub/XamlToCSharpGenerator/samples/ControlCatalog/ViewModels/ListBoxPageViewModel.cs",
"line": 12,
"character": 18,
"workspaceRoot": "/Users/wieslawsoltes/GitHub/XamlToCSharpGenerator"
}
}
}
Each result includes:
urirangeisDeclarationUse axsg.workspace.csharpDeclarations when you want the XAML declaration side instead.
The arguments match the references tool:
urilinecharacterworkspaceRootdocumentTextaxsg.workspace.prepareRenameUse this first when your client needs to know whether rename is valid at a XAML position.
Response:
rangeplaceholderaxsg.workspace.renamePropagationUse this when rename started from C# and you only need the XAML-side workspace edit.
axsg.workspace.renameUse this when rename starts from a XAML position and you want the full AXSG rename edit payload.
Example:
{
"jsonrpc": "2.0",
"id": 14,
"method": "tools/call",
"params": {
"name": "axsg.workspace.rename",
"arguments": {
"uri": "file:///Users/wieslawsoltes/GitHub/XamlToCSharpGenerator/samples/ControlCatalog/Pages/ListBoxPage.xaml",
"line": 2,
"character": 16,
"newName": "ItemsPanelView",
"workspaceRoot": "/Users/wieslawsoltes/GitHub/XamlToCSharpGenerator"
}
}
}
The tool returns a workspace-edit payload with URI-keyed text changes. That result is designed for AI tools and custom editors that want the rename plan without speaking LSP directly.
axsg.preview.projectContextaxsg.workspace.inlineCSharpProjections with the in-memory documentTextaxsg.workspace.renamePropagationaxsg.workspace.prepareRenameaxsg.workspace.renameBecause the workspace host is not a live runtime host, use explicit polling:
Use the runtime host instead when the question is about: