MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / run

Method run

src/mcp/query-pool.ts:293–309  ·  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

291
292 /** Run a read tool on the pool. Always resolves (never rejects). */
293 run(toolName: string, args: Record<string, unknown>): Promise<ToolResult> {
294 return new Promise<ToolResult>((resolve) => {
295 const job: Job = {
296 id: this.nextId++, toolName, args, resolve,
297 retries: 0, settled: false, enqueuedAt: Date.now(),
298 };
299 // Don't let the caller wait past softTimeoutMs. The worker may still be
300 // busy (we can't cancel synchronous CPU), but the CLIENT gets a prompt,
301 // success-shaped "retry" instead of a hard timeout.
302 job.softTimer = setTimeout(() => {
303 if (!job.settled) this.settle(job, busyGuidance(Date.now() - job.enqueuedAt));
304 }, this.softTimeoutMs);
305 job.softTimer.unref?.();
306 this.queue.push(job);
307 this.drain();
308 });
309 }
310
311 /** Terminate all workers and answer any outstanding calls gracefully. */
312 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