Skip to content

decompile_method

Decompilation

Extracts a single method from a type within a .NET assembly. Decompiles the containing type, then isolates the named method from the output. Particularly useful when a type is too large to return in full, or when you only need one method’s implementation.

ParameterTypeRequiredDefaultDescription
assembly_pathstringYesPath to the .dll or .exe file
type_namestringYesFully qualified type name (e.g., MyApp.Services.AuthService)
method_namestringYesMethod name to extract (e.g., Validate)
show_il_codeboolNotrueOutput IL bytecode instead of C# (more reliable for extraction)
language_versionstringNo"Latest"C# syntax version: CSharp1CSharp12_0, Preview, Latest
use_pdb_variable_namesboolNofalseUse original variable names from an existing PDB
{
"tool": "decompile_method",
"arguments": {
"assembly_path": "/path/to/MyApp.dll",
"type_name": "MyApp.Services.AuthService",
"method_name": "ValidateToken",
"show_il_code": false
}
}

Returns the extracted method body as formatted code. If multiple overloads share the same name, all matching overloads are returned with separate headings. IL mode (default) uses ECMA-335 method delimiters for reliable extraction. C# mode uses signature matching with brace-depth counting.