Browse documentation

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

NameTypeRequiredDescription
filePathstringYesFile 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.
projectNamestringNoSelect 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.
containerQualifiedNamestringNoOptional namespace or type container inside the file. Simple names work only when unique in that file.
includeMembersbooleanNoIf true, include member declarations. Selecting a container also expands its members. Default is false. Default: false
includeNestedTypesbooleanNoIf true, include nested type declarations. Default is true. Default: true
kindsstringNoOptional kind filter, comma-separated. Example: 'Class,Method,Property'.
pathStylestringNoPath style: 'absolute' (default) or 'relative' (to solution root). Default: "absolute"
skipnumberNoResults to skip for paging. Default is 0. Default: 0
takenumberNoResults to return for paging. Default is 200. Default: 200
responseDetailstringNocompact 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

Arguments
{
  "filePath": "/Users/dev/MyProject/Widget.cs"
}
Full MCP request
Full MCP request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "get_structure",
    "arguments": {
      "filePath": "/Users/dev/MyProject/Widget.cs"
    }
  }
}
Illustrative response
{
  "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

Arguments
{
  "filePath": "src/Widget.cs",
  "containerQualifiedName": "MyProject.Features.Widget",
  "includeMembers": true,
  "pathStyle": "relative"
}
Full MCP request
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

Arguments
{
  "filePath": "src/Widget.cs",
  "containerQualifiedName": "Widget",
  "kinds": "Method,Property,Constructor",
  "skip": 0,
  "take": 25,
  "pathStyle": "relative"
}
Full MCP request
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.