@@ -293,7 +293,6 @@ func handleConfigVolumesTool(
293
293
return mcp .NewToolResultError (err .Error ()), nil
294
294
}
295
295
if action == "list" {
296
- // For 'list' action, we don't need other parameters, only --path
297
296
args := []string {"config" , "volumes" , "--path" , path }
298
297
if request .GetBool ("verbose" , false ) {
299
298
args = append (args , "--verbose" )
@@ -349,3 +348,107 @@ func handleConfigVolumesTool(
349
348
body := []byte (fmt .Sprintf (`{"result": "%s"}` , out ))
350
349
return mcp .NewToolResultText (string (body )), nil
351
350
}
351
+
352
+ func handleConfigLabelsTool (
353
+ ctx context.Context ,
354
+ request mcp.CallToolRequest ,
355
+ ) (* mcp.CallToolResult , error ) {
356
+ action , err := request .RequireString ("action" )
357
+ if err != nil {
358
+ return mcp .NewToolResultError (err .Error ()), nil
359
+ }
360
+ path , err := request .RequireString ("path" )
361
+ if err != nil {
362
+ return mcp .NewToolResultError (err .Error ()), nil
363
+ }
364
+
365
+ if action == "list" {
366
+ args := []string {"config" , "labels" , "--path" , path }
367
+ if request .GetBool ("verbose" , false ) {
368
+ args = append (args , "--verbose" )
369
+ }
370
+
371
+ cmd := exec .Command ("func" , args ... )
372
+ out , err := cmd .CombinedOutput ()
373
+ if err != nil {
374
+ return mcp .NewToolResultError (fmt .Sprintf ("func config labels list failed: %s" , out )), nil
375
+ }
376
+ body := []byte (fmt .Sprintf (`{"result": "%s"}` , out ))
377
+ return mcp .NewToolResultText (string (body )), nil
378
+ }
379
+
380
+ args := []string {"config" , "labels" , action , "--path" , path }
381
+
382
+ // Optional flags
383
+ if name := request .GetString ("name" , "" ); name != "" {
384
+ args = append (args , "--name" , name )
385
+ }
386
+ if value := request .GetString ("value" , "" ); value != "" {
387
+ args = append (args , "--value" , value )
388
+ }
389
+ if request .GetBool ("verbose" , false ) {
390
+ args = append (args , "--verbose" )
391
+ }
392
+
393
+ cmd := exec .Command ("func" , args ... )
394
+ out , err := cmd .CombinedOutput ()
395
+ if err != nil {
396
+ return mcp .NewToolResultError (fmt .Sprintf ("func config labels %s failed: %s" , action , out )), nil
397
+ }
398
+
399
+ body := []byte (fmt .Sprintf (`{"result": "%s"}` , out ))
400
+ return mcp .NewToolResultText (string (body )), nil
401
+ }
402
+
403
+ func handleConfigEnvsTool (
404
+ ctx context.Context ,
405
+ request mcp.CallToolRequest ,
406
+ ) (* mcp.CallToolResult , error ) {
407
+ action , err := request .RequireString ("action" )
408
+ if err != nil {
409
+ return mcp .NewToolResultError (err .Error ()), nil
410
+ }
411
+ path , err := request .RequireString ("path" )
412
+ if err != nil {
413
+ return mcp .NewToolResultError (err .Error ()), nil
414
+ }
415
+
416
+ // Handle 'list' action separately
417
+ if action == "list" {
418
+ args := []string {"config" , "envs" , "--path" , path }
419
+ if request .GetBool ("verbose" , false ) {
420
+ args = append (args , "--verbose" )
421
+ }
422
+
423
+ cmd := exec .Command ("func" , args ... )
424
+ out , err := cmd .CombinedOutput ()
425
+ if err != nil {
426
+ return mcp .NewToolResultError (fmt .Sprintf ("func config envs list failed: %s" , out )), nil
427
+ }
428
+ body := []byte (fmt .Sprintf (`{"result": "%s"}` , out ))
429
+ return mcp .NewToolResultText (string (body )), nil
430
+ }
431
+
432
+ // Handle 'add' and 'remove' actions
433
+ args := []string {"config" , "envs" , action , "--path" , path }
434
+
435
+ // Optional flags
436
+ if name := request .GetString ("name" , "" ); name != "" {
437
+ args = append (args , "--name" , name )
438
+ }
439
+ if value := request .GetString ("value" , "" ); value != "" {
440
+ args = append (args , "--value" , value )
441
+ }
442
+ if request .GetBool ("verbose" , false ) {
443
+ args = append (args , "--verbose" )
444
+ }
445
+
446
+ cmd := exec .Command ("func" , args ... )
447
+ out , err := cmd .CombinedOutput ()
448
+ if err != nil {
449
+ return mcp .NewToolResultError (fmt .Sprintf ("func config envs %s failed: %s" , action , out )), nil
450
+ }
451
+
452
+ body := []byte (fmt .Sprintf (`{"result": "%s"}` , out ))
453
+ return mcp .NewToolResultText (string (body )), nil
454
+ }
0 commit comments