view_external_definition

[external]

Views the source code of external symbols (types, methods, properties) from NuGet packages or framework assemblies. Attempts SourceLink resolution first, then falls back to ILSpy decompilation.

Parameters

NameTypeRequiredDescription
symbolNamestringYesName of the symbol to look up (simple or fully qualified).
assemblyHintstringNoAssembly name hint to filter results when multiple matches exist.
projectNamestringNoOptional project name to limit the search scope.

Examples

View JsonSerializer source

Request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "view_external_definition",
    "arguments": {
      "symbolName": "JsonSerializer"
    }
  }
}
Response
{
  "success": true,
  "data": {
    "symbolName": "JsonSerializer",
    "symbolKind": "Class",
    "assemblyName": "System.Text.Json",
    "assemblyVersion": "9.0.0.0",
    "sourceOrigin": "SourceLink",
    "sourceUrl": "https://raw.githubusercontent.com/...",
    "sourceCode": "public static class JsonSerializer { ... }",
    "language": "C#"
  },
  "error": null
}

View with assembly hint

Request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "view_external_definition",
    "arguments": {
      "symbolName": "JsonSerializer",
      "assemblyHint": "System.Text.Json"
    }
  }
}
Response
{
  "success": true,
  "data": {
    "symbolName": "JsonSerializer",
    "symbolKind": "Class",
    "assemblyName": "System.Text.Json",
    "assemblyVersion": "9.0.0.0",
    "sourceOrigin": "SourceLink",
    "sourceUrl": "https://raw.githubusercontent.com/...",
    "sourceCode": "public static class JsonSerializer { ... }",
    "language": "C#"
  },
  "error": null
}

Response

Returns source code, assembly info, and source origin (SourceLink or decompiled)

Go to Playground to test this tool interactively.