Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions docs/PROMPTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,43 @@ content = "I'll retrieve and analyze the logs for you."
### Argument Substitution
Use `{{argument_name}}` placeholders in message content. The template engine replaces these with actual values when the prompt is called.

## Built-in Prompts

The Kubernetes MCP Server includes several built-in prompts that are always available:

### `cluster-health-check`

Performs a comprehensive health assessment of your Kubernetes or OpenShift cluster.

**Arguments:**
- `namespace` (optional): Limit the health check to a specific namespace. Default: all namespaces.
- `verbose` (optional): Enable detailed resource-level information. Values: `true` or `false`. Default: `false`.
- `check_events` (optional): Include recent warning/error events in the analysis. Values: `true` or `false`. Default: `true`.

**What it checks:**
- **Nodes**: Status and conditions (Ready, MemoryPressure, DiskPressure, etc.)
- **Cluster Operators** (OpenShift only): Available and degraded status
- **Pods**: Phase, container statuses, restart counts, and common issues (CrashLoopBackOff, ImagePullBackOff, etc.)
- **Workload Controllers**: Deployments, StatefulSets, and DaemonSets replica status
- **Persistent Volume Claims**: Binding status
- **Events**: Recent warning and error events from the last hour

**Example usage:**
```
Check the health of my cluster
```

Or with specific parameters:
```
Check the health of namespace production with verbose output
```

The prompt gathers comprehensive diagnostic data and presents it to the LLM for analysis, which will provide:
1. Overall health status (Healthy, Warning, or Critical)
2. Critical issues requiring immediate attention
3. Warnings and recommendations
4. Summary by component

## Configuration File Location

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.
Expand Down
10 changes: 8 additions & 2 deletions pkg/mcp/mcp_watch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ func (s *WatchKubeConfigSuite) TestNotifiesToolsChangeMultipleTimes() {
notification := s.WaitForNotification(5 * time.Second)
// Then
s.NotNil(notification, "WatchKubeConfig did not notify on iteration %d", i)
s.Equalf("notifications/tools/list_changed", notification.Method, "WatchKubeConfig did not notify tools change on iteration %d", i)
s.True(
notification.Method == "notifications/tools/list_changed" || notification.Method == "notifications/prompts/list_changed",
"WatchKubeConfig did not notify tools or prompts change on iteration %d, got: %s", i, notification.Method,
)
}
}

Expand Down Expand Up @@ -154,7 +157,10 @@ func (s *WatchClusterStateSuite) TestNotifiesToolsChangeMultipleTimes() {
s.AddAPIGroup(`{"name":"` + name + `.example.com","versions":[{"groupVersion":"` + name + `.example.com/v1","version":"v1"}],"preferredVersion":{"groupVersion":"` + name + `.example.com/v1","version":"v1"}}`)
notification := s.WaitForNotification(10 * time.Second)
s.NotNil(notification, "cluster state watcher did not notify on iteration %d", i)
s.Equalf("notifications/tools/list_changed", notification.Method, "cluster state watcher did not notify tools change on iteration %d", i)
s.True(
notification.Method == "notifications/tools/list_changed" || notification.Method == "notifications/prompts/list_changed",
"cluster state watcher did not notify tools or prompts change on iteration %d, got: %s", i, notification.Method,
)
}
}

Expand Down
Loading