Skip to main content

Overview

The Chat Agent provides a conversational interface for users to interact with the MetaVault. It handles deposits, withdrawals, balance checks, and provides public vault information while maintaining strict security boundaries.

Security Model

The Chat Agent can ONLY access data for the requesting user’s wallet address. It cannot view other users’ balances or execute admin functions.

Allowed Operations

  • Check user’s own balance and shares
  • Get wallet LINK balance
  • View public vault information (TVL, APY, prices)
  • Prepare unsigned deposit/withdrawal transactions
  • Check and approve token allowances

Restricted Operations

  • Admin functions (rebalance, harvest, parameter updates)
  • Strategy internals (leverage ratios, debt positions)
  • Other users’ private data
  • Risk calculations and liquidation data

Agent Tools

The Chat Agent has access to the following tools, which are invoked automatically based on user requests:

User Account Tools

get_my_balance

Gets the current user’s vault share balance and withdrawable LINK amount.
string
required
The user’s wallet address
string
Raw share balance (18 decimals)
string
Raw withdrawable LINK amount (18 decimals)
string
Human-readable share balance
string
Human-readable withdrawable LINK amount
Returns the user’s LINK balance in their wallet.
string
required
The user’s wallet address
string
Wallet address queried
string
Raw LINK balance (18 decimals)
string
Human-readable LINK balance
string
Token symbol (“LINK”)
string
Formatted message with balance

user_deposit

Prepares an unsigned LINK deposit transaction for the user to sign.
string
required
Amount of LINK to deposit (human-readable format)
boolean
Always true if transaction is prepared successfully
object
Unsigned transaction object
string
User-friendly message about the transaction

user_withdraw

Prepares an unsigned withdrawal transaction for the user to sign.
string
required
Number of shares to withdraw (human-readable format)
boolean
Always true if transaction is prepared successfully
object
Unsigned transaction object (same structure as deposit)
string
User-friendly message about the transaction

Approval Tools

check_allowance

Checks if user’s LINK token allowance is sufficient for a deposit.
string
required
User’s wallet address
string
required
Desired deposit amount (human-readable)
string
Current allowance (raw 18 decimal format)
boolean
Whether allowance is sufficient
string
Required allowance (raw 18 decimal format)
string
Wallet address checked
Prepares an unsigned approval transaction so the vault can spend LINK.
string
required
Amount of LINK to approve (human-readable)
object
Unsigned approval transaction
string
User-friendly approval message

Public Information Tools

get_public_vault_info

Gets public vault information including total managed assets and total supply.
string
Total managed assets (raw 18 decimals)
string
Total share supply (raw 18 decimals)
string
Human-readable total managed LINK
string
Human-readable total shares

get_token_prices

Fetches real-time LINK price from CoinGecko API.
LINK price in USD (scaled by 1e18)
Human-readable LINK price
string
24-hour price change percentage
string
Data source (“CoinGecko API”)

get_vault_apy

Gets the current vault APY based on TVL growth.
number
APY as a decimal (e.g., 0.12 = 12%)
string
Human-readable APY percentage
string
Status message
number
Current total value locked

Conversion Tools

convert_to_shares

Converts LINK amount to Vault Share Tokens (VST).
string
required
Amount of LINK (human-readable format)
string
Equivalent number of shares

convert_to_assets

Converts Vault Share Tokens (VST) to LINK.
string
required
Amount of shares/VST (human-readable format)
Equivalent amount of LINK

Deposit Flow

The Chat Agent automatically handles the two-step deposit process:

Step 1: Check Allowance

When a user requests a deposit, the agent first checks if the vault has sufficient allowance to spend the user’s LINK tokens.
1

User requests deposit

User: “Deposit 10 LINK”
2

Agent checks allowance

Agent calls check_allowance(wallet, "10")
3

Approval required

If allowance is insufficient, agent calls approve_link("10") and returns approval transaction
4

User signs approval

User signs the approval transaction in their wallet
5

Deposit transaction

After approval is confirmed, agent calls user_deposit("10") and returns deposit transaction
6

User signs deposit

User signs the deposit transaction to complete the deposit

Example Chat Interaction

Withdrawal Flow

Withdrawals are simpler and only require one transaction:
1

User requests withdrawal

User: “Withdraw 5 LINK”
2

Agent prepares transaction

Agent calls user_withdraw("5") and returns unsigned transaction
3

User signs withdrawal

User signs the withdrawal transaction to receive LINK

Response Format

All Chat Agent responses follow a structured JSON format when tools are used:
  • reply: Text response for the user
  • unsignedTx: Transaction to sign (if applicable)
  • needsApproval: Whether an approval is needed before proceeding
  • step: Current stage in the transaction flow

Error Handling

The Chat Agent returns user-friendly error messages:
Common error scenarios:
  • Insufficient LINK balance
  • Insufficient share balance for withdrawal
  • Invalid wallet address
  • Network errors (CoinGecko API failures)
  • Contract call failures