langchain.js
    Preparing search index...

    Class ToolStrategy<_T>

    Information for tracking structured output tool metadata. This contains all necessary information to handle structured responses generated via tool calls, including the original schema, its type classification, and the corresponding tool implementation used by the tools strategy.

    Type Parameters

    • _T = unknown
    Index

    Properties

    Accessors

    Methods

    Properties

    options?: ToolStrategyOptions

    The options to use for the tool output.

    schema: Record<string, unknown>

    The original JSON Schema provided for structured output

    tool: { function: FunctionDefinition; type: "function" }

    The tool that will be used to parse the tool call arguments.

    Accessors

    • get name(): any

      Returns any

    Methods

    • Parse tool arguments according to the schema.

      Parameters

      • toolArgs: Record<string, unknown>

        The arguments from the tool call

      Returns Record<string, unknown>

      The parsed response according to the schema type

      if the response is not valid

    • Type Parameters

      • S extends InteropZodObject

      Parameters

      • schema: S
      • OptionaloutputOptions: ToolStrategyOptions

      Returns ToolStrategy<S extends InteropZodType<U> ? U : unknown>

    • Parameters

      • schema: Record<string, unknown>
      • OptionaloutputOptions: ToolStrategyOptions

      Returns ToolStrategy<Record<string, unknown>>