get_method_source

[analysis]

Gets source code for a method (bounded by max lines).

Try this tool in Playground.

Parameters

NameTypeRequiredDescription
methodNamestringYesMethod name.
containingTypeNamestringNoOptional containing type name filter.
projectNamestringNoOptional project name filter.
maxLinesnumberNoMax lines to return. Use 0 for unlimited. Default is 120.
bodyOnlybooleanNoIf true, return only the method body (no signature). Default is false.
pathStylestringNoPath style: 'absolute' (default) or 'relative' (to solution root).
timeout_msnumberNoTimeout in milliseconds. Use 0 to disable. Default is 30000.

Examples

Get method source

Request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "get_method_source",
    "arguments": {
      "methodName": "LoadSolutionAsync",
      "containingTypeName": "SolutionManager"
    }
  }
}
Response
{
  "success": true,
  "data": {
    "methodName": "LoadSolutionAsync",
    "containingType": "SolutionManager",
    "filePath": "/path/to/SolutionManager.cs",
    "startLine": 50,
    "endLine": 80,
    "lineCount": 31,
    "truncated": false,
    "source": "..."
  },
  "error": null
}

Response Notes

Returns method source (possibly truncated)