|
| 1 | +# MCP Prompts Contract |
| 2 | + |
| 3 | +**Date**: 2026-03-10 |
| 4 | +**Branch**: `012-mcp-integration-primitives` |
| 5 | +**Registration**: `builder.Services.AddMcpServer().WithPrompts<ProjGraphPrompts>()` |
| 6 | +**SDK type**: `[McpServerPromptType]` / `[McpServerPrompt]` |
| 7 | + |
| 8 | +--- |
| 9 | + |
| 10 | +## Prompt: `architecture_review` |
| 11 | + |
| 12 | +**Description**: Guides an LLM through a comprehensive architecture review of a .NET solution, including dependency visualization and project metrics. |
| 13 | + |
| 14 | +### Arguments |
| 15 | + |
| 16 | +| Name | Type | Required | Description | |
| 17 | +|------|------|----------|-----------------------------------------------------------------------------------------------| |
| 18 | +| `path` | string | yes | Absolute (or root-relative) path to the solution file (.sln, .slnx) or project file (.csproj) | |
| 19 | + |
| 20 | +### Returned Messages |
| 21 | + |
| 22 | +**Message 1 — User role**: |
| 23 | + |
| 24 | +```none |
| 25 | +Please perform a comprehensive architecture review of the .NET solution at: {path} |
| 26 | +
|
| 27 | +Use the following steps in order: |
| 28 | +
|
| 29 | +1. Call `get_project_graph` with path="{path}" to generate the dependency graph. |
| 30 | +2. Call `get_project_stats` with path="{path}" to retrieve architectural metrics. |
| 31 | +3. Analyze the results and provide: |
| 32 | + - A summary of the overall architecture and structure |
| 33 | + - Projects with the most dependencies (hotspots) |
| 34 | + - Any suspicious dependency patterns (deep chains, violations of layering) |
| 35 | + - A health assessment: what is well-structured and what could be improved |
| 36 | + - Specific actionable recommendations |
| 37 | +``` |
| 38 | + |
| 39 | +**Message 2 — Assistant role (pre-fill)**: |
| 40 | + |
| 41 | +```none |
| 42 | +I'll analyze the .NET solution architecture step by step. Starting with the dependency graph and metrics. |
| 43 | +``` |
| 44 | + |
| 45 | +--- |
| 46 | + |
| 47 | +## Prompt: `dependency_analysis` |
| 48 | + |
| 49 | +**Description**: Guides an LLM to analyze dependency depth, identify hotspot projects, and detect potential circular dependencies in a .NET solution. |
| 50 | + |
| 51 | +### Arguments |
| 52 | + |
| 53 | +| Name | Type | Required | Default | Description | |
| 54 | +|------|------|----------|--------|-------------| |
| 55 | +| `path` | string | yes | — | Absolute path to the solution or project file | |
| 56 | +| `topN` | string | no | `"5"` | Number of top hotspot projects to highlight | |
| 57 | + |
| 58 | +### Returned Messages |
| 59 | + |
| 60 | +**Message 1 — User role**: |
| 61 | + |
| 62 | +```none |
| 63 | +Analyze the dependency structure of the .NET solution at: {path} |
| 64 | +
|
| 65 | +Steps: |
| 66 | +1. Call `get_project_graph` with path="{path}" to visualize the dependency graph. |
| 67 | +2. Call `get_project_stats` with path="{path}" and topN={topN} to retrieve depth statistics and top {topN} most-referenced projects. |
| 68 | +3. Report: |
| 69 | + - Dependency depth distribution (min, max, average) |
| 70 | + - Top {topN} most-referenced (hotspot) projects and why they matter |
| 71 | + - Any detected circular dependencies — list them explicitly |
| 72 | + - Recommendations to reduce coupling or break cycles |
| 73 | +``` |
| 74 | + |
| 75 | +**Message 2 — Assistant role**: |
| 76 | + |
| 77 | +```none |
| 78 | +I'll analyze the dependency structure and identify hotspots and cycles. |
| 79 | +``` |
| 80 | + |
| 81 | +--- |
| 82 | + |
| 83 | +## Prompt: `database_schema_review` |
| 84 | + |
| 85 | +**Description**: Guides an LLM through reviewing an Entity Framework Core database schema for design quality, relationships, and potential issues. |
| 86 | + |
| 87 | +### Arguments |
| 88 | + |
| 89 | +| Name | Type | Required | Description | |
| 90 | +|------|------|----------|------------------------------------------------------------------------------------| |
| 91 | +| `path` | string | yes | Absolute path to a .cs file containing a `DbContext` or `ModelSnapshot` | |
| 92 | +| `contextName` | string | no | Specific DbContext or ModelSnapshot class name to use if multiple exist in the file | |
| 93 | + |
| 94 | +### Returned Messages |
| 95 | + |
| 96 | +**Message 1 — User role**: |
| 97 | + |
| 98 | +```none |
| 99 | +Please review the Entity Framework Core database schema defined in: {path}{contextName_clause} |
| 100 | +
|
| 101 | +Steps: |
| 102 | +1. Call `get_erd` with path="{path}"{context_arg} to generate the Entity Relationship Diagram. |
| 103 | +2. Analyze the ERD and provide: |
| 104 | + - An overview of the entity model (count, main entities, key relationships) |
| 105 | + - Assessment of relationship cardinality (one-to-many, many-to-many, etc.) |
| 106 | + - Any potential design issues: missing indexes, over-normalized or under-normalized tables, overly wide entities |
| 107 | + - Naming consistency review |
| 108 | + - Recommendations for improving the schema design |
| 109 | +``` |
| 110 | + |
| 111 | +Where `{contextName_clause}` = `" (using context: {contextName})"` if contextName is provided, else empty. |
| 112 | +Where `{context_arg}` = `, contextName="{contextName}"` if contextName is provided, else empty. |
| 113 | + |
| 114 | +**Message 2 — Assistant role**: |
| 115 | + |
| 116 | +```none |
| 117 | +I'll review the Entity Framework Core database schema and identify design issues and improvements. |
| 118 | +``` |
| 119 | + |
| 120 | +--- |
| 121 | + |
| 122 | +## Prompt: `class_structure_review` |
| 123 | + |
| 124 | +**Description**: Guides an LLM through reviewing C# class hierarchies, inheritance patterns, and overall design structure. |
| 125 | + |
| 126 | +### Arguments |
| 127 | + |
| 128 | +| Name | Type | Required | Description | |
| 129 | +|------|------|----------|-----------------------------------------------------| |
| 130 | +| `path` | string | yes | Absolute path to a .cs file or directory to analyze | |
| 131 | + |
| 132 | +### Returned Messages |
| 133 | + |
| 134 | +**Message 1 — User role**: |
| 135 | + |
| 136 | +```none |
| 137 | +Please review the class structure and design of the C# code at: {path} |
| 138 | +
|
| 139 | +Steps: |
| 140 | +1. Call `get_class_diagram` with path="{path}" and options including includeInheritance=true and includeDependencies=true to generate the class diagram. |
| 141 | +2. Analyze the diagram and provide: |
| 142 | + - Overview of the class hierarchy (depth, breadth, key types) |
| 143 | + - Assessment of inheritance vs. composition usage |
| 144 | + - Identification of potential design issues: god classes, deep inheritance chains, circular dependencies between classes |
| 145 | + - Interface segregation: are interfaces focused and cohesive? |
| 146 | + - Recommendations to improve the design (e.g., extract interfaces, favor composition) |
| 147 | +``` |
| 148 | + |
| 149 | +**Message 2 — Assistant role**: |
| 150 | + |
| 151 | +```none |
| 152 | +I'll review the class structure and design patterns in the provided C# code. |
| 153 | +``` |
| 154 | + |
| 155 | +--- |
| 156 | + |
| 157 | +## Implementation Notes |
| 158 | + |
| 159 | +- Class: `ProjGraphPrompts` in `src/ProjGraph.Mcp/ProjGraphPrompts.cs` |
| 160 | +- Attribute: `[McpServerPromptType]` on class, `[McpServerPrompt]` on each method |
| 161 | +- Return type: `IEnumerable<ChatMessage>` (from `Microsoft.Extensions.AI`) |
| 162 | +- All methods are `static` (no DI dependencies — prompts are pure functions of their arguments) |
| 163 | +- Parameter binding: `string path`, `string? contextName = null`, `string topN = "5"` (MCP prompt args are always strings) |
| 164 | +- Registration: `.WithPrompts<ProjGraphPrompts>()` in `Program.cs` |
0 commit comments