MCPcopy
hub / github.com/colbymchenry/codegraph / run

Method run

src/mcp/query-pool.ts:275–291  ·  view source on GitHub ↗

Run a read tool on the pool. Always resolves (never rejects).

(toolName: string, args: Record<string, unknown>)

Source from the content-addressed store, hash-verified

273
274 /** Run a read tool on the pool. Always resolves (never rejects). */
275 run(toolName: string, args: Record<string, unknown>): Promise<ToolResult> {
276 return new Promise<ToolResult>((resolve) => {
277 const job: Job = {
278 id: this.nextId++, toolName, args, resolve,
279 retries: 0, settled: false, enqueuedAt: Date.now(),
280 };
281 // Don't let the caller wait past softTimeoutMs. The worker may still be
282 // busy (we can't cancel synchronous CPU), but the CLIENT gets a prompt,
283 // success-shaped "retry" instead of a hard timeout.
284 job.softTimer = setTimeout(() => {
285 if (!job.settled) this.settle(job, busyGuidance(Date.now() - job.enqueuedAt));
286 }, this.softTimeoutMs);
287 job.softTimer.unref?.();
288 this.queue.push(job);
289 this.drain();
290 });
291 }
292
293 /** Terminate all workers and answer any outstanding calls gracefully. */
294 async destroy(): Promise<void> {

Callers

nothing calls this directly

Calls 3

settleMethod · 0.95
drainMethod · 0.95
busyGuidanceFunction · 0.85

Tested by

no test coverage detected