|
2 | 2 | using mcp_nexus.Models; |
3 | 3 | using mcp_nexus.Session; |
4 | 4 | using mcp_nexus.CommandQueue; |
| 5 | +using mcp_nexus.Tools; |
5 | 6 |
|
6 | 7 | namespace mcp_nexus.Protocol |
7 | 8 | { |
@@ -63,25 +64,18 @@ private static McpResource[] GetDocumentationResources() |
63 | 64 | { |
64 | 65 | return |
65 | 66 | [ |
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 | | - }, |
73 | 67 | new McpResource |
74 | 68 | { |
75 | 69 | Uri = "debugging://docs/debugging-workflows", |
76 | | - Name = "Debugging Workflows", |
| 70 | + Name = "Crash Analysis Workflows", |
77 | 71 | Description = "Common debugging patterns and step-by-step analysis workflows", |
78 | 72 | MimeType = "application/json" |
79 | 73 | }, |
80 | 74 | new McpResource |
81 | 75 | { |
82 | 76 | 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", |
85 | 79 | MimeType = "application/json" |
86 | 80 | } |
87 | 81 | ]; |
@@ -471,60 +465,132 @@ private static string GetDebuggingWorkflowsDocumentation() |
471 | 465 | { |
472 | 466 | var workflows = new |
473 | 467 | { |
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", |
476 | 470 | workflows = new[] |
477 | 471 | { |
478 | 472 | new |
479 | 473 | { |
480 | | - name = "Crash Analysis", |
| 474 | + name = "Basic Crash Analysis", |
| 475 | + description = "Essential commands for initial crash investigation", |
481 | 476 | steps = new[] |
482 | 477 | { |
483 | 478 | "!analyze -v", |
484 | 479 | "!threads", |
485 | 480 | "~*k", |
486 | | - "!locks" |
487 | | - } |
| 481 | + "!locks", |
| 482 | + "!runaway" |
| 483 | + }, |
| 484 | + expectedOutcome = "Identify the faulting thread, exception type, and basic crash context" |
488 | 485 | }, |
489 | 486 | new |
490 | 487 | { |
491 | | - name = "Memory Leak Investigation", |
| 488 | + name = "Memory Corruption Analysis", |
| 489 | + description = "Investigate memory-related crashes and corruption", |
492 | 490 | steps = new[] |
493 | 491 | { |
| 492 | + "!analyze -v", |
494 | 493 | "!heap -stat", |
495 | 494 | "!heap -flt s <size>", |
496 | 495 | "!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 | + }, |
514 | 516 | new |
515 | 517 | { |
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" |
518 | 559 | }, |
519 | 560 | new |
520 | 561 | { |
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" |
523 | 574 | } |
| 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" |
524 | 584 | } |
525 | 585 | }; |
526 | 586 |
|
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); |
528 | 594 | } |
529 | 595 | } |
530 | 596 | } |
0 commit comments