Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
TypeScript agentic-aiagentsaiai-agentsaiagentsdeveloper-toolsfunction-callinggpt-4javascriptjsllmllmopsmcppythonremote-mcp-serverssetypescript
feat(cli): default to empty object when no -d provided, use -d "{}" in search CTA for empty schemas
haxzie68c6e502b8bb
diff --git a/.changeset/vast-showers-lose.md b/.changeset/vast-showers-lose.mdnew file mode 100644index 000000000..3f971a692--- /dev/null+++ b/.changeset/vast-showers-lose.md@@ -0,0 +1,6 @@+---+'@composio/cli': patch+---++- Execute: Default to empty object `{}` when no -d/--data or piped stdin provided+- Search CTA: Use `-d "{}"` for tools with no schema properties (shell-safe)diff --git a/ts/packages/cli/src/commands/tools/commands/tools.execute.cmd.ts b/ts/packages/cli/src/commands/tools/commands/tools.execute.cmd.tsindex 5a1ddf37b..0d703e880 100644--- a/ts/packages/cli/src/commands/tools/commands/tools.execute.cmd.ts+++ b/ts/packages/cli/src/commands/tools/commands/tools.execute.cmd.ts@@ -63,9 +63,8 @@ const resolveInput = (input: Option.Option<string>) =>return piped.value;}- return yield* Effect.fail(- new Error('Missing JSON input. Provide -d/--data or pipe JSON to stdin.')- );+ // Default to empty object when no data provided (e.g. tools with no required args)+ return '{}';});const parseArguments = (raw: string) =>diff --git a/ts/packages/cli/src/commands/tools/commands/tools.search.cmd.ts b/ts/packages/cli/src/commands/tools/commands/tools.search.cmd.tsindex 4314ef70a..0cd5cbc39 100644--- a/ts/packages/cli/src/commands/tools/commands/tools.search.cmd.ts+++ b/ts/packages/cli/src/commands/tools/commands/tools.search.cmd.ts@@ -185,9 +185,10 @@ export const toolsCmd$Search = Command.make(firstSchema?.input_schema as Record<string, unknown>);const payloadJson = JSON.stringify(payload);+ const dataArg = Object.keys(payload).length === 0 ? '-d "{}"' : `-d '${payloadJson}'`;cta.push({action: 'Execute a tool',- command: `composio execute "${firstSlug}" -d '${payloadJson}'`,+ command: `composio execute "${firstSlug}" ${dataArg}`,});}if (firstToolkit) {diff --git a/ts/packages/cli/test/src/commands/tools/tools.execute.cmd.test.ts b/ts/packages/cli/test/src/commands/tools/tools.execute.cmd.test.tsindex c7f696dc6..ffcaf3212 100644--- a/ts/packages/cli/test/src/commands/tools/tools.execute.cmd.test.ts+++ b/ts/packages/cli/test/src/commands/tools/tools.execute.cmd.test.ts@@ -599,22 +599,22 @@ describe('CLI: composio tools execute', () => {TestLive({baseConfigProvider: testConfigProvider,stdin: { isTTY: true, data: '' },+ toolsExecutor: {+ respondWith: {+ data: { executed: true },+ error: null,+ successful: true,+ },+ },})- )('[Given] no -d and TTY stdin [Then] fails with missing input error', it => {- it.scoped('fails with missing input error', () =>+ )('[Given] no -d and TTY stdin [Then] defaults to empty object and executes', it => {+ it.scoped('defaults to {} when no data provided', () =>Effect.gen(function* () {- const result = yield* cli([- 'tools',- 'execute',- 'GMAIL_SEND_EMAIL',- '--user-id',- 'default',- ]).pipe(Effect.catchAll(e => Effect.succeed(e)));-- expect(result).toBeDefined();- expect(result instanceof Error ? result.message : String(result)).toContain(- 'Missing JSON input'- );+ yield* cli(['tools', 'execute', 'GMAIL_SEND_EMAIL', '--user-id', 'default']);+ const lines = yield* MockConsole.getLines({ stripAnsi: true });+ const output = lines.join('\n');+ expect(output).toContain('successful');+ expect(output).toContain('executed');}));});diff --git a/ts/packages/cli/test/src/commands/tools/tools.search.cmd.test.ts b/ts/packages/cli/test/src/commands/tools/tools.search.cmd.test.tsindex 2fb6885c1..be164f396 100644--- a/ts/packages/cli/test/src/commands/tools/tools.search.cmd.test.ts+++ b/ts/packages/cli/test/src/commands/tools/tools.search.cmd.test.ts@@ -179,6 +179,28 @@ describe('CLI: composio tools search', () => {});+ layer(TestLive(testLiveOptions))(+ '[Given] search with empty schema [Then] CTA execute uses -d "{}"',+ it => {+ it.scoped('CTA uses -d "{}" when no schema properties', () =>+ Effect.gen(function* () {+ yield* cli(['tools', 'search', 'send']);+ const lines = yield* MockConsole.getLines({ stripAnsi: true });+ const output = lines.join('\n');++ const ctaMatch = output.match(/"CTA":\s*\[([\s\S]*?)\]/);+ expect(ctaMatch).toBeTruthy();+ const ctaJson = `[${ctaMatch![1]}]`;+ const cta = JSON.parse(ctaJson) as Array<{ action: string; command: string }>;++ const executeCta = cta.find(c => c.action === 'Execute a tool');+ expect(executeCta).toBeTruthy();+ expect(executeCta!.command).toContain('-d "{}"');+ })+ );+ }+ );+layer(TestLive(testLiveOptions))('[Given] --toolkits filter [Then] it is passed to session create as enabled toolkits',it => {