Skip to content

Commit 7a56109

Browse files
committed
feat: add cluster health check prompt
Signed-off-by: Rohit Patil <[email protected]>
1 parent adfd02e commit 7a56109

File tree

4 files changed

+850
-1
lines changed

4 files changed

+850
-1
lines changed

docs/PROMPTS.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,43 @@ content = "I'll retrieve and analyze the logs for you."
5757
### Argument Substitution
5858
Use `{{argument_name}}` placeholders in message content. The template engine replaces these with actual values when the prompt is called.
5959

60+
## Built-in Prompts
61+
62+
The Kubernetes MCP Server includes several built-in prompts that are always available:
63+
64+
### `cluster-health-check`
65+
66+
Performs a comprehensive health assessment of your Kubernetes or OpenShift cluster.
67+
68+
**Arguments:**
69+
- `namespace` (optional): Limit the health check to a specific namespace. Default: all namespaces.
70+
- `verbose` (optional): Enable detailed resource-level information. Values: `true` or `false`. Default: `false`.
71+
- `check_events` (optional): Include recent warning/error events in the analysis. Values: `true` or `false`. Default: `true`.
72+
73+
**What it checks:**
74+
- **Nodes**: Status and conditions (Ready, MemoryPressure, DiskPressure, etc.)
75+
- **Cluster Operators** (OpenShift only): Available and degraded status
76+
- **Pods**: Phase, container statuses, restart counts, and common issues (CrashLoopBackOff, ImagePullBackOff, etc.)
77+
- **Workload Controllers**: Deployments, StatefulSets, and DaemonSets replica status
78+
- **Persistent Volume Claims**: Binding status
79+
- **Events**: Recent warning and error events from the last hour
80+
81+
**Example usage:**
82+
```
83+
Check the health of my cluster
84+
```
85+
86+
Or with specific parameters:
87+
```
88+
Check the health of namespace production with verbose output
89+
```
90+
91+
The prompt gathers comprehensive diagnostic data and presents it to the LLM for analysis, which will provide:
92+
1. Overall health status (Healthy, Warning, or Critical)
93+
2. Critical issues requiring immediate attention
94+
3. Warnings and recommendations
95+
4. Summary by component
96+
6097
## Configuration File Location
6198

6299
Place your prompts in the `config.toml` file used by the MCP server. Specify the config file path using the `--config` flag when starting the server.

pkg/mcp/mcp.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,16 @@ func (s *Server) reloadToolsets() error {
167167
// Track previously enabled prompts
168168
previousPrompts := s.enabledPrompts
169169

170+
// Save built-in prompts before clearing (prompts registered via init() in code)
171+
// These need to be preserved across config reloads
172+
builtInPrompts := prompts.ConfigPrompts()
173+
170174
// Load config prompts into registry
171175
prompts.Clear()
176+
177+
// Re-register built-in prompts first
178+
prompts.Register(builtInPrompts...)
179+
172180
if s.configuration.HasPrompts() {
173181
ctx := context.Background()
174182
md := s.configuration.GetPromptsMetadata()
@@ -177,7 +185,7 @@ func (s *Server) reloadToolsets() error {
177185
}
178186
}
179187

180-
// Get prompts from registry
188+
// Get prompts from registry (includes both built-in and config prompts)
181189
configPrompts := prompts.ConfigPrompts()
182190

183191
// Update enabled prompts list

0 commit comments

Comments
 (0)