/** * Concurrency limiter for parallel tool calls. * Prevents resource exhaustion when MCP clients send many requests at once. */ /** * Semaphore for limiting concurrent operations. */ export declare class Semaphore { private readonly maxConcurrent; private current; private queue; /** * Create a new Semaphore with a maximum concurrency limit. * @param maxConcurrent - Maximum number of concurrent operations allowed. */ constructor(maxConcurrent: number); /** * Acquire a semaphore slot. Waits if at capacity. */ acquire(): Promise; /** * Release a semaphore slot, allowing the next queued operation to proceed. */ release(): void; /** * Wrap an async function with semaphore acquire/release. * @param fn - The async function to run under concurrency control. * @returns The result of the wrapped function. */ run(fn: () => Promise): Promise; /** * Get the number of queued operations waiting for a slot. * @returns The number of pending operations. */ get pending(): number; /** * Get the number of currently active operations. * @returns The number of active operations. */ get active(): number; } export declare const toolLimiter: Semaphore; //# sourceMappingURL=concurrency.d.ts.map