Skip to main content
Glama
Habinar

MCP Paradex Server

by Habinar

paradex_vault_balance

Retrieve detailed balance information for a specific vault, including available, locked, and total funds, to assess financial status before trades or withdrawals on the Paradex platform.

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 get_vault_balance implements the core logic of the paradex_vault_balance tool. It is registered via the @server.tool decorator with the exact name. Takes vault_address as input, fetches data from Paradex API endpoint 'vaults/balance', validates using TypeAdapter(list[VaultBalance]), and returns the list.
    @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 by the TypeAdapter for validation. Includes fields: token (str), size (str), last_updated_at (int).
    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")]
  • TypeAdapter instance for list[VaultBalance] used to validate the API response in the handler function.
    vault_balance_adapter = TypeAdapter(list[VaultBalance])
  • The @server.tool decorator registers the get_vault_balance function as the MCP tool named 'paradex_vault_balance'.
    @server.tool(name="paradex_vault_balance")

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/Habinar/mcp-paradex-py'

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