IAgentTool

Interface representing a tool used by an agent, extending the base ITool interface. Defines the tool's execution and validation logic, with optional lifecycle callbacks.

docNote: string

Optional description for documentation purposes, aiding in tool usage understanding.

toolName: string

The unique name of the tool, used for identification within the agent swarm.

validate: (dto: { clientId: string; agentName: string; toolCalls: IToolCall[]; params: T; }) => boolean | Promise<boolean>

Validates the tool parameters before execution. Can return synchronously or asynchronously based on validation complexity.

callbacks: Partial<IAgentToolCallbacks<Record<string, ToolValue>>>

Optional lifecycle callbacks for the tool, allowing customization of execution flow.

type: string

Tool type defenition. For now, should be function

function: { name: string; description: string; parameters: { type: string; required: string[]; properties: { [key: string]: { type: string; description: string; enum?: string[]; }; }; }; } | ((clientId: string, agentName: string) => { ...; } | Promise<...>)

Optional dynamic factory to resolve tool metadata

call: (dto: { toolId: string; clientId: string; agentName: string; params: T; toolCalls: IToolCall[]; abortSignal: TAbortSignal; callReason: string; isLast: boolean; }) => Promise<...>

Executes the tool with the specified parameters and context.