paradex_vault_balance
Retrieve current vault balance information including available funds, locked funds, and total balance to assess financial state before executing trades or withdrawals.
Instructions
Get the current balance of a specific vault.
Retrieves the current balance information for a specific vault, including available funds, locked funds, and total balance. This is essential for understanding the financial state of a vault before executing trades or withdrawals.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| vault_address | Yes | The address of the vault to get balance for. |
Implementation Reference
- src/mcp_paradex/tools/vaults.py:123-148 (handler)The handler function decorated with @server.tool that implements the paradex_vault_balance tool. It fetches vault balance data from the Paradex API, validates it using the VaultBalance model, and returns the list of balances.@server.tool(name="paradex_vault_balance") async def get_vault_balance( vault_address: Annotated[ str, Field(description="The address of the vault to get balance for.") ], ) -> list[VaultBalance]: """ Get the current balance of a specific vault. Retrieves the current balance information for a specific vault, including available funds, locked funds, and total balance. This is essential for understanding the financial state of a vault before executing trades or withdrawals. """ try: client = await get_paradex_client() response = await api_call(client, "vaults/balance", params={"address": vault_address}) if "error" in response: raise Exception(response["error"]) results = response["results"] balances = vault_balance_adapter.validate_python(results) return balances except Exception as e: logger.error(f"Error fetching balance for vault {vault_address}: {e!s}") raise e
- src/mcp_paradex/models.py:265-271 (schema)Pydantic model defining the output schema for vault balances, used for validation in the tool handler.class VaultBalance(BaseModel): """Model representing the balance of a vault.""" token: Annotated[str, Field(description="Name of the token")] size: Annotated[str, Field(description="Balance amount of settlement token")] last_updated_at: Annotated[int, Field(description="Balance last updated time")]