ADK for TypeScript: API Reference
    Preparing search index...

    Type Alias SingleBeforeToolCallback

    SingleBeforeToolCallback: (
        params: {
            args: Record<string, unknown>;
            context: Context;
            tool: BaseTool;
        },
    ) => | Record<string, unknown>
    | undefined
    | Promise<Record<string, unknown> | undefined>

    A callback that runs before a tool is called.

    Type Declaration

      • (
            params: {
                args: Record<string, unknown>;
                context: Context;
                tool: BaseTool;
            },
        ): | Record<string, unknown>
        | undefined
        | Promise<Record<string, unknown> | undefined>
      • Parameters

        • params: { args: Record<string, unknown>; context: Context; tool: BaseTool }
          • args: Record<string, unknown>

            The arguments to the tool.

          • context: Context

            Context for the tool call.

          • tool: BaseTool

            The tool to be called.

        Returns
            | Record<string, unknown>
            | undefined
            | Promise<Record<string, unknown> | undefined>

        The tool response. When present, the returned tool response will be used and the framework will skip calling the actual tool.