Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Allow `execute --get-schema` without user context (#3032)

Rahul Tarak4c9d69743d21
diff --git a/ts/packages/cli/src/commands/connected-accounts/connected-accounts.cmd.ts b/ts/packages/cli/src/commands/connected-accounts/connected-accounts.cmd.ts
index e84a33736..85b2d7734 100644
--- a/ts/packages/cli/src/commands/connected-accounts/connected-accounts.cmd.ts
+++ b/ts/packages/cli/src/commands/connected-accounts/connected-accounts.cmd.ts
@@ -3,6 +3,7 @@ import { connectedAccountsCmd$List } from './commands/connected-accounts.list.cm
import { connectedAccountsCmd$Info } from './commands/connected-accounts.info.cmd';
import { connectedAccountsCmd$Whoami } from './commands/connected-accounts.whoami.cmd';
import { connectedAccountsCmd$Delete } from './commands/connected-accounts.delete.cmd';
+import { connectedAccountsCmd$Link } from './commands/connected-accounts.link.cmd';
/**
* CLI entry point for connected account management commands.
@@ -15,6 +16,7 @@ import { connectedAccountsCmd$Delete } from './commands/connected-accounts.delet
export const connectedAccountsCmd = Command.make('connected-accounts').pipe(
Command.withDescription('View and manage Composio connected accounts.'),
Command.withSubcommands([
+ connectedAccountsCmd$Link,
connectedAccountsCmd$List,
connectedAccountsCmd$Info,
connectedAccountsCmd$Whoami,
diff --git a/ts/packages/cli/src/commands/projects/commands/projects.switch.cmd.ts b/ts/packages/cli/src/commands/projects/commands/projects.switch.cmd.ts
index c4c915dbf..423005392 100644
--- a/ts/packages/cli/src/commands/projects/commands/projects.switch.cmd.ts
+++ b/ts/packages/cli/src/commands/projects/commands/projects.switch.cmd.ts
@@ -8,7 +8,7 @@ export const projectsCmd$Switch = Command.make('switch', {}).pipe(
Effect.gen(function* () {
const ui = yield* TerminalUI;
yield* ui.log.info(
- 'Run `composio dev init` in a directory to bind it to a developer project.'
+ 'Global developer project switching is no longer supported. Run `composio dev init` in a directory to bind it to a developer project.'
);
})
)
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.ts
index 07308e522..e79d190ee 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
@@ -649,6 +649,20 @@ type ParsedParallelExecuteArgs = SharedRunToolsExecuteParams & {
readonly specs: ReadonlyArray<ParallelExecuteSpec>;
};
+type ParallelExecuteResult =
+ | {
+ readonly slug: string;
+ readonly successful: true;
+ readonly version: string | null;
+ readonly schemaPath: string;
+ readonly inputSchema: Record<string, unknown>;
+ }
+ | {
+ readonly slug: string;
+ readonly successful: false;
+ readonly error: string;
+ };
+
type ResolvedExecuteContext = {
readonly ui: TerminalUI;
readonly executor: ToolsExecutor;
@@ -664,6 +678,16 @@ type ResolvedExecuteContext = {
readonly executeOutputDir?: string;
};
+type ResolvedSchemaContext = {
+ readonly ui: TerminalUI;
+ readonly resolvedProject: {
+ readonly orgId: string;
+ readonly projectId: string;
+ readonly projectType: 'CONSUMER' | 'DEVELOPER';
+ readonly consumerUserId?: string;
+ };
+};
+
const emitCachedSchema = (
ui: TerminalUI,
slug: string,
@@ -757,6 +781,21 @@ const resolveExecuteContext = (params: RunToolsExecuteParams) =>
} satisfies ResolvedExecuteContext;
});
+const resolveSchemaContext = (params: SharedRunToolsExecuteParams) =>
+ Effect.gen(function* () {
+ const resolvedProject = yield* resolveCommandProject({
+ mode: params.projectMode,
+ projectName:
+ params.surface === 'root' ? undefined : Option.getOrUndefined(params.projectName),
+ }).pipe(Effect.mapError(formatResolveCommandProjectError));
+ const ui = yield* TerminalUI;
+
+ return {
+ ui,
+ resolvedProject,
+ } satisfies ResolvedSchemaContext;
+ });
+
const runConnectedToolkitFailFast = (params: {
readonly slug: string;
readonly surface: 'root' | 'dev';
@@ -1112,8 +1151,8 @@ const runToolsExecute = (params: RunToolsExecuteParams) =>
Effect.gen(function* () {
if (!(yield* requireAuth)) return;
- const context = yield* resolveExecuteContext(params);
if (params.getSchema) {
+ const context = yield* resolveSchemaContext(params);
const definition = yield* getOrFetchToolInputDefinition(params.slug, {
orgId: context.resolvedProject.orgId,
projectId: context.resolvedProject.projectId,
@@ -1121,7 +1160,7 @@ const runToolsExecute = (params: RunToolsExecuteParams) =>
Effect.tapError(error =>
emitExecuteFailureTelemetry({
toolSlug: params.slug,
- args: context.args,
+ args: {},
error,
surface: params.surface,
projectMode: params.projectMode,
@@ -1133,6 +1172,8 @@ const runToolsExecute = (params: RunToolsExecuteParams) =>
return;
}
+ const context = yield* resolveExecuteContext(params);
+
yield* runConnectedToolkitFailFast({
slug: params.slug,
surface: params.surface,
@@ -1367,10 +1408,102 @@ const checkConnectedToolkitOrFail = (params: {
}
});
+const runParallelSchemaFetchFromParsed = (params: ParsedParallelExecuteArgs) =>
+ Effect.gen(function* () {
+ const contexts = yield* Effect.forEach(
+ params.specs,
+ () =>
+ resolveSchemaContext({
+ userId: params.userId,
+ projectName: params.projectName,
+ surface: params.surface,
+ projectMode: params.projectMode,
+ getSchema: params.getSchema,
+ dryRun: params.dryRun,
+ skipConnectionCheck: params.skipConnectionCheck,
+ skipToolParamsCheck: params.skipToolParamsCheck,
+ skipChecks: params.skipChecks,
+ }),
+ { concurrency: 'unbounded' }
+ );
+ const entries = contexts.map((context, index) => ({
+ context,
+ spec: params.specs[index]!,
+ }));
+
+ const ui = contexts[0]?.ui;
+ const results = yield* Effect.forEach(
+ entries,
+ ({ context, spec }) =>
+ Effect.gen(function* () {
+ const definition = yield* getOrFetchToolInputDefinition(spec.slug, {
+ orgId: context.resolvedProject.orgId,
+ projectId: context.resolvedProject.projectId,
+ });
+ return {
+ slug: spec.slug,
+ successful: true,
+ version: definition.version,
+ schemaPath: definition.schemaPath,
+ inputSchema: definition.schema,
+ } satisfies Extract<
+ ParallelExecuteResult,
+ { readonly inputSchema: Record<string, unknown> }
+ >;
+ }).pipe(
+ Effect.catchAll(error => {
+ const mapped = mapComposioError({ error, toolSlug: spec.slug });
+ return Effect.succeed({
+ slug: spec.slug,
+ successful: false,
+ error: mapped.message,
+ } satisfies Extract<ParallelExecuteResult, { readonly successful: false }>);
+ })
+ ),
+ { concurrency: 'unbounded' }
+ );
+
+ if (ui) {
+ for (const result of results) {
+ if (!result.successful) {
+ yield* ui.log.error(`[${result.slug}] ${result.error}`);
+ continue;
+ }
+
+ yield* ui.log.step(`[${result.slug}] Schema fetched: ${result.schemaPath}`);
+ }
+
+ const successful = results.every(result => result.successful);
+ yield* ui.log.message(
+ `Parallel execute completed: ${results.filter(result => result.successful).length}/${results.length} successful`
+ );
+ yield* ui.output(
+ JSON.stringify(
+ {
+ successful,
+ parallel: true,
+ results,
+ },
+ ciRedactReplacer,
+ 2
+ )
+ );
+ if (!successful) {
+ return yield* Effect.fail(
+ new ToolExecutionError('One or more parallel tool executions failed.')
+ );
+ }
+ }
+ });
+
const runParallelToolsExecuteFromParsed = (params: ParsedParallelExecuteArgs) =>
Effect.gen(function* () {
if (!(yield* requireAuth)) return;
+ if (params.getSchema) {
+ return yield* runParallelSchemaFetchFromParsed(params);
+ }
+
const contexts = yield* Effect.forEach(
params.specs,
spec =>
@@ -1402,20 +1535,6 @@ const runParallelToolsExecuteFromParsed = (params: ParsedParallelExecuteArgs) =>
const toolSlug = spec.slug;
try {
- if (params.getSchema) {
- const definition = yield* getOrFetchToolInputDefinition(toolSlug, {
- orgId: context.resolvedProject.orgId,
- projectId: context.resolvedProject.projectId,
- });
- return {
- slug: toolSlug,
- successful: true,
- version: definition.version,
- schemaPath: definition.schemaPath,
- inputSchema: definition.schema,
- };
- }
-
yield* checkConnectedToolkitOrFail({
slug: toolSlug,
resolvedProject: context.resolvedProject,
diff --git a/ts/packages/cli/src/commands/triggers/triggers.cmd.ts b/ts/packages/cli/src/commands/triggers/triggers.cmd.ts
index 09655f0d3..8c1536a89 100644
--- a/ts/packages/cli/src/commands/triggers/triggers.cmd.ts
+++ b/ts/packages/cli/src/commands/triggers/triggers.cmd.ts
@@ -6,6 +6,7 @@ import { triggersCmd$Create } from './commands/triggers.create.cmd';
import { triggersCmd$Enable } from './commands/triggers.enable.cmd';
import { triggersCmd$Disable } from './commands/triggers.disable.cmd';
import { triggersCmd$Delete } from './commands/triggers.delete.cmd';
+import { triggersCmd$Listen } from './commands/triggers.listen.cmd';
/**
* CLI entry point for realtime trigger commands.
@@ -18,6 +19,7 @@ import { triggersCmd$Delete } from './commands/triggers.delete.cmd';
export const triggersCmd = Command.make('triggers').pipe(
Command.withDescription('Inspect and subscribe to trigger events.'),
Command.withSubcommands([
+ triggersCmd$Listen,
triggersCmd$List,
triggersCmd$Info,
triggersCmd$Status,
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.ts
index c333c737e..3390aae3d 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
@@ -664,6 +664,73 @@ describe('CLI: composio execute', () => {
);
});
+ layer(
+ TestLive({
+ baseConfigProvider: testConfigProvider,
+ fixture: 'user-config-with-global-context',
+ stdin: { isTTY: true, data: '' },
+ toolkitsData: {
+ tools: [
+ {
+ name: 'Create Issue',
+ slug: 'GITHUB_CREATE_AN_ISSUE',
+ description: 'Create a GitHub issue',
+ tags: ['github'],
+ available_versions: ['20260316_00'],
+ input_parameters: {
+ type: 'object',
+ properties: {
+ owner: { type: 'string' },
+ repo: { type: 'string' },
+ title: { type: 'string' },
+ body: { type: 'string' },
+ },
+ },
+ output_parameters: {
+ type: 'object',
+ properties: {
+ html_url: { type: 'string' },
+ },
+ },
+ },
+ ],
+ },
+ })
+ )(
+ '[Given] composio execute --get-schema without a configured test user id [Then] it still works',
+ it => {
+ it.scoped('does not require execution user context for schema fetches', () =>
+ Effect.gen(function* () {
+ const cacheDir = yield* setupCacheDir;
+ const schemaPath = `${cacheDir}/tool_definitions/GITHUB_CREATE_AN_ISSUE.json`;
+
+ yield* cli(['execute', 'GITHUB_CREATE_AN_ISSUE', '--get-schema']);
+ const lines = yield* MockConsole.getLines({ stripAnsi: true });
+ const output = parseLastJson(lines) as unknown as {
+ slug: string;
+ version: string | null;
+ schemaPath: string;
+ inputSchema: Record<string, unknown>;
+ };
+
+ expect(output.slug).toBe('GITHUB_CREATE_AN_ISSUE');
+ expect(output.version).toBe('20260316_00');
+ expect(output.schemaPath).toBe(schemaPath);
+ expect(output.inputSchema).toEqual({
+ type: 'object',
+ properties: {
+ owner: { type: 'string' },
+ repo: { type: 'string' },
+ title: { type: 'string' },
+ body: { type: 'string' },
+ },
+ });
+ expect(fs.existsSync(schemaPath)).toBe(true);
+ })
+ );
+ }
+ );
+
layer(
TestLive({
baseConfigProvider: testConfigProvider,