You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/copilot-instructions.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,8 @@ Read these files first:
14
14
- Reuse `TypeSurfaceComparer` for type-surface semantics instead of duplicating compare logic.
15
15
- Use `DecompilerService.DecompileEntitySnippet(...)` for focused compare body retrieval.
16
16
- Prefer structured JSON output over pre-rendered diff text for overview commands.
17
-
- For unknown foreign code, start with `search_symbols`, then `list_members`/`get_members_of_type`, then source or caller/callee tools. Do not fall back to shell scans after one bad member guess unless MCP diagnostics are exhausted.
17
+
- For unknown foreign code, start with `search_symbols` for fragments. For fully-qualified or XML-doc-like guessed symbols, start with `resolve_member_id` so structured `member_not_found` diagnostics can resolve the type and suggest candidates.
18
+
- After a type resolves, use `list_members`/`get_members_of_type`, then source or caller/callee tools. Do not fall back to shell scans after one bad member guess unless MCP diagnostics are exhausted.
Copy file name to clipboardExpand all lines: ARCHITECTURE.md
+10-3Lines changed: 10 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -105,6 +105,8 @@ These services provide graph-style analysis:
105
105
- implementations;
106
106
- overrides and overloads.
107
107
108
+
`find_callees` is callee-shaped, not usage-shaped. Items should identify the target through `targetMemberId` when the operand resolves to a local assembly member, and through `symbol`, `declaringType`, `opcode`, `offset`, `operandTokenHex`, and `resolution` for local, external, or unresolved metadata operands. Legacy `inMember`/`inType` aliases may remain for compatibility, but new clients should prefer the target-specific fields.
109
+
108
110
### TypeSurfaceComparer
109
111
110
112
`TypeSurfaceComparer` defines the shared semantics for structural type diffs.
@@ -161,7 +163,8 @@ Operational rules:
161
163
-`select_context` changes the default alias;
162
164
-`unload` can unload one alias or all aliases, and removes persisted registrations by default;
163
165
-`unload(..., preserveRegistration: true)` keeps restart-restore registrations while unloading memory;
164
-
-`status` reports current alias plus loaded contexts when the workspace is active.
166
+
-`status` reports current alias plus loaded contexts when the workspace is active;
167
+
-`get_server_stats(contextAlias)` reports detailed cache, index, and performance diagnostics for one alias or the current alias.
`get_il` supports the same `limit`/`cursor` paging pattern for instruction lists and also accepts `startOffset`/`endOffset` windows when callers need a byte-offset slice around a suspected anchor.
194
+
190
195
### Member-ID Follow-Up Flow
191
196
192
197
Once a discovery tool returns a `memberId`, the caller should be able to use follow-up tools without resupplying the alias. That behavior depends on the MVID prefix and must remain reliable.
193
198
194
199
### Symbol Exploration Flow
195
200
196
201
Unknown-assembly exploration should stay inside MCP tools:
197
-
- use `search_symbols` when the caller has a partial, qualified, or guessed name;
202
+
- use `search_symbols` when the caller has a fragment or is unsure whether a name is a type or member;
203
+
- use `resolve_member_id` first for fully-qualified or XML-doc-like guessed symbols such as `Namespace.Type.Member` or `M:Namespace.Type.Member`;
198
204
- use `search_types` for type-only discovery and `search_members` for member-only discovery;
199
205
- use `list_members` or `get_members_of_type` after a type is found;
200
206
- if a member-based tool receives a stale or human-entered symbol, return structured candidates and suggested next tool calls rather than only `Invalid member ID`.
207
+
- if `search_symbols` receives `Type.MissingMember` and the type resolves, return a diagnostic plus the type and direct members instead of an empty success.
201
208
202
209
### MCP Server Instructions
203
210
204
211
`Program.ServerInstructions` is intentionally short and workflow-oriented.
205
212
206
213
It should:
207
-
- steer clients toward `search_symbols`, `list_members`, structured errors, and common parameter names;
214
+
- steer clients toward `search_symbols`, `resolve_member_id`, `list_members`, structured errors, and common parameter names;
208
215
- complement the tool schemas rather than duplicate the full README or tool reference;
209
216
- stay concise enough to be useful in the MCP handshake.
Copy file name to clipboardExpand all lines: Program.cs
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -9,9 +9,10 @@ namespace DecompilerServer;
9
9
publicpartialclassProgram
10
10
{
11
11
internalconststringServerInstructions="""
12
-
DecompilerServer inspects loaded .NET assemblies. Use search_symbols first when you have a partial, qualified, or guessed name.
12
+
DecompilerServer inspects loaded .NET assemblies. Use search_symbols first for fragments; use resolve_member_id first for fully-qualified or XML-doc-like guessed symbols.
13
13
Common parameter names: search_types/search_members use query, not pattern; resolve_member_id/get_decompiled_source/find_usages use memberId; find_callers/find_callees/get_overrides use methodId; get_types_in_namespace uses ns.
14
14
After resolving a type, use list_members or get_members_of_type before guessing method names. If a lookup fails, inspect structured error.details, candidates, and hints before retrying.
15
+
Use status/list_contexts to confirm loaded aliases; use get_server_stats for detailed cache/index diagnostics.
Copy file name to clipboardExpand all lines: README.md
+8-6Lines changed: 8 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -237,6 +237,7 @@ load_assembly({
237
237
```text
238
238
list_contexts({})
239
239
status({})
240
+
get_server_stats({ "contextAlias": "rw16" })
240
241
```
241
242
242
243
**Search and decompile:**
@@ -269,12 +270,13 @@ Once you have a `memberId`, follow-up tools normally route to the correct loaded
269
270
For foreign-code exploration, prefer this path before falling back to shell tools:
270
271
271
272
1. Load the assembly with `load_assembly` and verify the active alias with `list_contexts` or `status`.
272
-
2. Start broad with `search_symbols` when you have a partial or guessed name; use `search_types` only when you specifically want types.
273
+
2. Start broad with `search_symbols` when you have a fragment; use `resolve_member_id` first when you have a fully-qualified or XML-doc-like guess such as `Namespace.Type.Member` or `M:Namespace.Type.Member`.
273
274
3. Use `list_members` or `get_members_of_type` on the resolved type before guessing method IDs.
274
275
4. Fetch code with `get_decompiled_source`, `get_source_slice`, or `plan_chunking`.
275
-
5. Move outward with `find_callers`, `find_usages`, `find_callees`, `get_il`, or compare tools.
276
+
5. Move outward with `find_callers`, `find_usages`, `find_callees`, `get_il`, or compare tools. `find_callees` returns callee-focused `targetMemberId`, `symbol`, `opcode`, `offset`, and `resolution` fields; external calls are explicit instead of pretending to be canonical local IDs.
277
+
6. Use `get_server_stats` when you need cache/index/performance diagnostics for one alias; `status` is the cheaper current-alias overview.
276
278
277
-
If a guessed member does not exist, member-based tools return structured error hints with likely candidates and concrete next tool calls. For example, a stale method guess can still resolve the type and point you at nearby overrides instead of forcing a `grep` or `monodis` fallback.
279
+
If a guessed member does not exist, member-based tools return structured error hints with likely candidates and concrete next tool calls. `search_symbols` also degrades gracefully for `Type.MissingMember`: if the type resolves but the member does not, it returns the type, its direct members, and a diagnostic instead of an empty success.
278
280
279
281
**Compare aliases:**
280
282
@@ -319,11 +321,11 @@ The repo includes a portable skill at [skills/decompiler-mcp/SKILL.md](skills/de
319
321
320
322
The GitHub `Release` workflow is triggered by pushing a tag that starts with `v` and matches the project version in `DecompilerServer.csproj`.
0 commit comments