Skip to content

Commit d24a4cc

Browse files
Fixes the field names
1 parent a0bbc53 commit d24a4cc

File tree

7 files changed

+62
-179
lines changed

7 files changed

+62
-179
lines changed

TEST_NOTIFICATIONS.md

Lines changed: 0 additions & 122 deletions
This file was deleted.

mcp_nexus/Controllers/McpController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public class McpController(McpProtocolService mcpProtocolService, ILogger<McpCon
1919
private static readonly JsonSerializerOptions s_jsonOptions = new()
2020
{
2121
WriteIndented = true,
22-
PropertyNamingPolicy = JsonNamingPolicy.CamelCase
22+
PropertyNamingPolicy = null // Don't change property names - MCP protocol requires exact field names like 'jsonrpc'
2323
};
2424
[HttpPost]
2525
public async Task<IActionResult> HandleMcpRequest()

mcp_nexus/Models/McpModels.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,19 @@ public class McpSuccessResponse
3939
{
4040
[JsonPropertyName("jsonrpc")]
4141
public string JsonRpc { get; set; } = "2.0";
42+
[JsonPropertyName("id")]
4243
public int Id { get; set; }
44+
[JsonPropertyName("result")]
4345
public object? Result { get; set; }
4446
}
4547

4648
public class McpErrorResponse
4749
{
4850
[JsonPropertyName("jsonrpc")]
4951
public string JsonRpc { get; set; } = "2.0";
52+
[JsonPropertyName("id")]
5053
public int Id { get; set; }
54+
[JsonPropertyName("error")]
5155
public McpError Error { get; set; } = new();
5256
}
5357

mcp_nexus/Protocol/McpProtocolService.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ public async Task<object> ProcessRequest(JsonElement requestElement)
4949
var request = new McpRequest
5050
{
5151
Method = methodProperty.GetString() ?? string.Empty,
52-
Id = requestElement.TryGetProperty("id", out var idProperty) && idProperty.ValueKind == JsonValueKind.Number
53-
? idProperty.GetInt32() : 0
52+
Id = requestElement.TryGetProperty("id", out var idProperty)
53+
? (idProperty.ValueKind == JsonValueKind.Number ? idProperty.GetInt32() : 0)
54+
: 0
5455
};
5556

5657
if (requestElement.TryGetProperty("params", out var paramsProperty))
@@ -88,8 +89,8 @@ private object HandleInitialize()
8889
private object HandleNotificationInitialized()
8990
{
9091
m_logger.LogDebug("Received MCP initialization notification");
91-
// For notifications, we typically return an empty success response
92-
return new { };
92+
// Notifications should not return responses according to JSON-RPC spec
93+
return new { }; // TODO: Consider if this should return null for true notification handling
9394
}
9495

9596
private object HandleNotificationCancelled(JsonElement? paramsElement)

mcp_nexus/Protocol/McpToolDefinitionService.cs

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,18 @@ private static McpToolSchema CreateNexusOpenDumpAnalyzeSessionTool()
4141
return new McpToolSchema
4242
{
4343
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. " +
45-
"🚨 CRITICAL RETURN VALUE: This command RETURNS a sessionId in the response JSON that you MUST EXTRACT and SAVE! " +
46-
"📤 RESPONSE CONTAINS: {\"sessionId\": \"sess-000001-abc12345\", ...} " +
47-
"📝 YOU MUST: Parse the response JSON and extract the 'sessionId' field value! " +
48-
"💾 SAVE IT: Store this sessionId string and use it in ALL subsequent commands! " +
49-
"🔄 MANDATORY WORKFLOW: " +
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!) " +
54-
"DO NOT MAKE UP sessionId VALUES! Use only what this command returns! " +
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!",
44+
Description = "STEP 1 - START HERE: Open and analyze a Windows crash dump file (.dmp) by creating a dedicated analysis session. " +
45+
"CRITICAL RETURN VALUE: This command RETURNS a sessionId in the response JSON that you MUST EXTRACT and SAVE! " +
46+
"RESPONSE CONTAINS: {\"sessionId\": \"sess-000001-abc12345\", ...} " +
47+
"YOU MUST: Parse the response JSON and extract the 'sessionId' field value! " +
48+
"SAVE IT: Store this sessionId string and use it in ALL subsequent commands! " +
49+
"MANDATORY WORKFLOW: " +
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!) " +
54+
"DO NOT MAKE UP sessionId VALUES! Use only what this command returns! " +
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",
@@ -72,17 +72,17 @@ private static McpToolSchema CreateNexusCloseDumpAnalyzeSessionTool()
7272
return new McpToolSchema
7373
{
7474
Name = "nexus_close_dump_analyze_session",
75-
Description = "🔚 STEP 4 - CLEANUP: Close the current crash dump analysis session and release resources. " +
76-
"EXPECTED BEHAVIOR: You SHOULD call this when done analyzing a dump file! " +
77-
"🧹 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_analyze_session again to analyze another dump. " +
79-
"💡 AI CLIENT TIP: Always close sessions when finished - it's good resource management!",
75+
Description = "STEP 4 - CLEANUP: Close the current crash dump analysis session and release resources. " +
76+
"EXPECTED BEHAVIOR: You SHOULD call this when done analyzing a dump file! " +
77+
"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_analyze_session again to analyze another dump. " +
79+
"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_analyze_session 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
}
@@ -95,30 +95,30 @@ private static McpToolSchema CreateNexusDumpAnalyzeSessionAsyncCommandTool()
9595
return new McpToolSchema
9696
{
9797
Name = "nexus_dump_analyze_session_async_command",
98-
Description = "STEP 2 - EXECUTE COMMANDS: Run debugger commands like '!analyze -v', 'k', 'lm', 'dt', etc. " +
99-
"🚨 ASYNC WORKFLOW - READ CAREFULLY: " +
100-
"1️⃣ This command ONLY QUEUES the command and returns a commandId " +
101-
"2️⃣ It does NOT return the actual debugger output! " +
102-
"3️⃣ You MUST call nexus_dump_analyze_session_async_command_status(commandId) to get results " +
103-
"4️⃣ Commands execute asynchronously in background queue " +
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! " +
107-
"MISSING sessionId = ERROR: This command will FAIL without a valid sessionId parameter! " +
108-
"📝 HOW TO GET sessionId: Call nexus_open_dump_analyze_session first, extract 'sessionId' from response JSON, then use it here " +
109-
"💡 COMMON COMMANDS: " +
98+
Description = "STEP 2 - EXECUTE COMMANDS: Run debugger commands like '!analyze -v', 'k', 'lm', 'dt', etc. " +
99+
"ASYNC WORKFLOW - READ CAREFULLY: " +
100+
"1. This command ONLY QUEUES the command and returns a commandId " +
101+
"2. It does NOT return the actual debugger output! " +
102+
"3. You MUST call nexus_dump_analyze_session_async_command_status(commandId) to get results " +
103+
"4. Commands execute asynchronously in background queue " +
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! " +
107+
"MISSING sessionId = ERROR: This command will FAIL without a valid sessionId parameter! " +
108+
"HOW TO GET sessionId: Call nexus_open_dump_analyze_session first, extract 'sessionId' from response JSON, then use it here " +
109+
"COMMON COMMANDS: " +
110110
"• '!analyze -v' - Detailed crash analysis " +
111111
"• 'k' - Call stack " +
112112
"• 'lm' - List loaded modules " +
113113
"• 'dt ModuleName!StructName' - Display type " +
114-
"📡 TIP: Listen for notifications/commandStatus to know when commands complete!",
114+
"TIP: Listen for notifications/commandStatus to know when commands complete!",
115115
InputSchema = new
116116
{
117117
type = "object",
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_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!" }
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
}
@@ -132,22 +132,22 @@ private static McpToolSchema CreateNexusDumpAnalyzeSessionAsyncCommandStatusTool
132132
return new McpToolSchema
133133
{
134134
Name = "nexus_dump_analyze_session_async_command_status",
135-
Description = "📋 STEP 3 - GET RESULTS: Retrieve the output from a previously queued command. " +
135+
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 " +
139-
"📊 STATUS FLOW: queued → executing → completed " +
140-
"When status='completed', the 'result' field contains the debugger output. " +
141-
"If status='executing' or 'queued', wait 3-5 seconds and call this again! " +
142-
"🔄 KEEP POLLING: Call this repeatedly every 3-5 seconds until status='completed' " +
143-
"NEVER SKIP STEPS: You cannot make up commandId values or skip nexus_dump_analyze_session_async_command! " +
144-
"💡 SMART TIP: Listen for notifications/commandStatus to know when to check instead of polling constantly.",
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 " +
139+
"STATUS FLOW: queued → executing → completed " +
140+
"When status='completed', the 'result' field contains the debugger output. " +
141+
"If status='executing' or 'queued', wait 3-5 seconds and call this again! " +
142+
"KEEP POLLING: Call this repeatedly every 3-5 seconds until status='completed' " +
143+
"NEVER SKIP STEPS: You cannot make up commandId values or skip nexus_dump_analyze_session_async_command! " +
144+
"SMART TIP: Listen for notifications/commandStatus to know when to check instead of polling constantly.",
145145
InputSchema = new
146146
{
147147
type = "object",
148148
properties = new
149149
{
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!" }
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!" }
151151
},
152152
required = new[] { "commandId" }
153153
}

0 commit comments

Comments
 (0)