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

    Class ToolContext

    The context of various callbacks within an agent run.

    Hierarchy (View Summary)

    Constructors

    Properties

    eventActions: EventActions
    functionCallId?: string
    invocationContext: InvocationContext
    toolConfirmation?: ToolConfirmation

    Accessors

    • get userContent(): Content | undefined

      The user content that started this invocation.

      Returns Content | undefined

    Methods

    • Gets the auth credential for the given auth config.

      Parameters

      • authConfig: AuthConfig

        The auth config to get the auth credential for.

      Returns AuthCredential | undefined

      The auth credential for the given auth config.

    • Lists the filenames of the artifacts attached to the current session.

      Returns Promise<string[]>

      A promise that resolves to a list of artifact filenames.

    • Loads an artifact attached to the current session.

      Parameters

      • filename: string

        The filename of the artifact.

      • Optionalversion: number

        The version of the artifact. If not provided, the latest version will be used.

      Returns Promise<Part | undefined>

      A promise that resolves to the loaded artifact.

    • Requests confirmation for the current tool call.

      Parameters

      • __namedParameters: { hint?: string; payload?: unknown }

      Returns void

    • Saves an artifact attached to the current session.

      Parameters

      • filename: string

        The filename of the artifact.

      • artifact: Part

        The artifact to save.

      Returns Promise<number>

      A promise that resolves to the version of the saved artifact.