Skip to content

Commit 16f12a5

Browse files
committed
chore: Register Inspektor Gadget tool by default
Signed-off-by: Qasim Sarfraz <[email protected]>
1 parent aabb0e9 commit 16f12a5

File tree

7 files changed

+22
-23
lines changed

7 files changed

+22
-23
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,15 +198,15 @@ require explicit enablement via `--additional-tools`*
198198
<details>
199199
<summary>Real-time Observability</summary>
200200

201-
**Tool:** `inspektor_gadget` *(requires `--additional-tools inspektor-gadget`)*
201+
**Tool:** `inspektor_gadget_observability`
202202

203203
Real-time observability tool for Azure Kubernetes Service (AKS) clusters using
204204
eBPF.
205205

206206
**Available Actions:**
207207

208-
- `deploy`: Deploy Inspektor Gadget to cluster
209-
- `undeploy`: Remove Inspektor Gadget from cluster
208+
- `deploy`: Deploy Inspektor Gadget to cluster (requires `readwrite`/`admin` access)
209+
- `undeploy`: Remove Inspektor Gadget from cluster (requires `readwrite`/`admin` access)
210210
- `is_deployed`: Check deployment status
211211
- `run`: Run one-shot gadgets
212212
- `start`: Start continuous gadgets
@@ -407,7 +407,7 @@ Command line arguments:
407407
```sh
408408
Usage of ./aks-mcp:
409409
--access-level string Access level (readonly, readwrite, admin) (default "readonly")
410-
--additional-tools string Comma-separated list of additional Kubernetes tools to support (kubectl is always enabled). Available: helm,cilium,inspektor-gadget
410+
--additional-tools string Comma-separated list of additional Kubernetes tools to support (kubectl is always enabled). Available: helm,cilium
411411
--allow-namespaces string Comma-separated list of allowed Kubernetes namespaces (empty means all namespaces)
412412
--host string Host to listen for the server (only used with transport sse or streamable-http) (default "127.0.0.1")
413413
--port int Port to listen for the server (only used with transport sse or streamable-http) (default 8000)

docs/inspektor-gadget-usage.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# Inspektor Gadget Tool Usage
1+
# Inspektor Gadget Observability Tool Usage in AKS-MCP Server
22

3-
This document gives an overview of `inspektor_gadget` tool in the AKS-MCP server.
3+
This document gives an overview of `inspektor_gadget_observability` tool in the AKS-MCP server.
44

55
## Tool Overview
66

77
The [Inspektor Gadget](https://go.microsoft.com/fwlink/?linkid=2260072) tool allows users to run various diagnostics and inspections on Kubernetes clusters.
8-
It uses gadgets to collect real-time data with Kubernetes enrichment. `inspektor_gadget` MCP tool essentially allows managing the gadgets, enabling users to
8+
It uses gadgets to collect real-time data with Kubernetes enrichment. `inspektor_gadget_observability` MCP tool essentially allows managing the gadgets, enabling users to
99
run diagnostics, collect data, and analyze workloads in a Kubernetes environment. It currently supports the following actions:
1010

1111
- **start**: Start a gadget to collect data continuously
@@ -35,7 +35,7 @@ to get the most relevant data for your workload.
3535

3636
## Sample Prompts
3737

38-
Following are some sample prompts that can be used with to quickly try `inspektor_gadget` tool in the AKS-MCP server:
38+
Following are some sample prompts that can be used with to quickly try `inspektor_gadget_observability` tool in the AKS-MCP server:
3939

4040
```
4141
Can you check if any DNS queries are failing in AKS cluster?
@@ -68,12 +68,13 @@ Can you observe system calls for the pod my-pod in the default namespace for few
6868
## Prerequisites
6969

7070
- A kubeconfig file that has access to the AKS cluster. You will need to restart the MCP server if you change the kubeconfig file.
71-
- Ensure the AKS MCP server is running with the `--additional-tools=inspektor-gadget`.
72-
- The tool requires Inspektor Gadget to be installed in the cluster. If you are running with `--additional-tools=inspektor-gadget` and `--access-level=readwrite` or more, the MCP server will automatically
71+
- The tool requires Inspektor Gadget to be installed in the cluster. If you are running with `--access-level=readwrite` or more, the MCP server will automatically
7372
install Inspektor Gadget (action `deploy` ) in the cluster otherwise you can follow the steps to install it manually: [Inspektor Gadget Installation](https://learn.microsoft.com/en-us/troubleshoot/azure/azure-kubernetes/logs/capture-system-insights-from-aks#how-to-install-inspektor-gadget-in-an-aks-cluster) or
7473
use the official Helm chart: [Inspektor Gadget Helm Chart](https://inspektor-gadget.io/docs/latest/reference/install-kubernetes#installation-with-the-helm-chart):
7574

7675
```bash
7776
IG_VERSION=$(curl -s https://api.github.com/repos/inspektor-gadget/inspektor-gadget/releases/latest | jq -r '.tag_name' | sed 's/^v//')
7877
helm install gadget --namespace=gadget --create-namespace oci://ghcr.io/inspektor-gadget/inspektor-gadget/charts/gadget --version=$IG_VERSION
7978
```
79+
80+
Once Inspektor Gadget is deployed (or you installed it manually), you only need `readonly` (default) access to use the `inspektor_gadget_observability` tool.

internal/components/inspektorgadget/handlers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
// Inspektor Gadget Handler
1717
// =============================================================================
1818

19-
var ErrNotDeployed = fmt.Errorf("inspektor gadget is not deployed, please deploy it first e.g. using 'inspektor_gadget' (action: deploy) tool (requires 'readwrite' or 'admin' access level)")
19+
var ErrNotDeployed = fmt.Errorf("inspektor gadget is not deployed, please deploy it first e.g. using 'inspektor_gadget_observability' (action: deploy) tool (requires 'readwrite' or 'admin' access level)")
2020

2121
// InspektorGadgetHandler returns a handler to manage gadgets
2222
func InspektorGadgetHandler(mgr GadgetManager, cfg *config.ConfigData) tools.ResourceHandler {

internal/components/inspektorgadget/registry.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import "github.com/mark3labs/mcp-go/mcp"
99
// RegisterInspektorGadgetTool registers the inspektor-gadget tool to manage gadgets
1010
func RegisterInspektorGadgetTool() mcp.Tool {
1111
return mcp.NewTool(
12-
"inspektor_gadget",
12+
"inspektor_gadget_observability",
1313
mcp.WithDescription("Real-time observability tool for Azure Kubernetes Service (AKS) clusters, allowing users to manage gadgets for monitoring and debugging"),
1414
mcp.WithString("action",
1515
mcp.Required(),
@@ -56,7 +56,7 @@ func RegisterInspektorGadgetTool() mcp.Tool {
5656
map[string]any{
5757
"namespace": map[string]any{
5858
"type": "string",
59-
"description": "Kubernetes namespace",
59+
"description": "Kubernetes namespace, leave empty to use all namespaces",
6060
},
6161
"pod": map[string]any{
6262
"type": "string",

internal/components/inspektorgadget/registry_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import "testing"
44

55
func TestRegisterInspektorGadgetTool(t *testing.T) {
66
tool := RegisterInspektorGadgetTool()
7-
if tool.Name != "inspektor_gadget" {
8-
t.Errorf("Expected tool name 'inspektor_gadget', got '%s'", tool.Name)
7+
if tool.Name != "inspektor_gadget_observability" {
8+
t.Errorf("Expected tool name 'inspektor_gadget_observability', got '%s'", tool.Name)
99
}
1010

1111
if tool.Description == "" {

internal/config/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ type ConfigData struct {
2424
AccessLevel string
2525

2626
// Kubernetes-specific options
27-
// Map of additional tools enabled (helm, cilium, inspektor-gadget)
27+
// Map of additional tools enabled (helm, cilium)
2828
AdditionalTools map[string]bool
2929
// Comma-separated list of allowed Kubernetes namespaces
3030
AllowNamespaces string
@@ -56,7 +56,7 @@ func (cfg *ConfigData) ParseFlags() {
5656

5757
// Kubernetes-specific settings
5858
additionalTools := flag.String("additional-tools", "",
59-
"Comma-separated list of additional Kubernetes tools to support (kubectl is always enabled). Available: helm,cilium,inspektor-gadget")
59+
"Comma-separated list of additional Kubernetes tools to support (kubectl is always enabled). Available: helm,cilium")
6060
flag.StringVar(&cfg.AllowNamespaces, "allow-namespaces", "",
6161
"Comma-separated list of allowed Kubernetes namespaces (empty means all namespaces)")
6262

internal/server/server.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ func (s *Service) Initialize() error {
7272
// Register Kubernetes tools
7373
s.registerKubernetesTools()
7474

75+
// Register Inspektor Gadget tools for observability
76+
s.registerInspektorGadgetTools()
77+
7578
return nil
7679
}
7780

@@ -234,12 +237,6 @@ func (s *Service) registerKubernetesTools() {
234237
ciliumExecutor := k8s.WrapK8sExecutor(cilium.NewExecutor())
235238
s.mcpServer.AddTool(ciliumTool, tools.CreateToolHandler(ciliumExecutor, s.cfg))
236239
}
237-
238-
// Register Inspektor Gadget tools for observability
239-
if s.cfg.AdditionalTools["inspektor-gadget"] {
240-
log.Println("Registering Kubernetes tool: inspektor-gadget")
241-
s.registerInspektorGadgetTools()
242-
}
243240
}
244241

245242
// registerKubectlCommands registers kubectl commands based on access level
@@ -271,6 +268,7 @@ func (s *Service) registerInspektorGadgetTools() {
271268
}
272269

273270
// Register Inspektor Gadget tool
271+
log.Println("Registering Inspektor Gadget Observability tool: inspektor_gadget_observability")
274272
inspektorGadget := inspektorgadget.RegisterInspektorGadgetTool()
275273
s.mcpServer.AddTool(inspektorGadget, tools.CreateResourceHandler(inspektorgadget.InspektorGadgetHandler(gadgetMgr, s.cfg), s.cfg))
276274
}

0 commit comments

Comments
 (0)