Browse documentation

view_external_definition

[external]

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

Try it locally in the Glider playground

Parameters

NameTypeRequiredDescription
symbolNamestringYesSymbol to look up: a simple name, a fully qualified type, or Type.Member ('...JsonSerializer.Serialize'). A Type.Member name returns the containing type anchored at the member, including a non-public one.
assemblyHintstringNoOptional assembly name hint. It orders the search when the same type name exists in several assemblies, and never excludes an assembly, so a wrong hint costs position and not the result.
projectNamestringNoOptional project name to limit referenced assemblies.
maxLinesnumberNoMaximum number of source lines to return. Use 0 for no limit. Default is 400. Default: 400
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.

View JsonSerializer source

Arguments
{
  "symbolName": "System.Text.Json.JsonSerializer",
  "assemblyHint": "System.Text.Json"
}
Full MCP request
Full MCP request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "view_external_definition",
    "arguments": {
      "symbolName": "System.Text.Json.JsonSerializer",
      "assemblyHint": "System.Text.Json"
    }
  }
}
Illustrative response
{
  "success": true,
  "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,
  "sourceCodeStartLine": 1,
  "sourceCodeTruncated": true,
  "language": "C#"
}

Response Notes

Returns source code and assembly information. When an assemblyHint was given, assemblyHintMatched reports whether it named the assembly the symbol actually lives in. assemblyHintNote explains a mismatch; namespaces and assembly names need not agree. A non-public member resolves with a Type.Member name, which returns the containing type anchored at the member. sourceCodeStartLine gives the first returned line, so lineNumber stays absolute when the source is windowed around the member. A plain type name that no referenced assembly declares simply misses. For a Type.Member name that still misses, three causes apply. The member is absent, the type is itself non-public, or it lives only in a stripped reference assembly. Results use top-level fields with success. Compact is the default; full adds responseDiagnostics. Both modes retain errors, coverage, partial state, and recovery advice.