Skip to content

Commit df321d4

Browse files
jancurnclaude
andauthored
Improve CLI output messaging and reorder server details sections (#99)
* Better copy and help * Fix unit tests to match updated header text Update output.test.ts assertions to match the PR's renamed headers: "Available tools/resources/prompts/templates" → "Tools/Resources/Prompts/Templates" https://claude.ai/code/session_01Lr6hQ855QQbCKCtyspknw2 * Fix e2e test assertions to match updated header text Update human-output e2e test to match renamed headers: "Available tools/resources/prompts/templates" → "Tools/Resources/Prompts/Templates" https://claude.ai/code/session_01Lr6hQ855QQbCKCtyspknw2 --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 749319e commit df321d4

6 files changed

Lines changed: 34 additions & 33 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# IDE
22
.idea
33
.vscode
4+
.claude
45

56
# Dependencies
67
node_modules/

src/cli/commands/sessions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ export async function listSessionsAndAuthProfiles(options: {
457457
console.log(chalk.bold('No OAuth profiles.'));
458458
console.log(chalk.dim(' ↳ run: mcpc login mcp.example.com'));
459459
} else {
460-
console.log(chalk.bold('Available OAuth profiles:'));
460+
console.log(chalk.bold('Saved OAuth profiles:'));
461461
for (const profile of profiles) {
462462
const hostStr = getServerHost(profile.serverUrl);
463463
const nameStr = chalk.magenta(profile.name);

src/cli/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,8 @@ function createTopLevelProgram(): Command {
343343
`
344344
${chalk.bold('MCP session commands (after connecting):')}
345345
<@session> Show MCP server info and capabilities
346-
<@session> ${chalk.cyan('tools-list')} List MCP tools
347-
<@session> ${chalk.cyan('tools-get')} <name>
346+
<@session> ${chalk.cyan('tools-list')} List MCP server tools
347+
<@session> ${chalk.cyan('tools-get')} <name> Get tool details and schema
348348
<@session> ${chalk.cyan('tools-call')} <name> [arg:=val ... | <json> | <stdin]
349349
<@session> ${chalk.cyan('prompts-list')}
350350
<@session> ${chalk.cyan('prompts-get')} <name> [arg:=val ... | <json> | <stdin]

src/cli/output.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ function formatToolsSummary(tools: Tool[]): string[] {
464464
const lines: string[] = [];
465465

466466
// Header with tool count
467-
lines.push(chalk.bold(`Available tools (${tools.length}):`));
467+
lines.push(chalk.bold(`Tools (${tools.length}):`));
468468

469469
// Summary list of tools
470470
const bullet = chalk.dim('*');
@@ -497,7 +497,7 @@ function formatToolsCompact(tools: Tool[], options?: FormatOptions): string {
497497
const session = options?.sessionName ? `${options.sessionName} ` : '';
498498
lines.push('');
499499
lines.push(
500-
`For full tool details, run \`mcpc ${session}tools-list --full\` or \`mcpc ${session}tools-get <name>\``
500+
`For full tool details and schema, run \`mcpc ${session}tools-list --full\` or \`mcpc ${session}tools-get <name>\``
501501
);
502502

503503
return lines.join('\n');
@@ -570,7 +570,7 @@ export function formatResources(resources: Resource[]): string {
570570
const lines: string[] = [];
571571

572572
// Header with resource count
573-
lines.push(chalk.bold(`Available resources (${resources.length}):`));
573+
lines.push(chalk.bold(`Resources (${resources.length}):`));
574574

575575
// Summary list of resources
576576
const bullet = chalk.dim('*');
@@ -627,7 +627,7 @@ export function formatResourceTemplates(templates: ResourceTemplate[]): string {
627627
const lines: string[] = [];
628628

629629
// Header with template count
630-
lines.push(chalk.bold(`Available resource templates (${templates.length}):`));
630+
lines.push(chalk.bold(`Resource templates (${templates.length}):`));
631631

632632
// Summary list of templates
633633
const bullet = chalk.dim('*');
@@ -684,7 +684,7 @@ export function formatPrompts(prompts: Prompt[]): string {
684684
const lines: string[] = [];
685685

686686
// Header with prompt count
687-
lines.push(chalk.bold(`Available prompts (${prompts.length}):`));
687+
lines.push(chalk.bold(`Prompts (${prompts.length}):`));
688688

689689
// Summary list of prompts
690690
const bullet = chalk.dim('*');
@@ -1145,6 +1145,21 @@ export function formatServerDetails(
11451145
}
11461146
lines.push('');
11471147

1148+
// Tools list (from bridge cache, no extra server call)
1149+
if (tools && tools.length > 0) {
1150+
lines.push(formatToolsCompact(tools, { sessionName: target }));
1151+
lines.push('');
1152+
}
1153+
1154+
// Instructions in code block
1155+
const trimmed = instructions ? instructions.trim() : '';
1156+
if (trimmed) {
1157+
lines.push(chalk.bold('Instructions:'));
1158+
lines.push(chalk.gray('````'));
1159+
lines.push(trimmed);
1160+
lines.push(chalk.gray('````'));
1161+
}
1162+
11481163
// Commands
11491164
lines.push(chalk.bold('Available commands:'));
11501165
const commands: string[] = [];
@@ -1184,20 +1199,5 @@ export function formatServerDetails(
11841199
lines.push(commands.join('\n'));
11851200
lines.push('');
11861201

1187-
// Tools list (from bridge cache, no extra server call)
1188-
if (tools && tools.length > 0) {
1189-
lines.push(formatToolsCompact(tools, { sessionName: target }));
1190-
lines.push('');
1191-
}
1192-
1193-
// Instructions in code block
1194-
const trimmed = instructions ? instructions.trim() : '';
1195-
if (trimmed) {
1196-
lines.push(chalk.bold('Instructions:'));
1197-
lines.push(chalk.gray('````'));
1198-
lines.push(trimmed);
1199-
lines.push(chalk.gray('````'));
1200-
}
1201-
12021202
return lines.join('\n');
12031203
}

test/e2e/suites/basic/human-output.test.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ test_pass
2525
test_case "tools-list contains header with count"
2626
run_mcpc "$SESSION" tools-list
2727
assert_success
28-
assert_contains "$STDOUT" "Available tools"
28+
assert_contains "$STDOUT" "Tools ("
2929
test_pass
3030

3131
test_case "tools-list contains tool names in backticks"
@@ -86,7 +86,7 @@ test_pass
8686
test_case "resources-list contains header with count"
8787
run_mcpc "$SESSION" resources-list
8888
assert_success
89-
assert_contains "$STDOUT" "Available resources"
89+
assert_contains "$STDOUT" "Resources ("
9090
test_pass
9191

9292
test_case "resources-list contains resource URIs"
@@ -114,7 +114,7 @@ test_pass
114114
test_case "resources-templates-list contains header"
115115
run_mcpc "$SESSION" resources-templates-list
116116
assert_success
117-
assert_contains "$STDOUT" "Available resource templates"
117+
assert_contains "$STDOUT" "Resource templates ("
118118
test_pass
119119

120120
test_case "resources-templates-list contains URI templates"
@@ -130,7 +130,7 @@ test_pass
130130
test_case "prompts-list contains header with count"
131131
run_mcpc "$SESSION" prompts-list
132132
assert_success
133-
assert_contains "$STDOUT" "Available prompts"
133+
assert_contains "$STDOUT" "Prompts ("
134134
test_pass
135135

136136
test_case "prompts-list contains prompt names"

test/unit/cli/output.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ describe('formatTools', () => {
466466
describe('compact format (default)', () => {
467467
it('should show header with tool count', () => {
468468
const output = formatTools(sampleTools);
469-
expect(output).toContain('Available tools (2):');
469+
expect(output).toContain('Tools (2):');
470470
});
471471

472472
it('should show tool names in backticks', () => {
@@ -570,7 +570,7 @@ describe('formatTools', () => {
570570

571571
it('should handle empty tools array', () => {
572572
const output = formatTools([]);
573-
expect(output).toContain('Available tools (0):');
573+
expect(output).toContain('Tools (0):');
574574
});
575575

576576
it('should show task mode for tools with task support', () => {
@@ -1008,7 +1008,7 @@ describe('formatResources', () => {
10081008
const output = formatResources(resources);
10091009

10101010
// Should have header with count
1011-
expect(output).toContain('Available resources (2):');
1011+
expect(output).toContain('Resources (2):');
10121012

10131013
// Should have summary list
10141014
expect(output).toContain('* `file:///home/user/data.json`');
@@ -1024,7 +1024,7 @@ describe('formatResources', () => {
10241024
it('should show empty list message for no resources', () => {
10251025
const resources: Resource[] = [];
10261026
const output = formatResources(resources);
1027-
expect(output).toContain('Available resources (0):');
1027+
expect(output).toContain('Resources (0):');
10281028
});
10291029
});
10301030

@@ -1092,7 +1092,7 @@ describe('formatResourceTemplates', () => {
10921092
const output = formatResourceTemplates(templates);
10931093

10941094
// Should have header with count
1095-
expect(output).toContain('Available resource templates (2):');
1095+
expect(output).toContain('Resource templates (2):');
10961096

10971097
// Should have summary list
10981098
expect(output).toContain('* `file:///{path}`');
@@ -1152,7 +1152,7 @@ describe('formatPrompts', () => {
11521152
const output = formatPrompts(prompts);
11531153

11541154
// Should have header with count
1155-
expect(output).toContain('Available prompts (2):');
1155+
expect(output).toContain('Prompts (2):');
11561156

11571157
// Should have summary list
11581158
expect(output).toContain('* `greeting`');

0 commit comments

Comments
 (0)