@@ -17,10 +17,21 @@ var mcpFlagSet = flag.NewFlagSet("mcp", flag.ExitOnError)
1717
1818func init () {
1919 commands = append (commands , & command {
20- flagSet : mcpFlagSet ,
21- handler : mcpMain ,
20+ flagSet : mcpFlagSet ,
21+ handler : mcpMain ,
22+ usageFunc : mcpUsage ,
2223 })
2324}
25+
26+ func mcpUsage () {
27+ fmt .Println ("The 'mcp' command exposes MCP tools as subcommands for agents to use." )
28+ fmt .Println ("\n USAGE:" )
29+ fmt .Println (" src mcp list-tools List available tools" )
30+ fmt .Println (" src mcp <tool-name> schema View the input/output schema of a tool" )
31+ fmt .Println (" src mcp <tool-name> <flags> Invoke a tool with the given flags" )
32+ fmt .Println (" src mcp <tool-name> -h List the available flags of a tool" )
33+ }
34+
2435func mcpMain (args []string ) error {
2536 fmt .Println ("NOTE: This command is still experimental" )
2637 apiClient := cfg .apiClient (nil , mcpFlagSet .Output ())
@@ -31,21 +42,21 @@ func mcpMain(args []string) error {
3142 return err
3243 }
3344
45+ if len (args ) == 0 {
46+ mcpUsage ()
47+ return nil
48+ }
49+
3450 subcmd := args [0 ]
3551 if subcmd == "list-tools" {
3652 fmt .Println ("The following tools are available:" )
3753 for name := range tools {
38- fmt .Printf (" • %s\n " , name )
54+ fmt .Printf (" %s\n " , name )
3955 }
4056 fmt .Println ("\n USAGE:" )
41- fmt .Printf (" • Invoke a tool\n " )
42- fmt .Printf (" src mcp <tool-name> <flags>\n " )
43- fmt .Printf ("\n • View the Input / Output Schema of a tool\n " )
44- fmt .Printf (" src mcp <tool-name> schema\n " )
45- fmt .Printf ("\n • List the available flags of a tool\n " )
46- fmt .Printf (" src mcp <tool-name> -h\n " )
47- fmt .Printf ("\n • View the Input / Output Schema of a tool\n " )
48- fmt .Printf (" src mcp <tool-name> schema\n " )
57+ fmt .Println (" src mcp <tool-name> schema View the input/output schema of a tool" )
58+ fmt .Println (" src mcp <tool-name> <flags> Invoke a tool with the given flags" )
59+ fmt .Println (" src mcp <tool-name> -h List the available flags of a tool" )
4960 return nil
5061 }
5162 tool , ok := tools [subcmd ]
0 commit comments