ART Framework API Docs
    Preparing search index...

    Class ToolRegistry

    A simple in-memory implementation of the ToolRegistry interface. Stores tool executors in a Map, keyed by the tool's unique name.

    Implements

    • ToolRegistry
    Index

    Constructors

    Methods

    • Removes all registered tool executors from the registry. Primarily useful for resetting state during testing or specific application scenarios.

      Returns Promise<void>

      A promise that resolves when all tools have been cleared.

    • Retrieves the schemas of all currently registered tools. Retrieves the schemas of available tools, optionally filtering by those enabled for a specific thread. If filter.enabledForThreadId is provided and a StateManager was injected, it attempts to load the thread's configuration and return only the schemas for tools listed in enabledTools. Otherwise, it returns all registered tool schemas.

      Parameters

      • Optionalfilter: { enabledForThreadId?: string }

        Optional filter criteria. enabledForThreadId triggers filtering based on thread config.

      Returns Promise<ToolSchema[]>

      A promise resolving to an array containing the ToolSchema of the available tools based on the filter.

    • Retrieves a registered tool executor instance by its unique name.

      Parameters

      • toolName: string

        The name property defined in the tool's schema.

      Returns Promise<undefined | IToolExecutor>

      A promise resolving to the IToolExecutor instance, or undefined if no tool with that name is registered.

    • Registers a tool executor instance, making it available for lookup via getToolExecutor. If a tool with the same name (from executor.schema.name) already exists, it will be overwritten, and a warning will be logged.

      Parameters

      • executor: IToolExecutor

        The instance of the class implementing IToolExecutor. Must have a valid schema with a name.

      Returns Promise<void>

      A promise that resolves when the tool is registered.

      If the provided executor or its schema is invalid.

    • Unregister a single tool by name.

      Parameters

      • toolName: string

      Returns Promise<void>

    • Unregister tools matching a predicate; returns count removed.

      Parameters

      Returns Promise<number>