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

next
ts 26 lines 637 Bytes
Raw
1 import { ValueBuilder } from './ValueBuilder';
2 import { Writer } from './Writer';
3
4 export class FunctionCall extends ValueBuilder {
5 #name: string;
6 #args: ValueBuilder[];
7
8 constructor(name: string, args: ValueBuilder[]) {
9 super();
10 this.#name = name;
11 this.#args = args;
12 }
13
14 addArgument(arg: ValueBuilder): this {
15 this.#args.push(arg);
16 return this;
17 }
18
19 override write(writer: Writer): void {
20 writer.write(this.#name).write('(').writeJoined(', ', this.#args).write(')');
21 }
22 }
23
24 export function functionCall(name: string, args: ValueBuilder[] = []): FunctionCall {
25 return new FunctionCall(name, args);
26 }