@@ -3,6 +3,7 @@ package cilium
33import (
44 "context"
55 "fmt"
6+ "strings"
67
78 "github.com/kagent-dev/tools/internal/commands"
89 "github.com/kagent-dev/tools/internal/telemetry"
@@ -619,7 +620,8 @@ func runCiliumDbgCommandWithContext(ctx context.Context, command, nodeName strin
619620 if err != nil {
620621 return "" , err
621622 }
622- args := []string {"exec" , "-it" , podName , "--" , "cilium-dbg" , command }
623+ args := []string {"exec" , "-n" , "kube-system" , podName , "--" , "cilium-dbg" }
624+ args = append (args , strings .Fields (command )... )
623625 kubeconfigPath := utils .GetKubeconfig ()
624626 return commands .NewCommandBuilder ("kubectl" ).
625627 WithArgs (args ... ).
@@ -780,13 +782,13 @@ func handleShowConfigurationOptions(ctx context.Context, request mcp.CallToolReq
780782
781783 var cmd string
782784 if listAll {
783- cmd = "endpoint config --all"
785+ cmd = "config --all"
784786 } else if listReadOnly {
785- cmd = "endpoint config -r"
787+ cmd = "config -r"
786788 } else if listOptions {
787- cmd = "endpoint config --list-options"
789+ cmd = "config --list-options"
788790 } else {
789- cmd = "endpoint config"
791+ cmd = "config"
790792 }
791793
792794 output , err := runCiliumDbgCommand (ctx , cmd , nodeName )
@@ -810,7 +812,7 @@ func handleToggleConfigurationOption(ctx context.Context, request mcp.CallToolRe
810812 valueStr = "disable"
811813 }
812814
813- cmd := fmt .Sprintf ("endpoint config %s=%s" , option , valueStr )
815+ cmd := fmt .Sprintf ("config %s=%s" , option , valueStr )
814816 output , err := runCiliumDbgCommand (ctx , cmd , nodeName )
815817 if err != nil {
816818 return mcp .NewToolResultError (fmt .Sprintf ("Failed to toggle configuration option: %v" , err )), nil
@@ -885,7 +887,7 @@ func handleFQDNCache(ctx context.Context, request mcp.CallToolRequest) (*mcp.Cal
885887func handleShowDNSNames (ctx context.Context , request mcp.CallToolRequest ) (* mcp.CallToolResult , error ) {
886888 nodeName := mcp .ParseString (request , "node_name" , "" )
887889
888- output , err := runCiliumDbgCommand (ctx , "dns names" , nodeName )
890+ output , err := runCiliumDbgCommand (ctx , "fqdn names" , nodeName )
889891 if err != nil {
890892 return mcp .NewToolResultError (fmt .Sprintf ("Failed to show DNS names: %v" , err )), nil
891893 }
@@ -1000,7 +1002,7 @@ func handleListBPFMapEvents(ctx context.Context, request mcp.CallToolRequest) (*
10001002 return mcp .NewToolResultError ("map_name parameter is required" ), nil
10011003 }
10021004
1003- cmd := fmt .Sprintf ("bpf map events %s" , mapName )
1005+ cmd := fmt .Sprintf ("map events %s" , mapName )
10041006 output , err := runCiliumDbgCommand (ctx , cmd , nodeName )
10051007 if err != nil {
10061008 return mcp .NewToolResultError (fmt .Sprintf ("Failed to list BPF map events: %v" , err )), nil
@@ -1016,7 +1018,7 @@ func handleGetBPFMap(ctx context.Context, request mcp.CallToolRequest) (*mcp.Cal
10161018 return mcp .NewToolResultError ("map_name parameter is required" ), nil
10171019 }
10181020
1019- cmd := fmt .Sprintf ("bpf map get %s" , mapName )
1021+ cmd := fmt .Sprintf ("map get %s" , mapName )
10201022 output , err := runCiliumDbgCommand (ctx , cmd , nodeName )
10211023 if err != nil {
10221024 return mcp .NewToolResultError (fmt .Sprintf ("Failed to get BPF map: %v" , err )), nil
@@ -1027,7 +1029,7 @@ func handleGetBPFMap(ctx context.Context, request mcp.CallToolRequest) (*mcp.Cal
10271029func handleListBPFMaps (ctx context.Context , request mcp.CallToolRequest ) (* mcp.CallToolResult , error ) {
10281030 nodeName := mcp .ParseString (request , "node_name" , "" )
10291031
1030- output , err := runCiliumDbgCommand (ctx , "bpf map list" , nodeName )
1032+ output , err := runCiliumDbgCommand (ctx , "map list" , nodeName )
10311033 if err != nil {
10321034 return mcp .NewToolResultError (fmt .Sprintf ("Failed to list BPF maps: %v" , err )), nil
10331035 }
@@ -1055,7 +1057,7 @@ func handleListMetrics(ctx context.Context, request mcp.CallToolRequest) (*mcp.C
10551057func handleListClusterNodes (ctx context.Context , request mcp.CallToolRequest ) (* mcp.CallToolResult , error ) {
10561058 nodeName := mcp .ParseString (request , "node_name" , "" )
10571059
1058- output , err := runCiliumDbgCommand (ctx , "nodes list" , nodeName )
1060+ output , err := runCiliumDbgCommand (ctx , "node list" , nodeName )
10591061 if err != nil {
10601062 return mcp .NewToolResultError (fmt .Sprintf ("Failed to list cluster nodes: %v" , err )), nil
10611063 }
0 commit comments