ComposioHQ/composio · error · Error

Tool input parameters are not defined

Error message

Tool input parameters are not defined

What it means

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'.

Source

Thrown at ts/packages/providers/langchain/src/index.ts:138

   * const result = await executor.invoke({
   *   input: "Search for information about Composio"
   * });
   * ```
   */
  wrapTool(tool: Tool, executeTool: ExecuteToolFn): DynamicStructuredTool {
    const toolName = tool.slug;
    const description = tool.description;
    const appName = tool.toolkit?.name?.toLowerCase();
    if (!appName) {
      throw new Error('App name is not defined');
    }
    const func = async (...args: unknown[]): Promise<unknown> => {
      // Models occasionally emit tool input as a JSON string rather than an object (issue #2406).
      const result = await executeTool(toolName, normalizeToolArguments(args[0], toolName));
      return JSON.stringify(result);
    };
    if (!tool.inputParameters) {
      throw new Error('Tool input parameters are not defined');
    }
    const parameters = jsonSchemaToZodSchema(
      dereferenceJsonSchema(tool.inputParameters, { onUnresolved: 'sentinel' })
    );

    // See https://github.com/langchain-ai/langchainjs/issues/8468 and pnpm-workspace.yaml.
    // @ts-expect-error: error TS2589: Type instantiation is excessively deep and possibly infinite.
    return new DynamicStructuredTool({
      name: toolName,
      description: description || '',
      schema: parameters,
      func: func,
    });
  }

  /**
   * Wraps a list of Composio tools in the Langchain DynamicStructuredTool format.
   *

View on GitHub (pinned to 64b1b85502)

Solutions

  1. Ensure tools come from the SDK's tool-fetching APIs that include input parameters
  2. Filter or assert tool.inputParameters before wrapTools; skip or substitute a permissive schema deliberately rather than crashing
  3. Upgrade @composio/core and @composio/langchain to matching versions
  4. Report tools that legitimately lack inputParameters to Composio

Example fix

// before
const lcTool = provider.wrapTool(tool, execute); // crashes if inputParameters missing
// after
if (!tool.inputParameters) throw new Error(`Tool ${tool.slug} lacks inputParameters; refetch`);
const lcTool = provider.wrapTool(tool, execute);
Defensive patterns

Strategy: type-guard

Validate before calling

const hasParams = (t: Tool): boolean => Boolean(t.inputParameters);

Type guard

function hasInputParameters(t: Tool): t is Tool & { inputParameters: Record<string, unknown> } { return !!t.inputParameters && typeof t.inputParameters === 'object'; }

Try / catch

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; }

Prevention

When it happens

Trigger: wrapTool receiving a Tool whose inputParameters is undefined/null — e.g. tools retrieved without parameter schemas, or manually constructed Tool stubs.

Common situations: 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.

Understand the failure class

Background: "Missing required field" and "field is required" errors: why libraries reject payloads that omit mandatory fields — this error's family across 20 libraries.

Related errors


AI-assisted analysis of ComposioHQ/composio@64b1b85502 (2026-08-28). Data as JSON: /api/errors/31b468ff575dfecb. Report an issue: GitHub.