view_external_definition

[external]

Views source code for external symbols (NuGet/framework), via SourceLink or decompilation.

Try this tool in Playground.

Parameters

NameTypeRequiredDescription
symbolNamestringYesSymbol name to look up (simple or fully qualified).
assemblyHintstringNoOptional assembly name hint to narrow matches.
projectNamestringNoOptional project name to limit referenced assemblies.
maxLinesnumberNoMaximum number of source lines to return. Use 0 for no limit. Default is 400.
timeout_msnumberNoTimeout in milliseconds (5 minutes). Use 0 to disable. Default is 300000.

Examples

View JsonSerializer source

Request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "view_external_definition",
    "arguments": {
      "symbolName": "System.Text.Json.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 { ... }",
    "sourceCodeTotalLines": 1200,
    "sourceCodeReturnedLines": 400,
    "sourceCodeTruncated": true,
    "language": "C#"
  },
  "error": null
}

Response Notes

Returns source code and assembly information