diff --git a/CHANGELOG.md b/CHANGELOG.md index 03f36a6..10cbe4c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ ### CLI & runtime - _Nothing yet._ +### CLI +- Added `list_tools` as a hidden shortcut for `mcporter list `, so `chrome-devtools.list_tools` (and similar selectors) print the tool catalog instantly without requiring a real MCP tool. + ## [0.5.6] - 2025-11-11 ### CLI & runtime diff --git a/docs/shortcuts.md b/docs/shortcuts.md index d6876ff..f03df15 100644 --- a/docs/shortcuts.md +++ b/docs/shortcuts.md @@ -26,5 +26,6 @@ These undocumented shortcuts are safe for MCP agents to call when they need a qu 1. Agents wanting prose guidance should run `pnpm mcp call chrome-devtools.help`. 2. If the server lacks a `help` tool, the command emits a dim hint and then shows the `describe`/`list` output so the agent still learns about the server. 3. For a guaranteed TypeScript-style summary, skip straight to `mcporter describe chrome-devtools --schema`. +4. Need the tool menu immediately? Call `pnpm mcp call chrome-devtools.list_tools`—it’s a shortcut for `mcporter list chrome-devtools`. > Note: `chrome-devtools` currently ships without a `help` tool, so step 1 always triggers the fallback and prints the same schema-rich output you would see from `mcporter list`. diff --git a/src/cli/call-command.ts b/src/cli/call-command.ts index 3766f2c..16fc05c 100644 --- a/src/cli/call-command.ts +++ b/src/cli/call-command.ts @@ -117,6 +117,15 @@ async function maybeDescribeServer( tool: string, outputFormat: OutputFormat ): Promise { + if (tool === 'list_tools') { + console.log(dimText(`[mcporter] ${server}.list_tools is a shortcut for 'mcporter list ${server}'.`)); + const listArgs = [server]; + if (outputFormat === 'json') { + listArgs.push('--json'); + } + await handleList(runtime, listArgs); + return true; + } if (tool !== 'help') { return false; } diff --git a/tests/cli-call-execution.test.ts b/tests/cli-call-execution.test.ts index bd3a4e3..1171ffe 100644 --- a/tests/cli-call-execution.test.ts +++ b/tests/cli-call-execution.test.ts @@ -206,6 +206,29 @@ describe('CLI call execution behavior', () => { logSpy.mockRestore(); } }); + + it('treats list_tools selector as a shortcut for mcporter list', async () => { + const listModule = await import('../src/cli/list-command.js'); + const listSpy = vi.spyOn(listModule, 'handleList').mockResolvedValue(undefined); + const { handleCall } = await cliModulePromise; + const definition: ServerDefinition = { + name: 'chrome-devtools', + description: 'Chrome DevTools MCP server', + command: { kind: 'stdio', command: 'chrome-devtools', args: [], cwd: process.cwd() }, + source: { kind: 'local', path: '' }, + }; + const { runtime, callTool } = createRuntimeStub({ 'chrome-devtools': [] }, { definitions: [definition] }); + + try { + await handleCall(runtime, ['chrome-devtools.list_tools']); + await handleCall(runtime, ['chrome-devtools.list_tools', '--output', 'json']); + expect(listSpy).toHaveBeenNthCalledWith(1, runtime, ['chrome-devtools']); + expect(listSpy).toHaveBeenNthCalledWith(2, runtime, ['chrome-devtools', '--json']); + expect(callTool).not.toHaveBeenCalled(); + } finally { + listSpy.mockRestore(); + } + }); }); function createRuntimeStub(