Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 22, 08:15 UTC
fix(cli): address code review findings for tools command
- Rename --search to --query on `tools list` for consistency with `toolkits list` - Remove dead code path in formatSchemaProperties (unreachable entries.length check) - Enrich getToolDetailed mock to derive toolkit slug from tool slug prefix - Add --tags filter test for `tools list` - Add assertion for toolkit hint in `tools info` test - Add tags filtering support to searchTools mock - Add VHS recording entries for tools subcommands
jkomyno committed
Feb 19, 2026 at 10:38 UTC
86ac439c18148ac91667b3c33b25a4b054cafa58
7 files changed
+85
-13
ts/packages/cli/recordings/recordings.yaml
+47
@@ -103,3 +103,50 @@ recordings:
103
- name: list-query-gmaxx
104
description: List with no results
105
command: "composio toolkits list --query 'gmaxx'"
106
+
107
+ tools:
108
+ - name: help
109
+ description: Show tools subcommand help
110
+ command: "composio tools --help"
111
+ height: dynamic
112
+
113
+ - name: list-toolkit-gmail
114
+ description: List tools in a toolkit
115
+ command: "composio tools list --toolkits gmail"
116
+ height: dynamic
117
+
118
+ - name: list-toolkit-gmail-limit-3
119
+ description: List with --limit flag
120
+ command: "composio tools list --toolkits gmail --limit 3"
121
+
122
+ - name: list-search-send-email
123
+ description: List with --search filter
124
+ command: "composio tools list --search 'send email'"
125
+ height: dynamic
126
+
127
+ - name: list-search-no-results
128
+ description: List with no results
129
+ command: "composio tools list --toolkits 'nonexistent'"
130
+
131
+ - name: search-send-email
132
+ description: Search tools by use case
133
+ command: "composio tools search 'send email'"
134
+ height: dynamic
135
+
136
+ - name: search-no-results
137
+ description: Search with no results
138
+ command: "composio tools search 'xyznonexistent'"
139
+
140
+ - name: info
141
+ description: Show info without arguments
142
+ command: "composio tools info"
143
+
144
+ - name: info-gmail-send-email
145
+ description: Show tool details
146
+ command: "composio tools info GMAIL_SEND_EMAIL"
147
+ height: dynamic
148
+
149
+ - name: info-nonexistent
150
+ description: Info with nonexistent tool
151
+ command: "composio tools info NONEXISTENT_TOOL"
152
+ height: dynamic
ts/packages/cli/src/commands/tools/commands/tools.list.cmd.ts
+5
-5
@@ -5,7 +5,7 @@ import { ComposioUserContext } from 'src/services/user-context';
5
import { TerminalUI } from 'src/services/terminal-ui';
6
import { formatToolsTable, formatToolsJson } from '../format';
7
8
-const search = Options.text('search').pipe(
8
+const query = Options.text('query').pipe(
9
Options.withDescription('Text search by name, slug, or description'),
10
Options.optional
11
);
@@ -33,14 +33,14 @@ const limit = Options.integer('limit').pipe(
33
* @example
34
* ```bash
35
* composio tools list --toolkits "gmail"
36
- * composio tools list --search "send email" --toolkits "gmail"
36
+ * composio tools list --query "send email" --toolkits "gmail"
37
* composio tools list --tags "important" --limit 10
38
* ```
39
*/
40
export const toolsCmd$List = Command.make(
41
'list',
42
- { search, toolkits, tags, limit },
43
- ({ search, toolkits, tags, limit }) =>
42
+ { query, toolkits, tags, limit },
43
+ ({ query, toolkits, tags, limit }) =>
44
Effect.gen(function* () {
45
const ui = yield* TerminalUI;
46
const ctx = yield* ComposioUserContext;
@@ -57,7 +57,7 @@ export const toolsCmd$List = Command.make(
57
const result = yield* ui.withSpinner(
58
'Fetching tools...',
59
repo.searchTools({
60
- search: Option.getOrUndefined(search),
60
+ search: Option.getOrUndefined(query),
61
toolkit_slug: Option.getOrUndefined(toolkits),
62
tags: Option.getOrUndefined(tags),
63
limit: clampedLimit,
ts/packages/cli/src/commands/tools/format.ts
-4
@@ -62,10 +62,6 @@ function formatSchemaProperties(schema: Record<string, unknown>): string {
62
return { name, type, label, description };
63
});
64
65
- if (entries.length === 0) {
66
- return ' (none)';
67
- }
68
-
65
const nameWidth = Math.max(...entries.map(e => e.name.length));
66
const typeWidth = Math.max(...entries.map(e => e.type.length));
67
const labelWidth = Math.max(...entries.map(e => e.label.length));
ts/packages/cli/test/__utils__/services/test-layer.ts
+11
-1
@@ -270,6 +270,13 @@ export const TestLayer = (input?: TestLiveInput) =>
270
);
271
}
272
273
+ if (params.tags) {
274
+ const tagList = params.tags.split(',').map(t => t.trim().toLowerCase());
275
+ results = results.filter(t =>
276
+ tagList.some(tag => t.tags.map(tt => tt.toLowerCase()).includes(tag))
277
+ );
278
+ }
279
+
280
const limit = params.limit ?? 30;
281
const items = results.slice(0, limit);
282
return Effect.succeed({
@@ -285,10 +292,13 @@ export const TestLayer = (input?: TestLiveInput) =>
292
new HttpServerError({ cause: `Tool "${slug}" not found`, status: 404 })
293
);
294
}
295
+ // Derive toolkit slug from tool slug prefix (e.g. GMAIL_SEND_EMAIL -> gmail)
296
+ const parts = found.slug.split('_');
297
+ const toolkitSlug = parts.length > 1 ? parts[0]!.toLowerCase() : '';
298
return Effect.succeed({
299
...found,
300
no_auth: false,
291
- toolkit: { name: '', slug: '' },
301
+ toolkit: { name: toolkitSlug, slug: toolkitSlug },
302
});
303
},
304
getToolkitDetailed: (slug: string) => {
ts/packages/cli/test/src/commands/$default.cmd.test.ts
+1
-1
@@ -94,7 +94,7 @@ describe('CLI: composio', () => {
94
95
- tools Discover and inspect Composio tools.
96
97
- - tools list [--search text] [--toolkits text] [--tags text] [--limit integer] List available tools.
97
+ - tools list [--query text] [--toolkits text] [--tags text] [--limit integer] List available tools.
98
99
- tools info [<slug>] View details of a specific tool.
100
ts/packages/cli/test/src/commands/tools/tools.info.cmd.test.ts
+2
@@ -66,6 +66,8 @@ describe('CLI: composio tools info', () => {
66
expect(output).toContain('required');
67
expect(output).toContain('Output Parameters');
68
expect(output).toContain('message_id');
69
+ // Verify next-step hint includes derived toolkit slug
70
+ expect(output).toContain('composio tools list --toolkits "gmail"');
71
})
72
);
73
}
ts/packages/cli/test/src/commands/tools/tools.list.cmd.test.ts
+19
-2
@@ -92,11 +92,11 @@ describe('CLI: composio tools list', () => {
92
);
93
94
layer(TestLive({ baseConfigProvider: testConfigProvider, toolkitsData }))(
95
- '[Given] --search "send" [Then] shows filtered results',
95
+ '[Given] --query "send" [Then] shows filtered results',
96
it => {
97
it.scoped('filters by search query', () =>
98
Effect.gen(function* () {
99
- yield* cli(['tools', 'list', '--search', 'send']);
99
+ yield* cli(['tools', 'list', '--query', 'send']);
100
const lines = yield* MockConsole.getLines({ stripAnsi: true });
101
const output = lines.join('\n');
102
@@ -150,6 +150,23 @@ describe('CLI: composio tools list', () => {
150
}
151
);
152
153
+ layer(TestLive({ baseConfigProvider: testConfigProvider, toolkitsData }))(
154
+ '[Given] --tags "email" [Then] filters by tag',
155
+ it => {
156
+ it.scoped('filters by tag', () =>
157
+ Effect.gen(function* () {
158
+ yield* cli(['tools', 'list', '--tags', 'email']);
159
+ const lines = yield* MockConsole.getLines({ stripAnsi: true });
160
+ const output = lines.join('\n');
161
+
162
+ expect(output).toContain('GMAIL_SEND_EMAIL');
163
+ expect(output).toContain('GMAIL_CREATE_DRAFT');
164
+ expect(output).not.toContain('SLACK_SEND_MESSAGE');
165
+ })
166
+ );
167
+ }
168
+ );
169
+
170
layer(TestLive({ baseConfigProvider: testConfigProvider, toolkitsData }))(
171
'[Given] --toolkits "nonexistent" [Then] shows no tools found with hint',
172
it => {