File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,14 @@ func NewServer() *MCPServer {
64
64
),
65
65
handleDeployTool ,
66
66
)
67
+
68
+ mcpServer .AddTool (
69
+ mcp .NewTool ("list" ,
70
+ mcp .WithDescription ("Lists all the functions deployed in the cluster" ),
71
+ ),
72
+ handleListTool ,
73
+ )
74
+
67
75
return & MCPServer {
68
76
server : mcpServer ,
69
77
}
@@ -133,3 +141,16 @@ func handleDeployTool(
133
141
body := []byte (fmt .Sprintf (`{"result": "%s"}` , out ))
134
142
return mcp .NewToolResultText (string (body )), nil
135
143
}
144
+
145
+ func handleListTool (
146
+ ctx context.Context ,
147
+ request mcp.CallToolRequest ,
148
+ ) (* mcp.CallToolResult , error ) {
149
+ cmd := exec .Command ("func" , "list" )
150
+ out , err := cmd .Output ()
151
+ if err != nil {
152
+ return mcp .NewToolResultError (err .Error ()), nil
153
+ }
154
+ body := []byte (fmt .Sprintf (`{"result": "%s"}` , out ))
155
+ return mcp .NewToolResultText (string (body )), nil
156
+ }
You can’t perform that action at this time.
0 commit comments