Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 22 additions & 11 deletions cmd/src/mcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,21 @@ var mcpFlagSet = flag.NewFlagSet("mcp", flag.ExitOnError)

func init() {
commands = append(commands, &command{
flagSet: mcpFlagSet,
handler: mcpMain,
flagSet: mcpFlagSet,
handler: mcpMain,
usageFunc: mcpUsage,
})
}

func mcpUsage() {
fmt.Println("The 'mcp' command exposes MCP tools as subcommands for agents to use.")
fmt.Println("\nUSAGE:")
fmt.Println(" src mcp list-tools List available tools")
fmt.Println(" src mcp <tool-name> schema View the input/output schema of a tool")
fmt.Println(" src mcp <tool-name> <flags> Invoke a tool with the given flags")
fmt.Println(" src mcp <tool-name> -h List the available flags of a tool")
}

func mcpMain(args []string) error {
fmt.Println("NOTE: This command is still experimental")
apiClient := cfg.apiClient(nil, mcpFlagSet.Output())
Expand All @@ -31,21 +42,21 @@ func mcpMain(args []string) error {
return err
}

if len(args) == 0 {
mcpUsage()
return nil
}

subcmd := args[0]
if subcmd == "list-tools" {
fmt.Println("The following tools are available:")
for name := range tools {
fmt.Printf(" %s\n", name)
fmt.Printf(" %s\n", name)
}
fmt.Println("\nUSAGE:")
fmt.Printf(" • Invoke a tool\n")
fmt.Printf(" src mcp <tool-name> <flags>\n")
fmt.Printf("\n • View the Input / Output Schema of a tool\n")
fmt.Printf(" src mcp <tool-name> schema\n")
fmt.Printf("\n • List the available flags of a tool\n")
fmt.Printf(" src mcp <tool-name> -h\n")
fmt.Printf("\n • View the Input / Output Schema of a tool\n")
fmt.Printf(" src mcp <tool-name> schema\n")
fmt.Println(" src mcp <tool-name> schema View the input/output schema of a tool")
fmt.Println(" src mcp <tool-name> <flags> Invoke a tool with the given flags")
fmt.Println(" src mcp <tool-name> -h List the available flags of a tool")
return nil
}
tool, ok := tools[subcmd]
Expand Down
Loading