@devries-cameron20 / composio-1 / commits / e1e6867e7
Fork 0

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

fix: use _def.typeName instead of instanceof for z.object() check

The instanceof z.ZodObject check fails when the user imports their own zod/v3 instance (different from the one bundled in @composio/core). Using _def.typeName === 'ZodObject' works across Zod instances, fixing the E2E test failure in node-custom-tools. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

Dhawal Upadhyay committed Mar 18, 2026 at 13:17 UTC e1e6867e786699fe12e51186430ac7a9ebc4c337
1 file changed +3 -1
ts/packages/core/src/models/CustomTool.ts
+3 -1
@@ -128,7 +128,9 @@ export function createCustomTool<T extends z.ZodType>(
128 if (!options.inputParams) {
129 throw new ValidationError('createCustomTool: inputParams is required');
130 }
131 - if (!(options.inputParams instanceof z.ZodObject)) {
131 + // Check for z.object() — use _def.typeName instead of instanceof to work
132 + // across different Zod instances (e.g. when user imports their own zod/v3)
133 + if ((options.inputParams as any)?._def?.typeName !== 'ZodObject') {
134 throw new ValidationError(
135 'createCustomTool: inputParams must be a z.object() schema. ' +
136 'Tool input parameters are always an object with named properties.'