MCPcopy
hub / github.com/promptfoo/promptfoo / call

Method call

src/python/worker.ts:116–136  ·  view source on GitHub ↗
(functionName: string, args: unknown[])

Source from the content-addressed store, hash-verified

114 }
115
116 async call(functionName: string, args: unknown[]): Promise<unknown> {
117 if (!this.ready) {
118 throw new Error('Worker not ready');
119 }
120
121 if (this.busy) {
122 throw new Error('Worker is busy');
123 }
124
125 this.busy = true;
126
127 try {
128 return await Promise.race([this.executeCall(functionName, args), this.createTimeout()]);
129 } finally {
130 this.busy = false;
131 if (this.requestTimeout) {
132 clearTimeout(this.requestTimeout);
133 this.requestTimeout = null;
134 }
135 }
136 }
137
138 private async executeCall(functionName: string, args: unknown[]): Promise<unknown> {
139 let tempDirectory: string | undefined;

Callers 15

worker.test.tsFile · 0.80
llamaApi.test.tsFile · 0.80
execution.test.tsFile · 0.80
cliOptions.test.tsFile · 0.80
getRedteamInjectVarFunction · 0.80
updateDerivedMetricsFunction · 0.80
runMethod · 0.80

Calls 2

executeCallMethod · 0.95
createTimeoutMethod · 0.95

Tested by 1

replaceInputValueFunction · 0.64