Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

637 B
Raw Blame
import { ValueBuilder } from './ValueBuilder';
import { Writer } from './Writer';

export class FunctionCall extends ValueBuilder {
  #name: string;
  #args: ValueBuilder[];

  constructor(name: string, args: ValueBuilder[]) {
    super();
    this.#name = name;
    this.#args = args;
  }

  addArgument(arg: ValueBuilder): this {
    this.#args.push(arg);
    return this;
  }

  override write(writer: Writer): void {
    writer.write(this.#name).write('(').writeJoined(', ', this.#args).write(')');
  }
}

export function functionCall(name: string, args: ValueBuilder[] = []): FunctionCall {
  return new FunctionCall(name, args);
}