File tree Expand file tree Collapse file tree 2 files changed +16
-6
lines changed
mcp-cli-api/src/main/java/software/amazon/smithy/java/mcp/cli
mcp-cli/src/main/java/software/amazon/smithy/java/mcp/cli/commands Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change 88import static software .amazon .smithy .java .mcp .cli .ConfigUtils .loadOrCreateConfig ;
99
1010import java .util .concurrent .Callable ;
11+ import picocli .CommandLine ;
1112import software .amazon .smithy .java .logging .InternalLogger ;
1213import software .amazon .smithy .java .mcp .cli .model .Config ;
1314
2021 */
2122public abstract class SmithyMcpCommand implements Callable <Integer > {
2223
24+ @ CommandLine .Spec
25+ CommandLine .Model .CommandSpec commandSpec ;
26+
2327 InternalLogger LOG = InternalLogger .getLogger (SmithyMcpCommand .class );
2428
2529 @ Override
@@ -50,4 +54,8 @@ public final Integer call() throws Exception {
5054 protected String registryToUse (Config config ) {
5155 return config .getDefaultRegistry ();
5256 }
57+
58+ protected final CommandLine .Model .CommandSpec commandSpec () {
59+ return commandSpec ;
60+ }
5361}
Original file line number Diff line number Diff line change @@ -25,13 +25,15 @@ protected void execute(ExecutionContext context) {
2525 registry
2626 .listMcpBundles ()
2727 .forEach (bundle -> {
28- StringBuilder builder = new StringBuilder (bundle .getName ());
29- if (bundle .getDescription () != null ) {
30- builder .append ("\n " ).append ("Description: " ).append (bundle .getDescription ());
31- } else {
32- builder .append ("\n " ).append ("MCP for " ).append (bundle .getName ());
28+ System .out .println (commandSpec ().commandLine ()
29+ .getColorScheme ()
30+ .string ("@|bold " + bundle .getName () + "|@" ));
31+ var description = bundle .getDescription ();
32+ if (description == null ) {
33+ description = "MCP server for " + bundle .getName ();
3334 }
34- System .out .println (builder );
35+ System .out .print ("\t Description: " );
36+ System .out .println (description );
3537 });
3638
3739 }
You can’t perform that action at this time.
0 commit comments