Skip to content

Commit 846ba03

Browse files
committed
fix(cli): streamline tool listings
1 parent 2eef531 commit 846ba03

2 files changed

Lines changed: 32 additions & 13 deletions

File tree

internal/cli/commands.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ func listToolsFromServer(ctx context.Context, serverName string, serverConfig co
479479
for _, tool := range tools {
480480
fmt.Printf(" • %s\n", tool.Name)
481481
if tool.Description != "" {
482-
fmt.Printf(" %s\n", tool.Description)
482+
fmt.Printf(" desc: %s\n", tool.Description)
483483
}
484484
if tool.InputSchema != nil {
485485
if properties, ok := tool.InputSchema["properties"].(map[string]interface{}); ok {
@@ -495,9 +495,17 @@ func listToolsFromServer(ctx context.Context, serverName string, serverConfig co
495495
// Build and display call example
496496
exampleArgs := BuildExampleArgs(&tool)
497497
if verbose {
498-
fmt.Printf(" call: %s call-tool %s %s %s\n\n", os.Args[0], serverName, tool.Name, exampleArgs)
498+
if exampleArgs == "'{}'" {
499+
fmt.Printf(" call: mcp-cli-ent call-tool %s %s\n\n", serverName, tool.Name)
500+
} else {
501+
fmt.Printf(" call: mcp-cli-ent call-tool %s %s %s\n\n", serverName, tool.Name, exampleArgs)
502+
}
499503
} else {
500-
fmt.Printf(" %s call-tool %s %s %s\n\n", os.Args[0], serverName, tool.Name, exampleArgs)
504+
if exampleArgs == "'{}'" {
505+
fmt.Printf(" call: mcp-cli-ent call-tool %s %s\n\n", serverName, tool.Name)
506+
} else {
507+
fmt.Printf(" call: mcp-cli-ent call-tool %s %s %s\n\n", serverName, tool.Name, exampleArgs)
508+
}
501509
}
502510
}
503511

internal/cli/root.go

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,10 @@ func showRootHelpWithServers(cmd *cobra.Command) error {
253253
_ = SaveToolsToCache(newCache)
254254
}
255255

256+
fmt.Println("Usage:")
257+
fmt.Println("mcp-cli-ent call-tool <server_name> <tool_name> <params>")
258+
fmt.Println()
259+
256260
// Display tools
257261
for serverName, serverConfig := range enabledServers {
258262
tools, ok := toolsByServer[serverName]
@@ -261,24 +265,31 @@ func showRootHelpWithServers(cmd *cobra.Command) error {
261265
}
262266

263267
// Print server name with description if available
268+
displayName := fmt.Sprintf("<%s>", serverName)
264269
if serverConfig.Description != "" {
265-
fmt.Printf("%s (%s):\n", serverName, serverConfig.Description)
270+
fmt.Printf("%s (%s) [%d]\n", displayName, serverConfig.Description, len(tools))
266271
} else {
267-
fmt.Printf("%s:\n", serverName)
272+
fmt.Printf("%s [%d]\n", displayName, len(tools))
268273
}
269274

270-
// Print each tool with usage example
275+
// Print each tool with example args
271276
for _, tool := range tools {
272-
fmt.Printf(" • %s\n", tool.Name)
277+
exampleArgs := BuildExampleArgs(&tool)
278+
if exampleArgs == "'{}'" {
279+
fmt.Printf(" • %s\n", tool.Name)
280+
} else {
281+
fmt.Printf(" • %s %s\n", tool.Name, exampleArgs)
282+
}
273283
if verbose && tool.Description != "" {
274284
// In verbose mode, show full description
275285
fmt.Printf(" desc: %s\n", tool.Description)
276286
}
277-
exampleArgs := BuildExampleArgs(&tool)
278287
if verbose {
279-
fmt.Printf(" call: mcp-cli-ent call-tool %s %s %s\n", serverName, tool.Name, exampleArgs)
280-
} else {
281-
fmt.Printf(" mcp-cli-ent call-tool %s %s %s\n", serverName, tool.Name, exampleArgs)
288+
if exampleArgs == "'{}'" {
289+
fmt.Printf(" call: mcp-cli-ent call-tool %s %s\n", serverName, tool.Name)
290+
} else {
291+
fmt.Printf(" call: mcp-cli-ent call-tool %s %s %s\n", serverName, tool.Name, exampleArgs)
292+
}
282293
}
283294
}
284295
fmt.Println()
@@ -290,8 +301,8 @@ func showRootHelpWithServers(cmd *cobra.Command) error {
290301
}
291302

292303
fmt.Printf("Total: %d tools across %d servers\n\n", totalTools, len(enabledServers))
293-
fmt.Println("For full details (descriptions + parameters):")
294-
fmt.Println(" mcp-cli-ent list-tools <server>")
304+
fmt.Println("For full specific MCP server details:")
305+
fmt.Println(" mcp-cli-ent list-tools <server_name>")
295306
fmt.Println("\nUse --verbose for tool descriptions")
296307

297308
return nil

0 commit comments

Comments
 (0)