MCP server for analyzing and comparing .NET assemblies. Provides cross-reference analysis, decompilation, type comparison, and Harmony patch dependency extraction.
ILens demonstrates strong definition quality with 15 well-named, verb-prefixed tools (analyze, decompile_*, compare_*, find_*, list_*, search_*, summarize_type). All tools have detailed descriptions (100-500+ chars) explaining purpose, parameters, and constraints. Input schemas are comprehensive with typed parameters and descriptions. However, output schemas are not formally documented, responses are described in prose rather than JSON Schema. Error handling is present (ToolErrorFilter converts exceptions to readable messages) but lacks recovery guidance. Tool composition is excellent: each tool has a single responsibility, and output IDs chain to downstream tools (e.g., typeName from search_types feeds into decompile_type). No security issues detected (read-only operations, no secrets in params). Minor gaps: some parameter descriptions could be more concise, and output structure documentation would improve LLM planning.
Run cross-reference analysis on a type or member. Omit memberName to analyze the type itself. Valid kinds by symbol category: Type: UsedBy, InstantiatedBy, ExposedBy, ExtensionMethods, AppliedTo, ImplementedBy Method: UsedBy, OverriddenBy, ImplementedBy, Uses, Implements Property: UsedBy, ReadBy, AssignedBy, Uses, OverriddenBy, ImplementedBy Field: ReadBy, AssignedBy Event: UsedBy, OverriddenBy, ImplementedBy UsedBy / ReadBy / AssignedBy / Uses on a property route to its accessors — ReadBy to the getter, AssignedBy to the setter, UsedBy to both, and Uses to both for the outgoing direction (what the accessor bodies call). UsedBy on an event covers its add, remove, and invoke accessors plus, for a field-like event, the field holding the subscriber list — so raise sites are reported and not just subscribers. The result header names what was consulted. ReadBy on a write-only property, or AssignedBy on a read-only one, errors rather than returning an empty result. AppliedTo requires an Attribute-derived type — it errors on a non-attribute type. ImplementedBy on a type requires an interface — it errors on a non-interface type.
Compare a single method across two assemblies and emit each body labeled by source. Format is 'csharp' (decompiled C#, default) or 'il' (normalized IL disassembly — the same form list_changed_types and compare_type use to decide body equality). When the two bodies are identical the tool emits a single copy with a note instead of duplicating the text.
Compare a type across two assemblies — added / removed members, plus a body-changed flag per method. No C# decompilation invoked; method-body equality uses normalized IL. Output uses '+' for added members, '-' for removed, and '~' for method bodies that changed while keeping the same signature.
Output schemas not formally documented. Tool descriptions explain results in prose (e.g., 'Output schema: { patches: [...], fieldAccesses: [...] }') but no JSON Schema definitions provided. LLMs cannot reliably parse unstructured output or plan downstream tool chains.
Error recovery guidance missing. ToolErrorFilter converts exceptions to readable messages (e.g., 'Error: ArgumentException: Analysis kind AppliedTo requires an attribute type') but does not suggest next steps. LLMs receive the error but lack actionable recovery paths.
Parameter constraints not fully formalized. Some parameters accept enums (e.g., 'kind' in analyze, 'format' in compare_method) but are typed as strings in schema. Enums should be declared as JSON Schema enum arrays to prevent LLM hallucination of invalid values.
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-23 | C | 65 | 2026-07-28+ | v2 |
Decompile an event by name and return the full C# event declaration with add/remove accessor bodies. Shorthand for the IL-prefixed path through decompile_method (add_X, remove_X) — use this when you have the event name and want everything about it.
Decompile a single method to C# source code. Faster and more focused than decompile_type when you only need one method. Property and event accessors are also reachable by their IL name (get_X, set_X, add_X, remove_X) even though find_methods hides them from generic browsing — for the whole property or event use decompile_property / decompile_event instead, which take the unprefixed name.
Decompile a property by name and return the full C# property declaration with its accessor bodies. Shorthand for the IL-prefixed path through decompile_method (get_X, set_X) — use this when you have the property name and want everything about it. For indexer overloads, use decompile_method on get_Item / set_Item with parameterTypes; this tool rejects ambiguous indexer names with the candidates listed.
Decompile a type to full C# source code. Use this to understand implementation details, method bodies, and internal logic.
Extract the full reflective surface of a Harmony-patching assembly as JSON: every patch target (from [HarmonyPatch] attributes and TargetMethod/TargetMethods bodies) and every reflective field access (AccessTools.Field, AccessTools.FieldRefAccess, Traverse.Field). Used to answer "do my patches still bind on game version X?" — pair with compare_method against two versions of the host game's assembly. Output schema: { patches: [{ targetType, targetMember, paramTypes?, methodType?, patchType, resolutionKind, patchClass, patchSite }], fieldAccesses: [{ contextType, fieldName, accessor, patchSite }] }. resolutionKind ∈ TypedAttribute | StringTargeted | Attribute | TargetMethod | TargetMethods | DynamicTargetMethod. accessor ∈ AccessToolsField | FieldRefAccess | TraverseField. Note: the TypedAttribute vs StringTargeted distinction needs to probe the target type for member visibility, so it only fires when the target lives in the same assembly being scanned. Cross-assembly targets (the typical case for a mod patching a host game's DLLs) fall back to Attribute regardless.
Search the assembly for methods matching a signature. Combine any of: name pattern, return type, parameter types, parameter count, declaring namespace, declaring type, declaring-type pattern, accessibility. To list the methods of one known type, pass declaringType with its fully qualified name (e.g., 'System.IO.File') — the same form decompile_method's typeName takes. declaringTypePattern is the looser sibling: a case-insensitive substring of the short name. Type patterns match by short name OR full name (e.g., 'String' or 'System.String'). Generics are erased at the top level — 'List' matches List<T> for any T. Nullable<T> is unwrapped — 'int' matches both 'int' and 'int?'. Arrays are matched with '[]' suffix (e.g., 'int[]', 'String[]'). Matching is exact (no inheritance walk); use analyze with UsedBy/Uses for assignability-aware exploration. Constructors and property/event accessors are excluded; operator methods (op_*) are included. To decompile an accessor body, call decompile_method with the accessor's IL name (get_X, set_X, add_X, remove_X). Results are sorted by declaring type, then method name; capped at limit (default 50).
List the directories from which assemblies can be loaded. Any 'assembly' parameter passed to other tools must point to a file inside one of these.
Enumerate types that differ between two assemblies — added, removed, or changed (metadata, members, or method bodies). Pure metadata + normalized IL walk; the C# decompiler is not invoked. Members are matched by name plus parameter and return types, so any signature change surfaces as a remove+add. Method-body equality is decided by IL disassembly with operand tokens resolved to symbolic names — bodies whose source is unchanged digest identically across rebuilds, even when metadata tokens around them shift. By default hides compiler-generated noise — closures, anonymous types, source-generator output. Pass excludeCompilerGenerated=false to include everything.
List members of a type, grouped by kind (Methods/Properties/Fields/Events). Returns one signature per line — no method bodies, no documentation strings. Filter by member kind, accessibility, and case-insensitive name pattern. Cheaper than summarize_type when you only need part of the API surface.
List all types in a namespace. Returns fully qualified type names. By default hides compiler-generated noise — closures, anonymous types, source-generator output. Pass excludeCompilerGenerated=false to include everything.
Search for types by name pattern. Matching is a case-insensitive substring applied to each type's short name (the namespace is not part of the match). Results are returned as fully qualified names so they can be fed into other tools verbatim. Returns up to 50 matches. By default hides compiler-generated noise — closures, anonymous types, source-generator output. Pass excludeCompilerGenerated=false to include everything.
Summarize the public and protected API surface of a type — signatures only, no method bodies. Use this for quick lookups of available members, fields, and properties.
Pagination not implemented. Tools like list_members, list_types, find_methods accept a 'limit' parameter but do not return pagination metadata (total_count, next_cursor, has_more). Large result sets may be truncated silently, and LLMs cannot request additional pages.
Tool composition assumes assembly path knowledge. All tools require an 'assembly' parameter (file path under allowed roots). LLMs must know or discover valid paths via list_allowed_roots. Consider accepting assembly name/pattern and resolving internally to reduce friction.