limits
Monitor daily spending limits and track current usage in cents to control payment processing costs.
Instructions
Check current spending limits and today's usage (all values in cents).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:436-444 (handler)Registration and handler for the "limits" tool in the MCP server.
// Tool: limits server.tool( "limits", "Check current spending limits and today's usage (all values in cents).", {}, async () => { return jsonResult(guardrails.getStatus()); } ); - src/cli.ts:637-665 (handler)CLI command handler for "limits".
async function cmdLimits() { const config = loadConfig(); const { guardrails } = bootstrap(config); const status = guardrails.getStatus(); // Simple progress bar const pct = status.daily_limit > 0 ? Math.min(1, status.daily_spend / status.daily_limit) : 0; const barWidth = 24; const filled = Math.round(pct * barWidth); const barColor = pct > 0.9 ? error : pct > 0.7 ? warning : success; const bar = barColor("█".repeat(filled)) + muted("░".repeat(barWidth - filled)); console.log(); console.log(` ${primary(BOX.dot)} ${boldPrimary(t.limitsTitle)}`); console.log(` ${divider()}`); console.log(); console.log(` ${label(t.dailyLimit + ":")} ${bold(formatBRL(status.daily_limit))}`); console.log(` ${label(t.spentToday + ":")} ${formatBRL(status.daily_spend)}`); console.log(` ${label(t.remaining + ":")} ${boldMoney(formatBRL(status.daily_remaining))}`); console.log(); console.log(` ${bar} ${muted(`${Math.round(pct * 100)}%`)}`); console.log(); console.log(` ${label(t.perTxMax + ":")} ${formatBRL(status.per_tx_max)}`); console.log(` ${label(t.confirmAbove + ":")} ${formatBRL(status.confirm_above)}`); console.log(); }