figuard-mcp

v1.2.0
io.github.figuard/figuard-mcp Checked 1 day ago Published 5 months ago

Pre-flight spend authorization for AI agents.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

figuard_create_budget

Create a new FiGuard budget for an agent session. Returns a session_token that must be passed to figuard_authorize. The session_token is only returned once — store it for the duration of the agent session. Use currency (e.g. 'USD') for monetary budgets. Use unit (e.g. 'tokens') for resource budgets. Optionally add allocations to ring-fence spend by category (e.g. separate limits for flights and hotels). Pass external_reference to make this call idempotent: if a live budget with that reference already exists it is returned (HTTP 200) instead of creating a duplicate. If the reference exists bu…

ParameterTypeDescription
total_limit *numberMaximum total amount the agent is allowed to spend. For USD budgets this is dollars, not cents.
user_id *stringIdentifier for the user or agent session this budget belongs to.
allocationsarrayOptional category-level caps. Each allocation is an independent maximum — flights capped at $300 means flights can never exceed $300, regardless of what other categories spend. Allocation limits mus…
anomaly_detection_enabledbooleanWhen true, FiGuard monitors spend requests for statistical anomalies. Recommended for production.
auto_pause_on_anomalybooleanControls anomaly response mode. When true (default), an anomalous request pauses the budget — no further spend until a human resumes it. When false (advisory mode), the anomalous request is still de…
currencystringISO 4217 currency code (e.g. 'USD', 'EUR'). Required for monetary budgets. Omit for resource budgets.
expires_instringHow long the budget is valid. Accepts '24h', '7d', '30m', or a number of seconds. Defaults to '24h'.
external_referencestringOptional stable identifier for this budget (e.g. 'run-abc-123', 'order-456'). When provided, re-calling figuard_create_budget with the same external_reference returns the existing live budget instead…
intent_contextstringOptional human-readable description of what this budget is for (e.g. 'Book travel to NYC for user_123').
unitstringResource unit label (e.g. 'tokens', 'api_calls'). Required for resource budgets. Omit for monetary budgets.
velocity_max_amount_per_hournumberMax total requestedQuantity per rolling 1-hour window.
velocity_max_per_daynumberMax authorize attempts per rolling 24-hour window.
velocity_max_per_minutenumberMax authorize attempts per rolling 1-minute window. Denied with VELOCITY_LIMIT_EXCEEDED when exceeded.

figuard_authorize

Pre-flight authorization — ask FiGuard if a spend is permitted before taking any action. Returns AUTHORIZED (with event_id) or DENIED (with denial_reason). Always call this before spending. Only proceed if the result is AUTHORIZED. The idempotency_key must be unique per logical spend intent — reuse the same key on retries so the same spend is never double-authorized. After the action succeeds call figuard_confirm; if it fails call figuard_fail. IMPORTANT: When the budget has allocations, pass the exact category string from the budget's allocation_categories field — do not use synonyms or…

ParameterTypeDescription
action_type *stringType of action being authorized (e.g. 'PURCHASE', 'REFUND', 'LLM_CALL', 'API_CALL').
agent_id *stringIdentifier for the agent making this request (e.g. 'booking-agent', 'refund-agent').
description *stringHuman-readable description of what the agent is about to do (e.g. 'Book NYC to LAX flight').
requested_quantity *numberAmount to reserve. For USD budgets this is dollars. For token budgets this is the token count.
session_token *stringThe session_token returned by figuard_create_budget. Never expose this in logs.
claimed_categorystringCategory of this spend (e.g. 'flight', 'hotel'). Required when the budget has allocations.
claimed_item_typestringSpecific item type (e.g. 'economy_ticket', 'hotel_room'). Used for STRICT enforcement mode.
dry_runbooleanWhen true, runs all enforcement checks and returns AUTHORIZED/DENIED but writes nothing to the ledger. Use for testing.
idempotency_keystringOptional. Unique key for this spend intent. Use a UUID or stable identifier. Reuse on retries — never generate a new key for the same logical spend. When omitted, the SDK auto-generates a UUID v4 (s…
parent_event_idstringevent_id of the parent spend if this is a sub-agent call. Used to build the causal chain. The parent event must be in AUTHORIZED or CONFIRMED state — passing a DENIED or VOIDED parent_event_id will…
reservebooleanOptional (default true). Set false for an orchestrator/coordinator spend-tree root that should hold NO capacity and have no confirmation timeout — sub-agents authorize against the budget directly. U…
trace_idstringOptional run ID to link all events from a single agent run together for debugging.

figuard_confirm

Confirm a previously authorized spend after the action succeeds. Pass the actual amount spent — it may differ from the authorized amount (e.g. authorized $340, flight cost $337.50). This releases the difference back to the budget. Always confirm after a successful action.

ParameterTypeDescription
confirmed_quantity *numberActual amount consumed. May be less than the authorized amount.
event_id *stringThe event_id returned by figuard_authorize.
external_transaction_idstringOptional reference from your payment processor (e.g. Stripe charge ID) for audit purposes.

figuard_fail

Mark an authorized spend as failed when the action did not succeed (e.g. payment processor declined, API error). This releases the reserved funds back to the budget so they can be used again.

ParameterTypeDescription
event_id *stringThe event_id returned by figuard_authorize.
reason *stringShort reason code for the failure (e.g. 'PAYMENT_DECLINED', 'API_ERROR', 'TOOL_ERROR').
error_messagestringOptional human-readable error detail for the audit log.

figuard_void

Cancel an authorized reservation that was never used. Use this when the agent decides not to proceed with an action after authorizing it (e.g. user cancelled, better option found).

ParameterTypeDescription
event_id *stringThe event_id returned by figuard_authorize.
reason *stringShort reason for voiding (e.g. 'USER_CANCELLED', 'BETTER_OPTION_FOUND', 'PLAN_CHANGED').
void_child_eventsbooleanWhen true, also void child events in the causal chain. Defaults to false.

figuard_get_budget

Get the current state of a budget — total limit, amount spent, amount reserved, amount available, status, and per-category allocations. Use this to check remaining budget before planning an agent's actions.

ParameterTypeDescription
budget_id *stringThe budget ID (starts with 'bgt_').

figuard_get_ledger

Query the authorization ledger for a budget — returns a paginated list of spend events (authorized, confirmed, denied, voided, failed). Use this to review what an agent has spent or to debug a denial.

ParameterTypeDescription
budget_id *stringThe budget ID (starts with 'bgt_').
decisionstringFilter by event decision. Omit to return all events.
pagenumberPage number, zero-indexed. Defaults to 0.
sizenumberEvents per page. Defaults to 20, max 100.
trace_idstringFilter by trace ID to see only events from a specific agent run.

figuard_resume_budget

Resume a budget that was paused by anomaly detection or manually. A budget is paused when a spend request is statistically unusual (autoPauseOnAnomaly=true) or via PATCH /budgets/{id}. A human must review and provide an override reason before the budget can be used again. Requires override_reason explaining why the pause was reviewed and cleared.

ParameterTypeDescription
budget_id *stringThe budget ID (starts with 'bgt_').
override_reason *stringRequired explanation for why the budget is being resumed (e.g. 'Reviewed — legitimate bulk purchase approved by ops team').
override_bystringOptional identifier for the operator or system performing the override (e.g. 'ops-team', 'user_456').

figuard_extend_budget

Extend a budget's expiry window. Use this to keep a long-running agent alive past its original expiry. The new expiry must be later than the current one and at most 24 hours from now. Can be called repeatedly (e.g. extend by 2 hours every 2 hours for a 6-hour task). Returns 409 if the budget is CANCELLED or EXHAUSTED. Returns 400 if the new expiry is earlier than the current one.

ParameterTypeDescription
budget_id *stringThe budget ID to extend.
expires_atstringAbsolute ISO 8601 expiry timestamp. Mutually exclusive with expires_in.
expires_instringRelative duration from now (e.g. '2h', '30m'). Mutually exclusive with expires_at.

figuard_create_delegation_token

Create a scoped delegation token for a fleet budget. Each sub-agent (e.g. per-customer refund agent) gets its own token with per-category spend caps. The sub-agent calls figuard_authorize with this token exactly as it would with a normal session token — FiGuard enforces both the per-token caps and the fleet-level allocations transparently. The session_token is returned once — hand it to the sub-agent immediately and store it securely.

ParameterTypeDescription
budget_id *stringThe fleet budget ID to delegate from.
caps *arrayPer-category spend caps for this sub-agent. Only listed categories are cap-enforced at the delegation level. Categories not listed pass through to the fleet allocation only.
label *stringHuman-readable label for this token, e.g. 'refund-agent-order-123'.

figuard_revoke_delegation_token

Revoke a delegation token immediately. Any subsequent figuard_authorize call using this token will be rejected with INVALID_SESSION_TOKEN. Already-authorized events are not affected. Fires DELEGATION_TOKEN_REVOKED webhook. Idempotent.

ParameterTypeDescription
token_id *stringThe delegation token ID to revoke.

figuard_get_delegation_token

Get the current state of a delegation token — label, status, per-category cap usage. The raw session_token is never returned, only the prefix.

ParameterTypeDescription
token_id *stringThe delegation token ID.

figuard_cancel_batch

Cancel one or more budgets. Use this to cancel a single budget (pass one ID) or up to 100 at once. This is the correct tool when the user asks to cancel, close, void, or abandon a budget — not figuard_void (which only cancels individual spend events, not budgets). Already-terminal budgets (EXPIRED, CANCELLED, EXHAUSTED) are included in the response without an error — the call is idempotent per budget.

ParameterTypeDescription
budget_ids *arrayList of budget IDs to cancel. Maximum 100.

figuard_fund_budget

Adjust a budget's totalLimit in-place without creating a new session. Use CREDIT to top up a nearly-exhausted budget mid-run, DEBIT to reduce it, RESET to set a new absolute limit, or RESET_SPENT to start a fresh billing period (zeroes quantitySpent and reactivates EXHAUSTED budgets). Returns the budget state before and after the operation.

ParameterTypeDescription
amount *numberAmount to apply. Must be positive.
budget_id *stringID of the budget to fund.
operation *stringCREDIT: add amount to totalLimit. DEBIT: subtract amount (rejected if result < quantitySpent). RESET: set totalLimit to exactly amount. RESET_SPENT: zero quantitySpent, set new totalLimit, reactivate…
reasonstringOptional note recorded in the response for audit purposes.

figuard_get_spend_tree

Get the hierarchical spend tree for a budget — every event and its causal children (parent → child chains). Use to inspect what an agent (and its sub-agents) actually spent, including denied attempts. Returns roots and a total event count.

ParameterTypeDescription
budget_id *stringThe budget ID (starts with 'bgt_').

figuard_update_budget

Update an existing budget's settings: total limit, velocity caps, expiry, trust mode, or status. Use trust_mode='FULL_ENFORCEMENT' to leave shadow mode and start blocking, or 'SHADOW' to observe without blocking. For crediting/debiting funds with audit semantics, prefer figuard_fund_budget instead.

ParameterTypeDescription
budget_id *stringThe budget ID (starts with 'bgt_').
expires_atstringNew absolute ISO 8601 expiry (e.g. '2026-12-31T23:59:59Z').
statusstringBudget status override (advanced).
total_limitnumberNew total spend limit.
trust_modestring'SHADOW' (run all checks, block nothing) or 'FULL_ENFORCEMENT' (block denied spends).
velocity_max_amount_per_hournumberNew per-hour amount cap.
velocity_max_per_daynumberNew per-day authorize cap.
velocity_max_per_minutenumberNew per-minute authorize cap.