Skip to main content
Glama
sv

MCP Paradex Server

by sv

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
NameRequiredDescriptionDefault
vault_addressYesThe address of the vault to get balance for.

Implementation Reference

  • 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
  • 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")]

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sv/mcp-paradex-py'

If you have feedback or need assistance with the MCP directory API, please join our Discord server