// Copyright (C) 2026 Rob Colbert <rob.colbert@openplatform.us>
// Licensed under the Apache License, Version 2.0

import { IAiLogger } from "../api.ts";
import { AiToolbox } from "../toolbox.ts";

export interface IToolArguments {
  [key: string]: unknown;
}

export interface IToolDefinition {
  type: "function";
  function: {
    name: string;
    description: string;
    parameters: IToolArguments;
  };
}

export abstract class AiTool {
  protected _toolbox: AiToolbox;
  get toolbox(): AiToolbox {
    return this._toolbox;
  }

  constructor(toolbox: AiToolbox) {
    this._toolbox = toolbox;
  }

  abstract get name(): string;
  abstract get category(): string;
  abstract get definition(): IToolDefinition;

  abstract execute(args: IToolArguments, logger: IAiLogger): Promise<string>;
}
