Skip to content

Commit e7752bc

Browse files
Rework the resouces
1 parent e7a6efb commit e7752bc

File tree

2 files changed

+106
-39
lines changed

2 files changed

+106
-39
lines changed

mcp_nexus/Protocol/McpResourceService.cs

Lines changed: 104 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using mcp_nexus.Models;
33
using mcp_nexus.Session;
44
using mcp_nexus.CommandQueue;
5+
using mcp_nexus.Tools;
56

67
namespace mcp_nexus.Protocol
78
{
@@ -63,25 +64,18 @@ private static McpResource[] GetDocumentationResources()
6364
{
6465
return
6566
[
66-
new McpResource
67-
{
68-
Uri = "debugging://docs/windbg-commands",
69-
Name = "WinDBG Command Reference",
70-
Description = "Comprehensive reference of available WinDBG commands with examples and usage",
71-
MimeType = "application/json"
72-
},
7367
new McpResource
7468
{
7569
Uri = "debugging://docs/debugging-workflows",
76-
Name = "Debugging Workflows",
70+
Name = "Crash Analysis Workflows",
7771
Description = "Common debugging patterns and step-by-step analysis workflows",
7872
MimeType = "application/json"
7973
},
8074
new McpResource
8175
{
8276
Uri = "debugging://docs/troubleshooting",
83-
Name = "Troubleshooting Guide",
84-
Description = "Common issues and solutions for debugging Windows applications",
77+
Name = "Tool usage",
78+
Description = "Essential tool usage information for MCP Nexus server",
8579
MimeType = "application/json"
8680
}
8781
];
@@ -471,60 +465,132 @@ private static string GetDebuggingWorkflowsDocumentation()
471465
{
472466
var workflows = new
473467
{
474-
title = "Debugging Workflows",
475-
description = "Common debugging patterns and step-by-step analysis workflows",
468+
title = "Crash Analysis Workflows",
469+
description = "Comprehensive step-by-step analysis workflows for Windows crash dump investigation",
476470
workflows = new[]
477471
{
478472
new
479473
{
480-
name = "Crash Analysis",
474+
name = "Basic Crash Analysis",
475+
description = "Essential commands for initial crash investigation",
481476
steps = new[]
482477
{
483478
"!analyze -v",
484479
"!threads",
485480
"~*k",
486-
"!locks"
487-
}
481+
"!locks",
482+
"!runaway"
483+
},
484+
expectedOutcome = "Identify the faulting thread, exception type, and basic crash context"
488485
},
489486
new
490487
{
491-
name = "Memory Leak Investigation",
488+
name = "Memory Corruption Analysis",
489+
description = "Investigate memory-related crashes and corruption",
492490
steps = new[]
493491
{
492+
"!analyze -v",
494493
"!heap -stat",
495494
"!heap -flt s <size>",
496495
"!heap -p -a <address>",
497-
"!gchandles"
498-
}
499-
}
500-
}
501-
};
502-
503-
return JsonSerializer.Serialize(workflows, s_jsonOptions);
504-
}
505-
506-
private static string GetTroubleshootingDocumentation()
507-
{
508-
var troubleshooting = new
509-
{
510-
title = "Troubleshooting Guide",
511-
description = "Common issues and solutions for debugging Windows applications",
512-
issues = new[]
513-
{
496+
"!address <address>",
497+
"!vprot <address>"
498+
},
499+
expectedOutcome = "Identify heap corruption, invalid memory access, or buffer overflows"
500+
},
501+
new
502+
{
503+
name = "Thread Deadlock Investigation",
504+
description = "Analyze thread synchronization issues and deadlocks",
505+
steps = new[]
506+
{
507+
"!threads",
508+
"!locks",
509+
"!cs -l",
510+
"!cs -o <address>",
511+
"~*k",
512+
"!runaway"
513+
},
514+
expectedOutcome = "Identify deadlocked threads and synchronization objects"
515+
},
514516
new
515517
{
516-
problem = "Access Violation",
517-
solution = "Use !analyze -v to get automatic analysis, then examine the faulting thread with ~*k"
518+
name = "Exception Analysis",
519+
description = "Deep dive into exception handling and stack traces",
520+
steps = new[]
521+
{
522+
"!analyze -v",
523+
"!exception",
524+
"!peb",
525+
"!teb",
526+
"~*k",
527+
"!threads"
528+
},
529+
expectedOutcome = "Understand exception context, thread state, and call stack"
530+
},
531+
new
532+
{
533+
name = "Module and DLL Analysis",
534+
description = "Investigate loaded modules and potential DLL issues",
535+
steps = new[]
536+
{
537+
"lm",
538+
"lmv m <module>",
539+
"!lmi <module>",
540+
"!dh <module>",
541+
"!peb"
542+
},
543+
expectedOutcome = "Identify problematic modules, version mismatches, or loading issues"
544+
},
545+
new
546+
{
547+
name = "Performance and Resource Analysis",
548+
description = "Analyze performance issues and resource consumption",
549+
steps = new[]
550+
{
551+
"!runaway",
552+
"!threads",
553+
"!heap -stat",
554+
"!gchandles",
555+
"!handle",
556+
"!process 0 0"
557+
},
558+
expectedOutcome = "Identify resource leaks, high CPU usage, or memory consumption issues"
518559
},
519560
new
520561
{
521-
problem = "Deadlock",
522-
solution = "Use !locks to examine lock information and !threads to see thread states"
562+
name = "Network and I/O Analysis",
563+
description = "Investigate network-related crashes and I/O issues",
564+
steps = new[]
565+
{
566+
"!analyze -v",
567+
"!handle",
568+
"!object",
569+
"!irp",
570+
"!devobj",
571+
"!drvobj"
572+
},
573+
expectedOutcome = "Identify network stack issues, driver problems, or I/O failures"
523574
}
575+
},
576+
generalTips = new[]
577+
{
578+
"Always start with !analyze -v for automatic analysis",
579+
"Use ~*k to see all thread call stacks",
580+
"Check !runaway for threads consuming excessive CPU",
581+
"Examine !locks for synchronization issues",
582+
"Use !heap commands for memory-related problems",
583+
"Check loaded modules with lm for version issues"
524584
}
525585
};
526586

527-
return JsonSerializer.Serialize(troubleshooting, s_jsonOptions);
587+
return JsonSerializer.Serialize(workflows, s_jsonOptions);
588+
}
589+
590+
private static string GetTroubleshootingDocumentation()
591+
{
592+
// Return the actual toolusage content as the troubleshooting guide
593+
return JsonSerializer.Serialize(SessionAwareWindbgTool.TOOL_USAGE_EXPLANATION, s_jsonOptions);
528594
}
529595
}
530596
}

mcp_nexus/Tools/SessionAwareWindbgTool.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ public class SessionAwareWindbgTool(ILogger<SessionAwareWindbgTool> logger, ISes
3232
"Please get further details from the response and the tool listings of the MCP server.",
3333
"After opening an analyze session, WinDBG commands can be asynchronously executed.",
3434
"The result can be queried (regular polling) by the status API.",
35-
"Opening a session without executing commands will not have any effect."
35+
"Opening a session without executing commands will not have any effect.",
36+
"For comprehensive debugging workflows, access the 'Crash Analysis Workflow' resource via MCP resources."
3637
},
3738
tooling_steps = new[]
3839
{

0 commit comments

Comments
 (0)