feat: add placeholder list-tools CLI command (PoC) by salignatmoandal · Pull Request #618 · github/github-mcp-server · GitHub | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
Skip to content

feat: add placeholder list-tools CLI command (PoC) #618

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
92 changes: 92 additions & 0 deletions cmd/github-mcp-server/list_tools.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
package main

import (
"fmt"
"sort"

"github.com/github/github-mcp-server/pkg/github"
"github.com/github/github-mcp-server/pkg/translations"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)

var listToolsPocCmd = &cobra.Command{
Use: "list-tools",
Short: "List available MCP tools grouped by toolset",
Long: `Display all registered MCP tools, grouped by toolset.`,
RunE: func(cmd *cobra.Command, args []string) error {
fmt.Println("TODO: Implement list-tools functionality")
fmt.Println("This is a proof of concept for the list-tools command.")
fmt.Println("Would display all available MCP tools grouped by toolset.")
return nil
},
}

func init() {
rootCmd.AddCommand(listToolsPocCmd)
}

// TODO: Add filtering by toolset (e.g., --toolset=repos)
// TODO: Support output formats (e.g., --format=json, yaml, table)
// TODO: Respect active toolsets, dynamic toolsets, and read-only flags
// TODO: Add unit tests once design is confirmed useful

func listTools() error {
// Get configuration from viper
var enabledToolsets []string
if err := viper.UnmarshalKey("toolsets", &enabledToolsets); err != nil {
return fmt.Errorf("failed to unmarshal toolsets: %w", err)
}

readOnly := viper.GetBool("read-only")

// Create translation helper
t, _ := translations.TranslationHelper()

// Create toolset group with mock clients
tsg := github.DefaultToolsetGroup(readOnly, mockGetClient, mockGetGQLClient, mockGetRawClient, t)

// Enable specified toolsets
if err := tsg.EnableToolsets(enabledToolsets); err != nil {
return fmt.Errorf("failed to enable toolsets: %w", err)
}

// Get sorted toolset names
var toolsetNames []string
for name := range tsg.Toolsets {
toolsetNames = append(toolsetNames, name)
}
sort.Strings(toolsetNames)

for _, toolsetName := range toolsetNames {
toolset := tsg.Toolsets[toolsetName]

// Skip if toolset is not enabled
if !toolset.Enabled {
continue
}

fmt.Printf("\nToolset: %s\n", toolsetName)
fmt.Printf("Description: %s\n", toolset.Description)
fmt.Println()

tools := toolset.GetActiveTools()
if len(tools) == 0 {
fmt.Println(" No tools available")
continue
}

// Sort tools by name
sort.Slice(tools, func(i, j int) bool {
return tools[i].Tool.Name < tools[j].Tool.Name
})

for _, serverTool := range tools {
tool := serverTool.Tool
fmt.Printf("- %s: %s\n", tool.Name, tool.Description)
}
fmt.Println()
}

return nil
}
13 changes: 13 additions & 0 deletions cmd/github-mcp-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@ var (
return ghmcp.RunStdioServer(stdioServerConfig)
},
}

listToolsCmd = &cobra.Command{
Use: "list-tools",
Short: "List available MCP tools grouped by toolset",
Long: `Display all registered MCP tools, grouped by toolset.`,
RunE: func(cmd *cobra.Command, args []string) error {
fmt.Println("TODO: Implement list-tools functionality")
fmt.Println("This is a proof of concept for the list-tools command.")
fmt.Println("Would display all available MCP tools grouped by toolset.")
return nil
},
}
)

func init() {
Expand Down Expand Up @@ -87,6 +99,7 @@ func init() {

// Add subcommands
rootCmd.AddCommand(stdioCmd)
rootCmd.AddCommand(listToolsCmd)
}

func initConfig() {
Expand Down

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.