{"record":{"id":"31b468ff575dfecb","repo":"ComposioHQ/composio","slug":"tool-input-parameters-are-not-defined","errorCode":null,"errorMessage":"Tool input parameters are not defined","messagePattern":"Tool input parameters are not defined","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"ts/packages/providers/langchain/src/index.ts","lineNumber":138,"sourceCode":"   * const result = await executor.invoke({\n   *   input: \"Search for information about Composio\"\n   * });\n   * ```\n   */\n  wrapTool(tool: Tool, executeTool: ExecuteToolFn): DynamicStructuredTool {\n    const toolName = tool.slug;\n    const description = tool.description;\n    const appName = tool.toolkit?.name?.toLowerCase();\n    if (!appName) {\n      throw new Error('App name is not defined');\n    }\n    const func = async (...args: unknown[]): Promise<unknown> => {\n      // Models occasionally emit tool input as a JSON string rather than an object (issue #2406).\n      const result = await executeTool(toolName, normalizeToolArguments(args[0], toolName));\n      return JSON.stringify(result);\n    };\n    if (!tool.inputParameters) {\n      throw new Error('Tool input parameters are not defined');\n    }\n    const parameters = jsonSchemaToZodSchema(\n      dereferenceJsonSchema(tool.inputParameters, { onUnresolved: 'sentinel' })\n    );\n\n    // See https://github.com/langchain-ai/langchainjs/issues/8468 and pnpm-workspace.yaml.\n    // @ts-expect-error: error TS2589: Type instantiation is excessively deep and possibly infinite.\n    return new DynamicStructuredTool({\n      name: toolName,\n      description: description || '',\n      schema: parameters,\n      func: func,\n    });\n  }\n\n  /**\n   * Wraps a list of Composio tools in the Langchain DynamicStructuredTool format.\n   *","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/ComposioHQ/composio/blob/64b1b85502b1beeb2379e6c9e8bf1104504fa637/ts/packages/providers/langchain/src/index.ts#L120-L156","documentation":"The LangChain provider's wrapTool needs tool.inputParameters (a JSON Schema) to build the DynamicStructuredTool's zod parameters via jsonSchemaToZodSchema; if inputParameters is missing it throws 'Tool input parameters are not defined'.","triggerScenarios":"wrapTool receiving a Tool whose inputParameters is undefined/null — e.g. tools retrieved without parameter schemas, or manually constructed Tool stubs.","commonSituations":"Caching/serializing tools and losing the inputParameters field; backend/toolkit metadata gap for a newly added tool; SDK shape drift between core and provider versions.","solutions":["Ensure tools come from the SDK's tool-fetching APIs that include input parameters","Filter or assert tool.inputParameters before wrapTools; skip or substitute a permissive schema deliberately rather than crashing","Upgrade @composio/core and @composio/langchain to matching versions","Report tools that legitimately lack inputParameters to Composio"],"exampleFix":"// before\nconst lcTool = provider.wrapTool(tool, execute); // crashes if inputParameters missing\n// after\nif (!tool.inputParameters) throw new Error(`Tool ${tool.slug} lacks inputParameters; refetch`);\nconst lcTool = provider.wrapTool(tool, execute);","handlingStrategy":"type-guard","validationCode":"const hasParams = (t: Tool): boolean => Boolean(t.inputParameters);","typeGuard":"function hasInputParameters(t: Tool): t is Tool & { inputParameters: Record<string, unknown> } { return !!t.inputParameters && typeof t.inputParameters === 'object'; }","tryCatchPattern":"try { provider.wrapTool(tool, execute); } catch (e) { if ((e as Error).message === 'Tool input parameters are not defined') { /* refetch tool with params or skip */ } throw e; }","preventionTips":["Refetch tools if inputParameters is missing rather than using stale caches","Assert inputParameters before wrapping","Upgrade provider and core together"],"tags":["langchain","provider","tool-schema","typescript"],"backgroundTag":"missing-required-field","analyzedSha":"64b1b85502b1beeb2379e6c9e8bf1104504fa637","analyzedAt":"2026-08-28T15:39:33.623Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}