get_structure
[solution]
Gets a C# outline with opaque symbolKey values for semantic tools. Select a declaration, then pass its key unchanged to get_symbol_info or find_references.
Unreleased semantic outline contract. Available in development builds.
Before you use this tool
Loaded outlines use one workspace snapshot for declarations, locations, and keys. Use sync for pending content edits. Unloaded files return disk outlines without keys. Ambiguous identities, including duplicate declarations and parameterless constructor pairs, return no key and an explicit reason. Names are display labels. Source coordinates use one-based UTF-16 columns and an exclusive end.
Try it locally in the Glider playground
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| filePath | string | Yes | File path to inspect. Can be absolute or relative to the loaded root. A repository-relative path also resolves, given its complete prefix, such as src/App/Foo.cs. A partial prefix is not resolved, because guessing one could name a different file. |
| projectName | string | No | Select the loaded project context. Required when a file belongs to multiple projects. Duplicate project names require a single-project load. Unreleased parameter. Available in development builds. |
| containerQualifiedName | string | No | Optional namespace or type container inside the file. Simple names work only when unique in that file. |
| includeMembers | boolean | No | If true, include member declarations. Selecting a container also expands its members. Default is false. Default: false |
| includeNestedTypes | boolean | No | If true, include nested type declarations. Default is true. Default: true |
| kinds | string | No | Optional kind filter, comma-separated. Example: 'Class,Method,Property'. |
| pathStyle | string | No | Path style: 'absolute' (default) or 'relative' (to solution root). Default: "absolute" |
| skip | number | No | Results to skip for paging. Default is 0. Default: 0 |
| take | number | No | Results to return for paging. Default is 200. Default: 200 |
| responseDetail | string | No | compact returns results and actionable state. full adds diagnostic metadata under responseDiagnostics. Default: "compact" |
Examples
Replace sample paths and symbol keys with values from your workspace.
Inspect a file outline
{
"filePath": "/Users/dev/MyProject/Widget.cs"
}Full MCP request
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "get_structure",
"arguments": {
"filePath": "/Users/dev/MyProject/Widget.cs"
}
}
}{
"success": true,
"filePath": "/Users/dev/MyProject/Widget.cs",
"language": "csharp",
"projectName": "MyProject",
"snapshot": "workspace",
"inWorkspace": true,
"totalLines": 42,
"containerQualifiedName": null,
"summary": {
"topLevelTypeCount": 2,
"memberCount": 0,
"kindCounts": {
"Namespace": 1,
"Class": 1,
"Interface": 1
}
},
"paging": {
"total": 3
},
"items": [
{
"kind": "Namespace",
"name": "MyProject.Features",
"displayName": "MyProject.Features",
"symbolKey": "Namespace|MyProject.Features||MyProject",
"symbolKeyUnavailableReason": null,
"startColumn": 1,
"endColumn": 2,
"qualifiedName": "MyProject.Features",
"containerQualifiedName": null,
"accessibility": null,
"modifiers": [],
"header": "namespace MyProject.Features",
"startLine": 1,
"endLine": 20,
"lineCount": 20,
"childCount": 2
},
{
"kind": "Class",
"name": "Widget",
"displayName": "MyProject.Features.Widget",
"symbolKey": "Class|MyProject.Features.Widget||MyProject",
"symbolKeyUnavailableReason": null,
"startColumn": 1,
"endColumn": 2,
"qualifiedName": "MyProject.Features.Widget",
"containerQualifiedName": "MyProject.Features",
"accessibility": "public",
"modifiers": [
"sealed"
],
"header": "public sealed class Widget",
"startLine": 3,
"endLine": 15,
"lineCount": 13,
"childCount": 0
}
],
"hints": {
"nextSteps": [
"Use get_file_contents when you need exact source text for specific lines",
"Pass symbolKey unchanged to get_symbol_info or find_references",
"Set includeMembers=true or select containerQualifiedName to expand members"
]
}
}Expand one selected container and its members
{
"filePath": "src/Widget.cs",
"containerQualifiedName": "MyProject.Features.Widget",
"includeMembers": true,
"pathStyle": "relative"
}Full MCP request
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "get_structure",
"arguments": {
"filePath": "src/Widget.cs",
"containerQualifiedName": "MyProject.Features.Widget",
"includeMembers": true,
"pathStyle": "relative"
}
}
}Filter visible kinds and page the outline
{
"filePath": "src/Widget.cs",
"containerQualifiedName": "Widget",
"kinds": "Method,Property,Constructor",
"skip": 0,
"take": 25,
"pathStyle": "relative"
}Full MCP request
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "get_structure",
"arguments": {
"filePath": "src/Widget.cs",
"containerQualifiedName": "Widget",
"kinds": "Method,Property,Constructor",
"skip": 0,
"take": 25,
"pathStyle": "relative"
}
}
}Response Notes
Returns a paged outline with symbolKey, displayName, declaration spans, projectName, and snapshot source. Valid partial declarations share a key. Shared field declarations have separate variable spans. Summary counts cover all matching declarations. Binding covers only the returned page. The first semantic request can incur compilation cost. Results use top-level fields with success. Compact is the default; full adds responseDiagnostics. Both modes retain errors, coverage, partial state, and recovery advice.