get_structure

[solution]

Gets a compact C# file outline under the loaded root with optional container selection, kind filtering, and paging. Use get_file_contents when you need raw text.

Why this tool exists

Before reading a whole file, the agent often needs an outline of types and members.

How it helps the agent

It lets the model choose the relevant source region from structure first, then read narrowly.

Parameters

NameTypeRequiredDescription
filePathstringYesFile path to inspect. Can be absolute or relative to the loaded root.
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.
includeNestedTypesbooleanNoIf true, include nested type declarations. Default is true.
kindsstringNoOptional kind filter, comma-separated. Example: 'Class,Method,Property'.
pathStylestringNoPath style: 'absolute' (default) or 'relative' (to solution root).
skipnumberNoResults to skip for paging. Default is 0.
takenumberNoResults to return for paging. Default is 200.

Examples

Inspect a file outline

Request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "get_structure",
    "arguments": {
      "filePath": "/Users/dev/MyProject/Widget.cs"
    }
  }
}
Response
{
  "success": true,
  "data": {
    "filePath": "/Users/dev/MyProject/Widget.cs",
    "language": "csharp",
    "inWorkspace": true,
    "totalLines": 42,
    "containerQualifiedName": null,
    "summary": {
      "topLevelTypeCount": 2,
      "memberCount": 0,
      "kindCounts": {
        "Namespace": 1,
        "Class": 1,
        "Interface": 1
      }
    },
    "paging": {
      "skip": 0,
      "take": 200,
      "total": 3,
      "returned": 3,
      "hasMore": false
    },
    "items": [
      {
        "kind": "Namespace",
        "name": "MyProject.Features",
        "qualifiedName": "MyProject.Features",
        "containerQualifiedName": null,
        "accessibility": null,
        "modifiers": [],
        "header": "namespace MyProject.Features",
        "startLine": 1,
        "endLine": 20,
        "lineCount": 20,
        "childCount": 2
      },
      {
        "kind": "Class",
        "name": "Widget",
        "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",
        "Use get_type_info after choosing a type when you need semantic type/member details",
        "Set includeMembers=true or select containerQualifiedName to expand members"
      ]
    }
  },
  "meta": {
    "durationMs": 94,
    "cancelled": false,
    "timedOut": false,
    "timeoutMs": 1200000
  },
  "error": null
}

Expand one selected container and its members

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"
    }
  }
}
Response
{
  "success": true,
  "data": {
    "filePath": "/Users/dev/MyProject/Widget.cs",
    "language": "csharp",
    "inWorkspace": true,
    "totalLines": 42,
    "containerQualifiedName": null,
    "summary": {
      "topLevelTypeCount": 2,
      "memberCount": 0,
      "kindCounts": {
        "Namespace": 1,
        "Class": 1,
        "Interface": 1
      }
    },
    "paging": {
      "skip": 0,
      "take": 200,
      "total": 3,
      "returned": 3,
      "hasMore": false
    },
    "items": [
      {
        "kind": "Namespace",
        "name": "MyProject.Features",
        "qualifiedName": "MyProject.Features",
        "containerQualifiedName": null,
        "accessibility": null,
        "modifiers": [],
        "header": "namespace MyProject.Features",
        "startLine": 1,
        "endLine": 20,
        "lineCount": 20,
        "childCount": 2
      },
      {
        "kind": "Class",
        "name": "Widget",
        "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",
        "Use get_type_info after choosing a type when you need semantic type/member details",
        "Set includeMembers=true or select containerQualifiedName to expand members"
      ]
    }
  },
  "meta": {
    "durationMs": 94,
    "cancelled": false,
    "timedOut": false,
    "timeoutMs": 1200000
  },
  "error": null
}

Filter visible kinds and page the outline

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
{
  "success": true,
  "data": {
    "filePath": "/Users/dev/MyProject/Widget.cs",
    "language": "csharp",
    "inWorkspace": true,
    "totalLines": 42,
    "containerQualifiedName": null,
    "summary": {
      "topLevelTypeCount": 2,
      "memberCount": 0,
      "kindCounts": {
        "Namespace": 1,
        "Class": 1,
        "Interface": 1
      }
    },
    "paging": {
      "skip": 0,
      "take": 200,
      "total": 3,
      "returned": 3,
      "hasMore": false
    },
    "items": [
      {
        "kind": "Namespace",
        "name": "MyProject.Features",
        "qualifiedName": "MyProject.Features",
        "containerQualifiedName": null,
        "accessibility": null,
        "modifiers": [],
        "header": "namespace MyProject.Features",
        "startLine": 1,
        "endLine": 20,
        "lineCount": 20,
        "childCount": 2
      },
      {
        "kind": "Class",
        "name": "Widget",
        "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",
        "Use get_type_info after choosing a type when you need semantic type/member details",
        "Set includeMembers=true or select containerQualifiedName to expand members"
      ]
    }
  },
  "meta": {
    "durationMs": 94,
    "cancelled": false,
    "timedOut": false,
    "timeoutMs": 1200000
  },
  "error": null
}

Response Notes

Returns a paged C# outline with per-kind counts, compact declaration headers, and next-step hints for deeper reads.

↑/↓ NavigateEnter OpenSpace Expand