get_type_source
[analysis]
Gets source code for a type (bounded by max lines).
Try it locally in the Glider playground
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| typeName | string | No | Type name (simple or fully qualified). Provide this or symbolKey. |
| symbolKey | string | No | A key returned by search_symbols or resolve_symbol. Pass it unchanged. Provide this or typeName. |
| projectName | string | No | Optional project name filter. |
| maxLines | number | No | Max lines to return. Use 0 for unlimited. Default is 200. Default: 200 |
| pathStyle | string | No | Path style: 'absolute' (default) or 'relative' (to solution root). Default: "absolute" |
| responseDetail | string | No | compact 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.
Get type source
Arguments
{
"typeName": "UserService"
}Full MCP request
Full MCP request
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "get_type_source",
"arguments": {
"typeName": "UserService"
}
}
}Illustrative response
{
"success": true,
"typeName": "UserService",
"fullName": "MyApp.Services.UserService",
"kind": "Class",
"filePath": "/path/to/UserService.cs",
"startLine": 1,
"endLine": 120,
"lineCount": 120,
"truncated": true,
"source": "..."
}Response Notes
Returns workspace source for a type, possibly truncated. If a key does not resolve, discover the type again with search_symbols or resolve_symbol. A resolved type can still lack workspace source. When Glider identifies an external definition, the response provides an assembly hint and a view_external_definition call. Results use top-level fields with success. Compact is the default; full adds responseDiagnostics. Both modes retain errors, coverage, partial state, and recovery advice.