Skip to content

Commit 3f76bfd

Browse files
Unify responses
1 parent ac75a11 commit 3f76bfd

File tree

4 files changed

+149
-224
lines changed

4 files changed

+149
-224
lines changed

mcp_nexus/Protocol/McpToolExecutionService.cs

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ private async Task<object> ExecuteOpenWindbgDump(JsonElement arguments)
4343

4444
var dumpPath = GetRequiredStringArgument(arguments, "dumpPath");
4545
if (dumpPath == null)
46-
throw new McpToolException(-32602, "❌ MISSING DUMP PATH: You must provide a 'dumpPath' parameter! " +
47-
"🔧 RECOVERY: Add 'dumpPath' parameter with full path to a .dmp file " +
48-
"💡 EXAMPLE: {\"dumpPath\": \"C:\\\\path\\\\to\\\\crash.dmp\"}");
46+
throw new McpToolException(-32602, "Missing required parameter: dumpPath");
4947

5048
var symbolsPath = GetOptionalStringArgument(arguments, "symbolsPath");
5149
var result = await sessionAwareWindbgTool.nexus_open_dump_analyze_session(dumpPath, symbolsPath);
@@ -60,9 +58,7 @@ private async Task<object> ExecuteCloseWindbgDump(JsonElement arguments)
6058
var sessionId = GetRequiredStringArgument(arguments, "sessionId");
6159

6260
if (sessionId == null)
63-
throw new McpToolException(-32602, "❌ MISSING SESSION ID: You must provide a 'sessionId' parameter! " +
64-
"🔧 RECOVERY: Include the sessionId from your nexus_open_dump response " +
65-
"💡 EXAMPLE: {\"sessionId\": \"sess-000001-abc12345\"}");
61+
throw new McpToolException(-32602, "Missing required parameter: sessionId");
6662

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

@@ -77,20 +73,10 @@ private async Task<object> ExecuteRunWindbgCmdAsync(JsonElement arguments)
7773
var sessionId = GetRequiredStringArgument(arguments, "sessionId");
7874

7975
if (command == null)
80-
throw new McpToolException(-32602, "❌ MISSING COMMAND: You must provide a 'command' parameter. " +
81-
"🔧 RECOVERY: Add 'command' parameter with a WinDbg command like '!analyze -v', 'k', 'lm', etc.");
76+
throw new McpToolException(-32602, "Missing required parameter: command");
8277

8378
if (sessionId == null)
84-
throw new McpToolException(-32602, "❌ MISSING SESSION ID: You must provide a 'sessionId' parameter! " +
85-
"🔧 STEP-BY-STEP RECOVERY: " +
86-
"1️⃣ FIRST: Call nexus_open_dump with a .dmp file path → this creates a debugging session " +
87-
"2️⃣ EXTRACT: Get the 'sessionId' value from the nexus_open_dump response JSON " +
88-
"3️⃣ RETRY: Call this command again with BOTH 'command' AND 'sessionId' parameters " +
89-
"4️⃣ REMEMBER: This command only returns a commandId, then call nexus_debugger_command_status(commandId) for actual results " +
90-
"💡 CORRECT USAGE EXAMPLE: {\"command\": \"!analyze -v\", \"sessionId\": \"sess-000001-abc12345\"} " +
91-
"🚨 ASYNC WORKFLOW: nexus_open_dump → nexus_exec_debugger_command_async → nexus_debugger_command_status " +
92-
"❓ WHY THIS ERROR: The AI client didn't extract sessionId from nexus_open_dump response or skipped calling nexus_open_dump entirely. " +
93-
"🎯 AI DEBUGGING TIP: Check your previous nexus_open_dump response for the sessionId field!");
79+
throw new McpToolException(-32602, "Missing required parameter: sessionId");
9480

9581
logger.LogDebug("Executing command '{Command}' for session '{SessionId}'", command, sessionId);
9682

@@ -111,11 +97,7 @@ private async Task<object> ExecuteGetCommandStatus(JsonElement arguments)
11197
// Get command status using session-aware implementation
11298
var commandId = GetRequiredStringArgument(arguments, "commandId");
11399
if (commandId == null)
114-
throw new McpToolException(-32602, "❌ MISSING COMMAND ID: You must provide a 'commandId' parameter! " +
115-
"🔧 RECOVERY: Add 'commandId' parameter from nexus_exec_debugger_command_async response " +
116-
"🚨 ASYNC WORKFLOW: nexus_exec_debugger_command_async returns commandId → use it here to get results " +
117-
"💡 EXAMPLE: {\"commandId\": \"cmd-12345-abc\"} " +
118-
"📡 This is how you get actual debugger command output!");
100+
throw new McpToolException(-32602, "Missing required parameter: commandId");
119101

120102
logger.LogDebug("Getting command status for commandId: {CommandId}", commandId);
121103

0 commit comments

Comments
 (0)