Skip to main content
Glama
al-one

MCP Server for stock and crypto

获取加密货币杠杆多空比

okx_loan_ratios

Get the cumulative ratio of borrowed quote currency to borrowed base currency for OKX crypto loans, adjustable by symbol and time period.

Instructions

获取OKX加密货币借入计价货币与借入交易货币的累计数额比值

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolNo币种,格式: BTC 或 ETHBTC
periodNo时间粒度,仅支持: [5m/1H/1D] 注意大小写,仅分钟为小写m1h

Implementation Reference

  • The handler/implementation of the 'okx_loan_ratios' tool. It fetches OKX crypto loan ratios (long/short ratio) via the OKX API endpoint /api/v5/rubik/stat/margin/loan-ratio, processes the data with pandas, and returns a CSV string with columns '时间' (time) and '多空比' (long/short ratio).
    def okx_loan_ratios(
        symbol: str = Field("BTC", description="币种,格式: BTC 或 ETH"),
        period: str = Field("1h", description="时间粒度,仅支持: [5m/1H/1D] 注意大小写,仅分钟为小写m"),
    ):
        res = requests.get(
            f"{OKX_BASE_URL}/api/v5/rubik/stat/margin/loan-ratio",
            params={
                "ccy": symbol,
                "period": period,
            },
            timeout=20,
        )
        data = res.json() or {}
        dfs = pd.DataFrame(data.get("data", []))
        if dfs.empty:
            return pd.DataFrame()
        dfs.columns = ["时间", "多空比"]
        dfs["时间"] = pd.to_datetime(dfs["时间"], errors="coerce", unit="ms")
        dfs["多空比"] = pd.to_numeric(dfs["多空比"], errors="coerce")
        return dfs.to_csv(index=False, float_format="%.2f").strip()
  • The @mcp.tool decorator that registers 'okx_loan_ratios' as an MCP tool with title '获取加密货币杠杆多空比' and description '获取OKX加密货币借入计价货币与借入交易货币的累计数额比值'.
    @mcp.tool(
        title="获取加密货币杠杆多空比",
        description="获取OKX加密货币借入计价货币与借入交易货币的累计数额比值",
    )
    def okx_loan_ratios(
        symbol: str = Field("BTC", description="币种,格式: BTC 或 ETH"),
        period: str = Field("1h", description="时间粒度,仅支持: [5m/1H/1D] 注意大小写,仅分钟为小写m"),
Behavior2/5

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

No annotations are provided, so the description must fully disclose behavioral traits. It only states the action (get ratio) but omits details about the return format, whether it is a read-only operation, rate limits, or authentication requirements. This leaves the agent with significant uncertainty.

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 a single concise sentence with no unnecessary words. It is efficiently front-loaded with the core action. However, it could benefit from a bit more structure (e.g., mentioning output format) without losing conciseness.

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 simple two-parameter input and no output schema, the description is minimally adequate but lacks details on the nature of the ratio (e.g., numeric value, interpretation). The agent may need to infer behavior from context, which is risky for a financial tool.

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

Parameters3/5

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

The input schema has 100% description coverage for both parameters (symbol and period). The tool description adds no extra information beyond what the schema already provides. According to guidelines, baseline score is 3 when schema coverage is high.

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 states the tool fetches a ratio of cumulative borrowed amounts for cryptocurrencies on OKX. This clearly identifies the resource and action (get ratio). It differs from sibling tools like okx_prices and okx_taker_volume, though no explicit differentiation is provided.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool or how it compares to alternatives. There is no mention of market sentiment analysis or other use cases. The agent must infer usage from the name and title alone.

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

Install Server

Other Tools

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/al-one/mcp-aktools'

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