Skip to main content
Glama
defaultRetryQuota.jsโ€ข1.27 kB
import { NO_RETRY_INCREMENT, RETRY_COST, TIMEOUT_RETRY_COST } from "@smithy/util-retry"; export const getDefaultRetryQuota = (initialRetryTokens, options) => { const MAX_CAPACITY = initialRetryTokens; const noRetryIncrement = options?.noRetryIncrement ?? NO_RETRY_INCREMENT; const retryCost = options?.retryCost ?? RETRY_COST; const timeoutRetryCost = options?.timeoutRetryCost ?? TIMEOUT_RETRY_COST; let availableCapacity = initialRetryTokens; const getCapacityAmount = (error) => (error.name === "TimeoutError" ? timeoutRetryCost : retryCost); const hasRetryTokens = (error) => getCapacityAmount(error) <= availableCapacity; const retrieveRetryTokens = (error) => { if (!hasRetryTokens(error)) { throw new Error("No retry token available"); } const capacityAmount = getCapacityAmount(error); availableCapacity -= capacityAmount; return capacityAmount; }; const releaseRetryTokens = (capacityReleaseAmount) => { availableCapacity += capacityReleaseAmount ?? noRetryIncrement; availableCapacity = Math.min(availableCapacity, MAX_CAPACITY); }; return Object.freeze({ hasRetryTokens, retrieveRetryTokens, releaseRetryTokens, }); };

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/consigcody94/office-whisperer'

If you have feedback or need assistance with the MCP directory API, please join our Discord server