Skip to content

Commit b4be24b

Browse files
Clarify the usage of the commands
1 parent a975093 commit b4be24b

File tree

9 files changed

+172
-136
lines changed

9 files changed

+172
-136
lines changed

mcp_nexus/Protocol/McpToolDefinitionService.cs

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ public McpToolSchema[] GetAllTools()
1717
return
1818
[
1919
// ✅ NEXUS DEBUGGER COMMANDS - Core functionality for crash dump analysis
20-
CreateNexusOpenDumpTool(),
21-
CreateNexusExecDebuggerCommandAsyncTool(),
22-
CreateNexusDebuggerCommandStatusTool(),
23-
CreateNexusCloseDumpTool()
20+
CreateNexusOpenDumpAnalyzeSessionTool(),
21+
CreateNexusDumpAnalyzeSessionAsyncCommandTool(),
22+
CreateNexusDumpAnalyzeSessionAsyncCommandStatusTool(),
23+
CreateNexusCloseDumpAnalyzeSessionTool()
2424
// NOTE: Remote debugging and command cancellation will be added in future releases
2525
];
2626
}
@@ -36,23 +36,23 @@ public async Task NotifyToolsChanged()
3636
}
3737
}
3838

39-
private static McpToolSchema CreateNexusOpenDumpTool()
39+
private static McpToolSchema CreateNexusOpenDumpAnalyzeSessionTool()
4040
{
4141
return new McpToolSchema
4242
{
43-
Name = "nexus_open_dump",
44-
Description = "🚀 STEP 1 - START HERE: Open and analyze a Windows crash dump file (.dmp). " +
43+
Name = "nexus_open_dump_analyze_session",
44+
Description = "🚀 STEP 1 - START HERE: Open and analyze a Windows crash dump file (.dmp) by creating a dedicated analysis session. " +
4545
"🚨 CRITICAL RETURN VALUE: This command RETURNS a sessionId in the response JSON that you MUST EXTRACT and SAVE! " +
4646
"📤 RESPONSE CONTAINS: {\"sessionId\": \"sess-000001-abc12345\", ...} " +
4747
"📝 YOU MUST: Parse the response JSON and extract the 'sessionId' field value! " +
4848
"💾 SAVE IT: Store this sessionId string and use it in ALL subsequent commands! " +
4949
"🔄 MANDATORY WORKFLOW: " +
50-
"1️⃣ nexus_open_dump → EXTRACT 'sessionId' from response JSON → SAVE IT! " +
51-
"2️⃣ nexus_exec_debugger_command_async + SAVED sessionId → get commandId " +
52-
"3️⃣ nexus_debugger_command_status + commandId → get results " +
53-
"4️⃣ nexus_close_dump + SAVED sessionId → CLOSE session when done (EXPECTED!) " +
50+
"1️⃣ nexus_open_dump_analyze_session → EXTRACT 'sessionId' from response JSON → SAVE IT! " +
51+
"2️⃣ nexus_dump_analyze_session_async_command + SAVED sessionId → get commandId " +
52+
"3️⃣ nexus_dump_analyze_session_async_command_status + commandId → get results " +
53+
"4️⃣ nexus_close_dump_analyze_session + SAVED sessionId → CLOSE session when done (EXPECTED!) " +
5454
"❌ DO NOT MAKE UP sessionId VALUES! Use only what this command returns! " +
55-
"🧹 CLEANUP EXPECTATION: You SHOULD call nexus_close_dump when finished analyzing to properly release resources and close the debugging session. While sessions auto-expire after 30 minutes, explicit closure is the expected and professional approach!",
55+
"🧹 CLEANUP EXPECTATION: You SHOULD call nexus_close_dump_analyze_session when finished analyzing to properly release resources and close the debugging session. While sessions auto-expire after 30 minutes, explicit closure is the expected and professional approach!",
5656
InputSchema = new
5757
{
5858
type = "object",
@@ -67,45 +67,45 @@ private static McpToolSchema CreateNexusOpenDumpTool()
6767
}
6868

6969

70-
private static McpToolSchema CreateNexusCloseDumpTool()
70+
private static McpToolSchema CreateNexusCloseDumpAnalyzeSessionTool()
7171
{
7272
return new McpToolSchema
7373
{
74-
Name = "nexus_close_dump",
75-
Description = "🔚 STEP 4 - CLEANUP: Close the current crash dump session and release resources. " +
74+
Name = "nexus_close_dump_analyze_session",
75+
Description = "🔚 STEP 4 - CLEANUP: Close the current crash dump analysis session and release resources. " +
7676
"⭐ EXPECTED BEHAVIOR: You SHOULD call this when done analyzing a dump file! " +
7777
"🧹 PROFESSIONAL PRACTICE: While sessions auto-expire after 30 minutes, explicit closure is the expected and responsible approach. " +
78-
"🔄 NEXT SESSION: After closing, you'll need nexus_open_dump again to analyze another dump. " +
78+
"🔄 NEXT SESSION: After closing, you'll need nexus_open_dump_analyze_session again to analyze another dump. " +
7979
"💡 AI CLIENT TIP: Always close sessions when finished - it's good resource management!",
8080
InputSchema = new
8181
{
8282
type = "object",
8383
properties = new
8484
{
85-
sessionId = new { type = "string", description = "🚨 REQUIRED: Session ID that you EXTRACTED from nexus_open_dump response JSON. Use the EXACT value (e.g., 'sess-000001-abc12345')" }
85+
sessionId = new { type = "string", description = "🚨 REQUIRED: Session ID that you EXTRACTED from nexus_open_dump_analyze_session response JSON. Use the EXACT value (e.g., 'sess-000001-abc12345')" }
8686
},
8787
required = new[] { "sessionId" }
8888
}
8989
};
9090
}
9191

9292

93-
private static McpToolSchema CreateNexusExecDebuggerCommandAsyncTool()
93+
private static McpToolSchema CreateNexusDumpAnalyzeSessionAsyncCommandTool()
9494
{
9595
return new McpToolSchema
9696
{
97-
Name = "nexus_exec_debugger_command_async",
97+
Name = "nexus_dump_analyze_session_async_command",
9898
Description = "⚡ STEP 2 - EXECUTE COMMANDS: Run debugger commands like '!analyze -v', 'k', 'lm', 'dt', etc. " +
9999
"🚨 ASYNC WORKFLOW - READ CAREFULLY: " +
100100
"1️⃣ This command ONLY QUEUES the command and returns a commandId " +
101101
"2️⃣ It does NOT return the actual debugger output! " +
102-
"3️⃣ You MUST call nexus_debugger_command_status(commandId) to get results " +
102+
"3️⃣ You MUST call nexus_dump_analyze_session_async_command_status(commandId) to get results " +
103103
"4️⃣ Commands execute asynchronously in background queue " +
104-
"⏰ POLLING REQUIRED: Check nexus_debugger_command_status EVERY 3-5 SECONDS until status is 'completed' " +
105-
"🔄 EXACT WORKFLOW: nexus_exec_debugger_command_async → GET commandId → nexus_debugger_command_status(commandId) → REPEAT until complete " +
106-
"🎯 MANDATORY sessionId: You MUST include the sessionId from nexus_open_dump response! " +
104+
"⏰ POLLING REQUIRED: Check nexus_dump_analyze_session_async_command_status EVERY 3-5 SECONDS until status is 'completed' " +
105+
"🔄 EXACT WORKFLOW: nexus_dump_analyze_session_async_command → GET commandId → nexus_dump_analyze_session_async_command_status(commandId) → REPEAT until complete " +
106+
"🎯 MANDATORY sessionId: You MUST include the sessionId from nexus_open_dump_analyze_session response! " +
107107
"❌ MISSING sessionId = ERROR: This command will FAIL without a valid sessionId parameter! " +
108-
"📝 HOW TO GET sessionId: Call nexus_open_dump first, extract 'sessionId' from response JSON, then use it here " +
108+
"📝 HOW TO GET sessionId: Call nexus_open_dump_analyze_session first, extract 'sessionId' from response JSON, then use it here " +
109109
"💡 COMMON COMMANDS: " +
110110
"• '!analyze -v' - Detailed crash analysis " +
111111
"• 'k' - Call stack " +
@@ -118,7 +118,7 @@ private static McpToolSchema CreateNexusExecDebuggerCommandAsyncTool()
118118
properties = new
119119
{
120120
command = new { type = "string", description = "WinDbg/CDB command like '!analyze -v', 'k', 'lm', etc." },
121-
sessionId = new { type = "string", description = "🚨 REQUIRED: Session ID that you EXTRACTED from nexus_open_dump response JSON. This must be the EXACT value from the 'sessionId' field (e.g., 'sess-000001-abc12345'). DO NOT make up your own values!" }
121+
sessionId = new { type = "string", description = "🚨 REQUIRED: Session ID that you EXTRACTED from nexus_open_dump_analyze_session response JSON. This must be the EXACT value from the 'sessionId' field (e.g., 'sess-000001-abc12345'). DO NOT make up your own values!" }
122122
},
123123
required = new[] { "command", "sessionId" }
124124
}
@@ -127,25 +127,27 @@ private static McpToolSchema CreateNexusExecDebuggerCommandAsyncTool()
127127

128128

129129

130-
private static McpToolSchema CreateNexusDebuggerCommandStatusTool()
130+
private static McpToolSchema CreateNexusDumpAnalyzeSessionAsyncCommandStatusTool()
131131
{
132132
return new McpToolSchema
133133
{
134-
Name = "nexus_debugger_command_status",
134+
Name = "nexus_dump_analyze_session_async_command_status",
135135
Description = "📋 STEP 3 - GET RESULTS: Retrieve the output from a previously queued command. " +
136136
"This is the ONLY way to get actual debugger command results! " +
137+
"🚨 WORKFLOW DEPENDENCY: You can ONLY call this AFTER calling nexus_dump_analyze_session_async_command! " +
138+
"🔄 REQUIRED SEQUENCE: nexus_open_dump_analyze_session → nexus_dump_analyze_session_async_command → nexus_dump_analyze_session_async_command_status " +
137139
"📊 STATUS FLOW: queued → executing → completed " +
138140
"✅ When status='completed', the 'result' field contains the debugger output. " +
139141
"⏳ If status='executing' or 'queued', wait 3-5 seconds and call this again! " +
140142
"🔄 KEEP POLLING: Call this repeatedly every 3-5 seconds until status='completed' " +
141-
"❌ NEVER GIVE UP: If status is not 'completed', you MUST try again later! " +
143+
"❌ NEVER SKIP STEPS: You cannot make up commandId values or skip nexus_dump_analyze_session_async_command! " +
142144
"💡 SMART TIP: Listen for notifications/commandStatus to know when to check instead of polling constantly.",
143145
InputSchema = new
144146
{
145147
type = "object",
146148
properties = new
147149
{
148-
commandId = new { type = "string", description = "The commandId returned by nexus_exec_debugger_command_async" }
150+
commandId = new { type = "string", description = "🚨 REQUIRED: The EXACT commandId that was returned by nexus_dump_analyze_session_async_command. Format: 'cmd-sess-XXXXXX-YYYYYYYY-ZZZZ'. DO NOT make up your own values!" }
149151
},
150152
required = new[] { "commandId" }
151153
}

mcp_nexus/Protocol/McpToolExecutionService.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ public async Task<object> ExecuteTool(string toolName, JsonElement arguments)
1717
{
1818
return toolName switch
1919
{
20-
"nexus_open_dump" => await ExecuteOpenWindbgDump(arguments),
21-
"nexus_close_dump" => await ExecuteCloseWindbgDump(arguments),
22-
"nexus_exec_debugger_command_async" => await ExecuteRunWindbgCmdAsync(arguments),
23-
"nexus_debugger_command_status" => await ExecuteGetCommandStatus(arguments),
20+
"nexus_open_dump_analyze_session" => await ExecuteOpenWindbgDump(arguments),
21+
"nexus_close_dump_analyze_session" => await ExecuteCloseWindbgDump(arguments),
22+
"nexus_dump_analyze_session_async_command" => await ExecuteRunWindbgCmdAsync(arguments),
23+
"nexus_dump_analyze_session_async_command_status" => await ExecuteGetCommandStatus(arguments),
2424
_ => throw new McpToolException(-32602, $"Unknown tool: {toolName}")
2525
};
2626
}
@@ -48,7 +48,7 @@ private async Task<object> ExecuteOpenWindbgDump(JsonElement arguments)
4848
"💡 EXAMPLE: {\"dumpPath\": \"C:\\\\path\\\\to\\\\crash.dmp\"}");
4949

5050
var symbolsPath = GetOptionalStringArgument(arguments, "symbolsPath");
51-
var result = await sessionAwareWindbgTool.nexus_open_dump(dumpPath, symbolsPath);
51+
var result = await sessionAwareWindbgTool.nexus_open_dump_analyze_session(dumpPath, symbolsPath);
5252

5353
// Return the structured response object directly
5454
return result;
@@ -66,7 +66,7 @@ private async Task<object> ExecuteCloseWindbgDump(JsonElement arguments)
6666

6767
logger.LogInformation("Manual session closure requested for session: {SessionId}", sessionId);
6868

69-
var result = await sessionAwareWindbgTool.nexus_close_dump(sessionId);
69+
var result = await sessionAwareWindbgTool.nexus_close_dump_analyze_session(sessionId);
7070
return result;
7171
}
7272

@@ -96,7 +96,7 @@ private async Task<object> ExecuteRunWindbgCmdAsync(JsonElement arguments)
9696

9797
try
9898
{
99-
var result = await sessionAwareWindbgTool.nexus_exec_debugger_command_async(sessionId, command);
99+
var result = await sessionAwareWindbgTool.nexus_dump_analyze_session_async_command(sessionId, command);
100100
return result;
101101
}
102102
catch (Exception ex)
@@ -121,7 +121,7 @@ private async Task<object> ExecuteGetCommandStatus(JsonElement arguments)
121121

122122
try
123123
{
124-
var result = await sessionAwareWindbgTool.nexus_debugger_command_status(commandId);
124+
var result = await sessionAwareWindbgTool.nexus_dump_analyze_session_async_command_status(commandId);
125125
// Return the structured response object directly
126126
return result;
127127
}

mcp_nexus/Session/Models/SessionModels.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ public class SessionContext
118118
/// <summary>Human-readable session description</summary>
119119
public string Description { get; set; } = string.Empty;
120120

121+
/// <summary>Path to the dump file being debugged</summary>
122+
public string? DumpPath { get; set; }
123+
121124
/// <summary>Session creation time</summary>
122125
public DateTime CreatedAt { get; set; }
123126

mcp_nexus/Session/ThreadSafeSessionManager.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ public SessionContext GetSessionContext(string sessionId)
343343
{
344344
SessionId = sessionId,
345345
Description = $"Debugging session for {Path.GetFileName(session.DumpPath ?? "Unknown")}",
346+
DumpPath = session.DumpPath,
346347
CreatedAt = session.CreatedAt,
347348
LastActivity = session.LastActivity,
348349
Status = session.Status.ToString(),

0 commit comments

Comments
 (0)