docs: add list_tools shortcut
This commit is contained in:
parent
1ba1e6a2a9
commit
bcbf06ba5c
@ -5,6 +5,9 @@
|
||||
### CLI & runtime
|
||||
- _Nothing yet._
|
||||
|
||||
### CLI
|
||||
- Added `list_tools` as a hidden shortcut for `mcporter list <server>`, 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
|
||||
|
||||
@ -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`.
|
||||
|
||||
@ -117,6 +117,15 @@ async function maybeDescribeServer(
|
||||
tool: string,
|
||||
outputFormat: OutputFormat
|
||||
): Promise<boolean> {
|
||||
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;
|
||||
}
|
||||
|
||||
@ -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: '<test>' },
|
||||
};
|
||||
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(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user