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
fix: use _def.typeName instead of instanceof for z.object() check
Dhawal Upadhyaye1e6867e7866
diff --git a/ts/packages/core/src/models/CustomTool.ts b/ts/packages/core/src/models/CustomTool.tsindex 618f69619..61fd84f65 100644--- a/ts/packages/core/src/models/CustomTool.ts+++ b/ts/packages/core/src/models/CustomTool.ts@@ -128,7 +128,9 @@ export function createCustomTool<T extends z.ZodType>(if (!options.inputParams) {throw new ValidationError('createCustomTool: inputParams is required');}- if (!(options.inputParams instanceof z.ZodObject)) {+ // Check for z.object() — use _def.typeName instead of instanceof to work+ // across different Zod instances (e.g. when user imports their own zod/v3)+ if ((options.inputParams as any)?._def?.typeName !== 'ZodObject') {throw new ValidationError('createCustomTool: inputParams must be a z.object() schema. ' +'Tool input parameters are always an object with named properties.'