Agent Mesh
Go a2aa2a-protocolagent-meshagentic-aiinferencemcpmeshmesh-networknetwork-securitynetworking-aip2p-network
Add 'list' argument to mcp-client to list the available tool. Make it default
Tomas Tormocc0fd91fee12
diff --git a/cmd/mcp-client/main.go b/cmd/mcp-client/main.goindex 77660d5f..e127c657 100644--- a/cmd/mcp-client/main.go+++ b/cmd/mcp-client/main.go@@ -30,9 +30,10 @@ import (func main() {serverURL := flag.String("url", "", "MCP server URL (e.g. http://localhost:8080/)")- toolName := flag.String("tool", "get_mesh_info", "Tool to call")+ toolName := flag.String("tool", "", "Tool to call")toolArgs := flag.String("args", "{}", "JSON arguments for the tool")- timoutArgs := flag.Int("timeout", 10, "Timeout in seconds")+ timeoutArgs := flag.Int("timeout", 10, "Timeout in seconds")+ listTools := flag.Bool("list", false, "List available tools and exit")flag.Parse()if *serverURL == "" {@@ -41,8 +42,8 @@ func main() {var ctx context.Contextvar cancel context.CancelFunc- if timoutArgs != nil {- ctx, cancel = context.WithTimeout(context.Background(), time.Duration(*timoutArgs)*time.Second)+ if timeoutArgs != nil {+ ctx, cancel = context.WithTimeout(context.Background(), time.Duration(*timeoutArgs)*time.Second)} else {ctx = context.Background()}@@ -73,6 +74,17 @@ func main() {}}()+ if *listTools || *toolName == "" {+ tools, err := session.ListTools(ctx, &mcp.ListToolsParams{})+ if err != nil {+ log.Fatalf("ListTools failed: %v", err)+ }+ for _, t := range tools.Tools {+ fmt.Printf("%s\t%s\n", t.Name, t.Description)+ }+ return+ }+var args map[string]anyif *toolArgs != "" {if err := json.Unmarshal([]byte(*toolArgs), &args); err != nil {