Skip to content

Commit ae8a90c

Browse files
Akshat DubeyAkshat Dubey
authored andcommitted
feat(cli): add more details for arguments mcp description
GH-0
1 parent 758fd5d commit ae8a90c

2 files changed

Lines changed: 37 additions & 17 deletions

File tree

packages/cli/README.md

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,33 +15,30 @@ Once the above command is executed, you will be able to access the CLI commands
1515
## Usage
1616

1717
<!-- usage -->
18-
1918
```sh-session
2019
$ npm install -g @sourceloop/cli
2120
$ sl COMMAND
2221
running command...
2322
$ sl (-v|--version|version)
24-
@sourceloop/cli/10.0.0 darwin-arm64 node-v20.19.2
23+
@sourceloop/cli/10.0.0 darwin-arm64 node-v24.2.0
2524
$ sl --help [COMMAND]
2625
USAGE
2726
$ sl COMMAND
2827
...
2928
```
30-
3129
<!-- usagestop -->
3230

3331
## Commands
3432

3533
<!-- commands -->
36-
37-
- [`sl autocomplete [SHELL]`](#sl-autocomplete-shell)
38-
- [`sl cdk`](#sl-cdk)
39-
- [`sl extension [NAME]`](#sl-extension-name)
40-
- [`sl help [COMMAND]`](#sl-help-command)
41-
- [`sl mcp`](#sl-mcp)
42-
- [`sl microservice [NAME]`](#sl-microservice-name)
43-
- [`sl scaffold [NAME]`](#sl-scaffold-name)
44-
- [`sl update`](#sl-update)
34+
* [`sl autocomplete [SHELL]`](#sl-autocomplete-shell)
35+
* [`sl cdk`](#sl-cdk)
36+
* [`sl extension [NAME]`](#sl-extension-name)
37+
* [`sl help [COMMAND]`](#sl-help-command)
38+
* [`sl mcp`](#sl-mcp)
39+
* [`sl microservice [NAME]`](#sl-microservice-name)
40+
* [`sl scaffold [NAME]`](#sl-scaffold-name)
41+
* [`sl update`](#sl-update)
4542

4643
## `sl autocomplete [SHELL]`
4744

@@ -127,14 +124,26 @@ _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v3.2.1
127124

128125
## `sl mcp`
129126

130-
Command that runs an MCP server for the sourceloop CLI, this is not supposed to be run directly, but rather used by the MCP client to interact with the CLI commands.
127+
Command that runs an MCP server for the sourceloop CLI, this is not supposed to be run directly, but rather used by the MCP client to interact with the CLI commands.
131128

132129
```
133130
USAGE
134131
$ sl mcp
135132
136133
OPTIONS
137134
--help show manual pages
135+
136+
DESCRIPTION
137+
Command that runs an MCP server for the sourceloop CLI, this is not supposed to be run directly, but rather used by
138+
the MCP client to interact with the CLI commands.
139+
You can use it using the following MCP server configuration:
140+
```json
141+
"sourceloop": {
142+
"command": "npx",
143+
"args": ["@sourceloop/cli", "mcp"],
144+
"timeout": 300
145+
}
146+
```
138147
```
139148

140149
_See code: [src/commands/mcp.ts](https://github.com/sourcefuse/loopback4-microservice-catalog/blob/v10.0.0/src/commands/mcp.ts)_
@@ -223,5 +232,4 @@ OPTIONS
223232
```
224233

225234
_See code: [src/commands/update.ts](https://github.com/sourcefuse/loopback4-microservice-catalog/blob/v10.0.0/src/commands/update.ts)_
226-
227235
<!-- commandsstop -->

packages/cli/src/commands/mcp.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,17 @@ export class Mcp extends Base<{}> {
3636
this.commands = [Cdk, Extension, Microservice, Scaffold, Update];
3737
}
3838
}
39-
static readonly description =
40-
'Command that runs an MCP server for the sourceloop CLI, this is not supposed to be run directly, but rather used by the MCP client to interact with the CLI commands.';
39+
static readonly description = `
40+
Command that runs an MCP server for the sourceloop CLI, this is not supposed to be run directly, but rather used by the MCP client to interact with the CLI commands.
41+
You can use it using the following MCP server configuration:
42+
\`\`\`json
43+
"sourceloop": {
44+
"command": "npx",
45+
"args": ["@sourceloop/cli", "mcp"],
46+
"timeout": 300
47+
}
48+
\`\`\`
49+
`;
4150

4251
static readonly flags = {
4352
help: flags.boolean({
@@ -152,17 +161,20 @@ export class Mcp extends Base<{}> {
152161
switch (true) {
153162
case flag.type === 'boolean':
154163
option = z.boolean().optional();
164+
description += ` (ask user for this value if not provided)`;
155165
option = option.default((flag.default as boolean) ?? false);
156166
break;
157167
case this._isOptionFlag(flag) && flag.options !== undefined: {
168+
description += ` (ask user to provide an option if not provided when required, list the options as well)`;
158169
// typescript is not able to infer type
159170
const typedFlag = flag as IOptionFlag<T>;
160171
option = z.enum(typedFlag.options as [string, ...string[]]);
161172
description += ` (options: ${typedFlag.options?.join(', ')})`;
162173
break;
163174
}
164175
case this._isOptionFlag(flag) && flag.options === undefined:
165-
option = z.string();
176+
description += ` (ask user for this value if not provided)`;
177+
option = z.string().optional();
166178
break;
167179
default:
168180
throw new Error(

0 commit comments

Comments
 (0)