Skip to main content
Glama
Habinar

MCP Paradex Server

by Habinar

paradex_account_positions

Monitor open positions to analyze exposure, profitability, and risk for trading decisions. Check P&L, liquidation prices, and margin requirements across markets.

Instructions

Analyze your open positions to monitor exposure, profitability, and risk.

Use this tool when you need to:
- Check the status and P&L of all your open positions
- Monitor your liquidation prices and margin requirements
- Assess your exposure across different markets
- Make decisions about position management (scaling, hedging, closing)

Understanding your current positions is fundamental to proper risk management
and is the starting point for many trading decisions.

Example use cases:
- Checking the unrealized P&L of your positions
- Monitoring liquidation prices during market volatility
- Assessing total exposure across related assets
- Verifying entry prices and position sizes

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function for the paradex_account_positions tool. It fetches the user's account positions using the authenticated Paradex client, validates the response with Pydantic, and returns a formatted result including the schema and positions data.
    @server.tool(name="paradex_account_positions")
    async def get_account_positions(ctx: Context) -> dict:
        """
        Analyze your open positions to monitor exposure, profitability, and risk.
    
        Use this tool when you need to:
        - Check the status and P&L of all your open positions
        - Monitor your liquidation prices and margin requirements
        - Assess your exposure across different markets
        - Make decisions about position management (scaling, hedging, closing)
    
        Understanding your current positions is fundamental to proper risk management
        and is the starting point for many trading decisions.
    
        Example use cases:
        - Checking the unrealized P&L of your positions
        - Monitoring liquidation prices during market volatility
        - Assessing total exposure across related assets
        - Verifying entry prices and position sizes
        """
        client = await get_authenticated_paradex_client()
        response = client.fetch_positions()
        if "error" in response:
            await ctx.error(response)
            raise Exception(response["error"])
        positions = position_adapter.validate_python(response["results"])
    
        results = {
            "description": Position.__doc__.strip() if Position.__doc__ else None,
            "fields": Position.model_json_schema(),
            "results": positions,
        }
        return results
  • Pydantic model defining the Position structure, used for validating the positions list returned by the Paradex API and generating the JSON schema in the tool response.
    class Position(BaseModel):
        """Position model representing a trading position on Paradex."""
    
        id: Annotated[str, Field(description="Unique string ID for the position")]
        account: Annotated[str, Field(description="Account ID of the position")]
        market: Annotated[str, Field(description="Market for position")]
        status: Annotated[
            str, Field(description="Status of Position : Open or Closed", enum=["OPEN", "CLOSED"])
        ]
        side: Annotated[str, Field(description="Position Side : Long or Short", enum=["SHORT", "LONG"])]
        size: Annotated[
            float,
            Field(description="Size of the position with sign (positive if long or negative if short)"),
        ]
        average_entry_price: Annotated[float, Field(description="Average entry price")]
        average_entry_price_usd: Annotated[float, Field(description="Average entry price in USD")]
        average_exit_price: Annotated[float, Field(description="Average exit price")]
        unrealized_pnl: Annotated[
            float, Field(description="Unrealized P&L of the position in the quote asset")
        ]
        unrealized_funding_pnl: Annotated[
            float, Field(description="Unrealized running funding P&L for the position")
        ]
        cost: Annotated[float, Field(description="Position cost")]
        cost_usd: Annotated[float, Field(description="Position cost in USD")]
        cached_funding_index: Annotated[float, Field(description="Position cached funding index")]
        last_updated_at: Annotated[int, Field(description="Position last update time")]
        last_fill_id: Annotated[
            str, Field(description="Last fill ID to which the position is referring")
        ]
        seq_no: Annotated[
            int,
            Field(
                description="Unique increasing number (non-sequential) that is assigned to this position update. Can be used to deduplicate multiple feeds"
            ),
        ]
        liquidation_price: Annotated[
            str, Field(default="", description="Liquidation price of the position")
        ]
        leverage: Annotated[float, Field(default=0, description="Leverage of the position")]
        realized_positional_pnl: Annotated[
            float,
            Field(
                default=0,
                description="Realized PnL including both positional PnL and funding payments. Reset to 0 when position is closed or flipped.",
            ),
        ]
        created_at: Annotated[int, Field(default=0, description="Position creation time")]
        closed_at: Annotated[int, Field(default=0, description="Position closed time")]
        realized_positional_funding_pnl: Annotated[
            str,
            Field(
                default="",
                description="Realized Funding PnL for the position. Reset to 0 when position is closed or flipped.",
            ),
        ]
  • Import of the tools module, which loads and registers all tool handlers via their @server.tool decorators, including paradex_account_positions.
    from mcp_paradex.tools import *
  • Pydantic TypeAdapter used to validate the list of positions from the API response.
    position_adapter = TypeAdapter(list[Position])
  • Helper function to obtain the authenticated ParadexApiClient instance, called by the tool handler.
    async def get_authenticated_paradex_client() -> ParadexApiClient:
        """
        Get or initialize the authenticated Paradex client.
    
        Returns:
            Paradex: The initialized Paradex client.
    
        Raises:
            ValueError: If the required configuration is not set.
        """
        client = await get_paradex_client()
        if client.account is None:
            raise ValueError("Paradex client is not authenticated")
        return client

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.7/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes the tool's function as a read-only analysis tool for open positions, including aspects like exposure and risk monitoring, which implies non-destructive behavior. However, it lacks details on potential limitations, such as data freshness, rate limits, or authentication requirements, leaving some behavioral traits unspecified.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections (purpose, usage guidelines, example use cases) and uses bullet points for readability. It avoids unnecessary repetition and stays focused on essential information, though it could be slightly more concise by integrating some points into fewer sentences without losing clarity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (analyzing positions with no parameters) and lack of annotations and output schema, the description does a decent job covering purpose and usage. However, it doesn't explain what the output looks like (e.g., data format, fields returned), which is a gap since there's no output schema to rely on, making it less complete for an agent to fully understand the tool's behavior.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description appropriately focuses on the tool's purpose and usage without redundant parameter details, adding value by explaining what the tool does rather than how to call it, which aligns well with the schema's completeness.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose as analyzing open positions to monitor exposure, profitability, and risk, which is specific and actionable. However, it doesn't explicitly differentiate from sibling tools like 'paradex_vault_positions' or 'paradex_account_summary', which might also provide position-related information, leaving some ambiguity about its unique scope.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides a bulleted list of specific use cases (e.g., checking P&L, monitoring liquidation prices) and states it's for analyzing open positions, which gives clear context on when to use it. However, it doesn't explicitly mention when not to use it or name alternatives among siblings, such as for historical positions or vault-specific data, which could improve guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.