Skip to content

Commit 1522fed

Browse files
Unify reporting
1 parent d24a4cc commit 1522fed

File tree

4 files changed

+346
-48
lines changed

4 files changed

+346
-48
lines changed

mcp_nexus/Models/McpModels.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,21 @@ public class McpRequest
2222
public string JsonRpc { get; set; } = "2.0";
2323
[JsonPropertyName("method")]
2424
public string Method { get; set; } = string.Empty;
25+
[JsonPropertyName("params")]
2526
public JsonElement? Params { get; set; }
27+
[JsonPropertyName("id")]
2628
public int Id { get; set; }
2729
}
2830

2931
public class McpResponse
3032
{
3133
[JsonPropertyName("jsonrpc")]
3234
public string JsonRpc { get; set; } = "2.0";
35+
[JsonPropertyName("id")]
3336
public int Id { get; set; }
37+
[JsonPropertyName("result")]
3438
public object? Result { get; set; }
39+
[JsonPropertyName("error")]
3540
public McpError? Error { get; set; }
3641
}
3742

@@ -57,58 +62,77 @@ public class McpErrorResponse
5762

5863
public class McpError
5964
{
65+
[JsonPropertyName("code")]
6066
public int Code { get; set; }
67+
[JsonPropertyName("message")]
6168
public string Message { get; set; } = string.Empty;
69+
[JsonPropertyName("data")]
6270
public object? Data { get; set; }
6371
}
6472

6573
public class McpToolSchema
6674
{
75+
[JsonPropertyName("name")]
6776
public string Name { get; set; } = string.Empty;
77+
[JsonPropertyName("description")]
6878
public string Description { get; set; } = string.Empty;
79+
[JsonPropertyName("inputSchema")]
6980
public object InputSchema { get; set; } = new { };
7081
}
7182

7283
public class McpToolResult
7384
{
85+
[JsonPropertyName("content")]
7486
public McpContent[] Content { get; set; } = Array.Empty<McpContent>();
7587
}
7688

7789
public class McpContent
7890
{
91+
[JsonPropertyName("type")]
7992
public string Type { get; set; } = "text";
93+
[JsonPropertyName("text")]
8094
public string Text { get; set; } = string.Empty;
8195
}
8296

8397
public class McpInitializeResult
8498
{
99+
[JsonPropertyName("protocolVersion")]
85100
public string ProtocolVersion { get; set; } = "2025-06-18";
101+
[JsonPropertyName("capabilities")]
86102
public McpCapabilities Capabilities { get; set; } = new();
103+
[JsonPropertyName("serverInfo")]
87104
public McpServerDetails ServerInfo { get; set; } = new();
88105
}
89106

90107
public class McpToolsListResult
91108
{
109+
[JsonPropertyName("tools")]
92110
public McpToolSchema[] Tools { get; set; } = Array.Empty<McpToolSchema>();
93111
}
94112

95113
public class McpServerInfoResponse
96114
{
97115
[JsonPropertyName("jsonrpc")]
98116
public string JsonRpc { get; set; } = "2.0";
117+
[JsonPropertyName("result")]
99118
public McpServerInfoResult Result { get; set; } = new();
100119
}
101120

102121
public class McpServerInfoResult
103122
{
123+
[JsonPropertyName("protocolVersion")]
104124
public string ProtocolVersion { get; set; } = "2025-06-18";
125+
[JsonPropertyName("capabilities")]
105126
public McpCapabilities Capabilities { get; set; } = new();
127+
[JsonPropertyName("serverInfo")]
106128
public McpServerDetails ServerInfo { get; set; } = new();
107129
}
108130

109131
public class McpCapabilities
110132
{
133+
[JsonPropertyName("tools")]
111134
public object Tools { get; set; } = new { listChanged = true };
135+
[JsonPropertyName("notifications")]
112136
public object Notifications { get; set; } = new {
113137
// Standard MCP notifications
114138
tools = new { listChanged = true },
@@ -121,8 +145,11 @@ public class McpCapabilities
121145

122146
public class McpServerDetails
123147
{
148+
[JsonPropertyName("name")]
124149
public string Name { get; set; } = "mcp-nexus";
150+
[JsonPropertyName("version")]
125151
public string Version { get; set; } = VersionHelper.GetFileVersion();
152+
[JsonPropertyName("description")]
126153
public string Description { get; set; } = "Windows Debugging Tools MCP Server with real-time command notifications. " +
127154
"Provides asynchronous debugging commands with live status updates via server-initiated notifications. " +
128155
"Supports notifications/commandStatus (execution progress), notifications/commandHeartbeat (long-running command updates), " +

mcp_nexus/Protocol/McpToolDefinitionService.cs

Lines changed: 6 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using mcp_nexus.Models;
22
using mcp_nexus.Notifications;
3+
using mcp_nexus.Tools;
34

45
namespace mcp_nexus.Protocol
56
{
@@ -41,18 +42,7 @@ private static McpToolSchema CreateNexusOpenDumpAnalyzeSessionTool()
4142
return new McpToolSchema
4243
{
4344
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!",
45+
Description = System.Text.Json.JsonSerializer.Serialize(SessionAwareWindbgTool.TOOL_USAGE_EXPLANATION, new System.Text.Json.JsonSerializerOptions { WriteIndented = true }),
5646
InputSchema = new
5747
{
5848
type = "object",
@@ -72,11 +62,7 @@ private static McpToolSchema CreateNexusCloseDumpAnalyzeSessionTool()
7262
return new McpToolSchema
7363
{
7464
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!",
65+
Description = System.Text.Json.JsonSerializer.Serialize(SessionAwareWindbgTool.TOOL_USAGE_EXPLANATION, new System.Text.Json.JsonSerializerOptions { WriteIndented = true }),
8066
InputSchema = new
8167
{
8268
type = "object",
@@ -94,24 +80,8 @@ private static McpToolSchema CreateNexusDumpAnalyzeSessionAsyncCommandTool()
9480
{
9581
return new McpToolSchema
9682
{
97-
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: " +
110-
"• '!analyze -v' - Detailed crash analysis " +
111-
"• 'k' - Call stack " +
112-
"• 'lm' - List loaded modules " +
113-
"• 'dt ModuleName!StructName' - Display type " +
114-
"TIP: Listen for notifications/commandStatus to know when commands complete!",
83+
Name = "nexus_dump_analyze_session_async_command",
84+
Description = System.Text.Json.JsonSerializer.Serialize(SessionAwareWindbgTool.TOOL_USAGE_EXPLANATION, new System.Text.Json.JsonSerializerOptions { WriteIndented = true }),
11585
InputSchema = new
11686
{
11787
type = "object",
@@ -132,16 +102,7 @@ private static McpToolSchema CreateNexusDumpAnalyzeSessionAsyncCommandStatusTool
132102
return new McpToolSchema
133103
{
134104
Name = "nexus_dump_analyze_session_async_command_status",
135-
Description = "STEP 3 - GET RESULTS: Retrieve the output from a previously queued command. " +
136-
"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.",
105+
Description = System.Text.Json.JsonSerializer.Serialize(SessionAwareWindbgTool.TOOL_USAGE_EXPLANATION, new System.Text.Json.JsonSerializerOptions { WriteIndented = true }),
145106
InputSchema = new
146107
{
147108
type = "object",

mcp_nexus/Tools/SessionAwareWindbgTool.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ namespace mcp_nexus.Tools
2323
[McpServerToolType]
2424
public class SessionAwareWindbgTool(ILogger<SessionAwareWindbgTool> logger, ISessionManager sessionManager)
2525
{
26-
private static readonly object TOOL_USAGE_EXPLANATION = "";/*new
26+
public static readonly object TOOL_USAGE_EXPLANATION = new
2727
{
28-
title = "TOOL USAGE",
28+
title = "Tool usage",
2929
description = "Explaining how to use the Nexus MCP server.",
3030
general_notes = new[]
3131
{
@@ -69,7 +69,7 @@ public class SessionAwareWindbgTool(ILogger<SessionAwareWindbgTool> logger, ISes
6969
note = (string?)null
7070
}
7171
}
72-
};*/
72+
};
7373

7474
/// <summary>
7575
/// Session-aware response wrapper for AI client guidance

0 commit comments

Comments
 (0)