riv-mcp
v0.4.1Riv MCP: spend authorization and governed trading (place_order, positions, market data, policies).
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
authorize Autorizar transação (Riv)
Pergunta ao Riv se uma transação é permitida ANTES de executá-la. Retorna a decisão de governança: ALLOW (siga), BLOCK (não execute), REQUIRE_APPROVAL (aguarde aprovação humana). Chame isto antes de qualquer gasto/pagamento.
| Parameter | Type | Description |
|---|---|---|
amount * | number | Valor da transação (positivo, até 2 casas decimais). |
currency * | string | Moeda da transação, ex.: BRL, USD. |
category | string | Categoria de gasto opcional (ex.: inference, saas). Mandatos por categoria usam isto. |
description | string | Descrição opcional da transação (para auditoria). |
get_activity Consultar atividade (Riv)
Consulta o ledger do Riv. Com activityId, retorna o resultado de uma autorização específica (o id vem da resposta da tool authorize); sem activityId, retorna as atividades mais recentes do agente (extrato).
| Parameter | Type | Description |
|---|---|---|
activityId | string | Id da atividade (UUID) retornado pela tool authorize. Omita para listar as recentes. |
limit | integer | Quantas atividades recentes retornar (1–50, padrão 10). Ignorado com activityId. |
place_order Place trading order (Riv)
Places a perp order on the connected venue through Riv's governance layer: every order is evaluated against the organization's trading policies before any execution, and executed orders carry Riv's builder code. BLOCK and REQUIRE_APPROVAL are normal outcomes, not errors — read the Reason and ReasonCode and adapt (reduce size or leverage, switch asset, or wait for approval). ALLOW with Executed: yes means the venue accepted the order in this call. A venue rejection (HTTP 422) is ALSO a normal outcome, not an error: Execution: failed plus the venue's own reason (quoted, untrusted) — fix the…
| Parameter | Type | Description |
|---|---|---|
asset * | string | Asset symbol, e.g. BTC. |
leverage * | number | Leverage multiplier, e.g. 2 for 2x. |
notional * | number | Order size in USDC notional (up to 2 decimals). |
orderType * | string | market executes immediately (IoC at an aggressive price); limit rests on the book at limitPrice until filled, canceled, or expired. |
side * | string | Order direction. |
clientOrderId | string | Idempotency key for this order. When RETRYING the same order (timeout, unclear outcome), REUSE the exact same value — Riv will return the original outcome instead of placing a duplicate. A NEW order… |
expiresAfterSeconds | integer | Limit only. Cancel the resting order automatically if not filled within N seconds (server-enforced cap applies). |
limitPrice | number | REQUIRED for limit orders (rejected on market): the exact price submitted to the venue. Prices the venue tick cannot represent are rejected (limit_price_precision) rather than silently altered. |
reduceOnly | boolean | Only reduce an existing position; exempts loss-halt policies. |
tif | string | Limit only. gtc (default) rests until filled/canceled; alo is post-only (maker). |
get_positions Get open positions (Riv)
Lists the agent's open positions from Riv's view of the trading account (refreshed from the venue when stale; may take a few seconds). Read-only. Use it before placing or closing orders.
get_account_state Get trading account state (Riv)
Returns the agent's trading account state as Riv sees it: equity, peak equity, daily realized PnL, consecutive losses and open positions, with the asOf timestamp. This is the same state Riv's trading policies evaluate against.
get_market_data Get market data (Riv)
Fetches read-only market data for one asset on the venue: mid price, mark price, current funding rate and open interest. No custodial connection is required. Prices are in USDC.
| Parameter | Type | Description |
|---|---|---|
asset * | string | Asset symbol, e.g. BTC. |
cancel_order Cancel order (Riv)
Cancels a resting order on the venue by its venueOrderId (as returned by place_order). Requires an active venue connection; the cancellation is signed by Riv's gateway. A failed cancel (e.g. order already filled) is reported as a normal outcome, not an error.
| Parameter | Type | Description |
|---|---|---|
asset * | string | Asset symbol of the order. |
venueOrderId * | integer | The venue order id returned by place_order. |
clientOrderId | string | Idempotency key. REUSE the same value when retrying this exact cancel; new intent = new value. Auto-generated if omitted. |
close_position Close position (Riv-governed)
Closes the agent's open position in the given asset by submitting a governed reduce-only market order in the opposite direction, sized to the full position. It goes through the exact same policy engine as place_order — BLOCK and REQUIRE_APPROVAL are normal outcomes to adapt to. If there is no open position, nothing is submitted.
| Parameter | Type | Description |
|---|---|---|
asset * | string | Asset symbol of the position to close. |
clientOrderId | string | Idempotency key. REUSE the same value when retrying this exact close; new intent = new value. Auto-generated if omitted. |
list_trading_policies List trading policies (Riv)
Lists the trading policies currently in effect for this agent, with a human-readable summary of each limit: leverage caps, position size, asset allow/deny lists, loss halts, trading hours and approval thresholds. Use it to understand why an order was blocked and what would be allowed. With no policies in effect, all orders are blocked by default.