htx-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@htx-mcpShow my HTX futures open positions and account balance."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
HTX Official API MCP
这是一个基于 HTX 官方 REST API 的 Python MCP Server,使用 uv 管理环境,覆盖
现货与 USDT 本位合约的行情、账户、订单、仓位、策略单、杠杆和历史数据。
仓库现在以可安装的 HTX Trader plugin 为主要交付物;MCP 是它的实时数据和受控执行
边界,skills 则为市场研究、交易规划、受保护执行、杠杆操作和排障提供按需加载的工作流。
plugin 位于 plugins/htx-trader/。
服务通过 MCP 暴露三类能力:
Tools:行情查询、账户查询、下单、撤单、仓位和策略单操作。
Resource:
htx://configuration,返回不含密钥的运行配置和安全策略。Prompt:
trade_preflight,生成交易前检查清单。
安装
要求 Python 3.10+ 和 uv。Windows PowerShell:
uv sync --dev
Copy-Item .env.example .env
uv run --env-file .env htx-mcpUbuntu:
uv sync --dev
cp .env.example .env
uv run --env-file .env htx-mcp.env 不会被 MCP Server 自己解析;使用 uv run --env-file .env 启动,或由 MCP
客户端通过 env 字段传入同样的变量。
验证安装:
uv run pytest -qRelated MCP server: Hyperliquid MCP Server
配置
变量 | 默认值 | 用途 |
| 空 | HTX Access Key;私有接口必需 |
| 空 | HTX Secret Key;仅用于本地签名 |
|
| 现货 API Host |
|
| USDT 本位合约 API Host |
|
| 语义化 U 本位账户、仓位和订单工具使用的接口版本;仅未迁移账户使用 |
| 空 | 可选默认现货账户 ID;留空时自动解析唯一 working spot 账户 |
|
| 单次 HTTP 请求超时 |
|
| 只读 GET 遇到 |
|
| 是否允许写接口真正发往 HTX; |
|
| 是否允许 U 本位合约写接口; |
|
| 工具集 allow-list: |
|
|
|
|
| 文件日志级别: |
|
| 日志目录;支持 Windows 和 Ubuntu 路径以及 |
|
| 活动日志达到该字节数后滚动;设为 |
| 空 | 显式 HTTP CONNECT 代理 URL,例如 |
| 继承环境 | 不经过代理的 Host;为强制 HTX 走代理可设为空字符串 |
现货与合约使用独立 Host。除非部署环境明确要求其他官方域名,否则保持默认值。 API 密钥建议只授予 Read;只有确实需要交易时才授予 Trade,并绑定 IP。Secret 不会写入 MCP 响应或日志。
v5 是默认的 U 本位多资产保证金路径:语义工具会使用 /v5/account/*、
/v5/trade/* 和 /v5/position/*。旧的 /linear-swap-api/v1、v3 映射仍在
advanced 工具集中供未迁移账户排障;不要把 v5 的 margin_mode、type、
time_in_force 字段与旧版 direction、offset、order_price_type 混用。v5 杠杆是
独立写操作,futures_v5_set_leverage 属于 execution(因此 HTX_TOOLSETS=trading
可用):先显式设置杠杆,再提交不带 leverage 的订单意图。订单意图的
position_side 默认为 both,仅适合单向持仓;双向持仓须明确选择 long 或 short。
HTTPX 默认读取进程的 HTTP_PROXY、HTTPS_PROXY、ALL_PROXY 和 NO_PROXY。
若代理端口同时提供 HTTP 与 SOCKS5,优先使用 http://127.0.0.1:7897;HTTPS
请求会通过 HTTP CONNECT 隧道转发。仅 SOCKS5 可用时,需要将代理写成
socks5://127.0.0.1:7897 并安装 HTTPX 的 SOCKS extra。
MCP 客户端接入
切换 U 本位账户类型
scripts/switch_to_non_unified_account.py 是独立于 MCP 的受保护切换脚本。它只读取
HTX_SWITCH_API_KEY 与 HTX_SWITCH_API_SECRET,不会读取 MCP 的凭据或自动加载 .env。
先在调用它的进程环境中设置这对专用凭据,再先做只读预检:
uv run python scripts/switch_to_non_unified_account.py仅在所有 U 本位仓位和挂单均已清空、且确认需切换为可 API 下单的非统一账户后,才显式执行:
uv run python scripts/switch_to_non_unified_account.py --confirm-switch-to-non-unified若 HTX 返回错误,可追加 --diagnostics 生成工单所需的脱敏请求端点、请求体和原始响应 JSON;
认证查询参数不会输出。
Codex plugin
plugins/htx-trader/ 是本仓库的 Codex plugin。它默认启动只读的语义化
analysis,planning,ops 工具面,并将 HTX 凭据从宿主环境转发给 MCP 进程。它同时提供:
htx-market-research:市场研究、监控条件和有界等待;无交易条件时在trading/留下观察计划。htx-trading-desk:持续实盘测试的总控路由,协调研究、计划、等待和本地交易笔记。htx-trade-plan:从实时状态到规范化、已校验的交易计划。htx-guarded-execution:在当前用户授权范围内执行,并在执行后对账。htx-margin-operations:杠杆资金、借还款和杠杆订单的独立流程。htx-operations:私有 API、工具集和账户模式排障。
安装 plugin 后,若需要真实交易,必须由部署者显式将 plugin 的 MCP 配置改为
HTX_TOOLSETS="trading" 和 HTX_ENABLE_TRADING="true";skills 不会绕过服务端双重确认。
用户的交易授权范围只约束 agent 行为;它不是 MCP 服务端的权限策略,并且默认仅在当前对话有效。
低层端点仍由 HTX_TOOLSETS=all 提供,供高级兼容与诊断使用。
Ubuntu Codex CLI local install
在仓库根目录创建本地配置(真实 .env 已被 Git 忽略):
cp .env.example .env
chmod 600 .env在 .env 设置 HTX_API_KEY、HTX_API_SECRET、HTX_ENABLE_TRADING 和
HTX_TOOLSETS。例如,HTX_ENABLE_TRADING=false 与
HTX_TOOLSETS=analysis,planning,ops 提供只读研究/规划模式;只有明确设置
HTX_ENABLE_TRADING=true 与 HTX_TOOLSETS=trading 后才会发布语义化执行工具。
安装仓库级 marketplace 并安装 plugin:
codex plugin marketplace add /workspace/htx-mcp
codex plugin add htx-trader@htx-mcp-local启动新会话后,plugin 通过 scripts/run-htx-mcp-from-env.sh 用同一份 .env 启动 MCP。
所有 HTX MCP 工具调用统一使用 tool_timeout_sec=7200(两小时),以支持有界市场等待。
若仓库不在 /workspace/htx-mcp,将 plugins/htx-trader/.mcp.json 的 cwd 改为实际绝对路径,
然后重新安装 plugin。
Direct Codex MCP configuration
将以下配置添加到用户级 ~/.codex/config.toml,或受信任项目的
.codex/config.toml。先在启动 Codex 的本地环境中设置 HTX_API_KEY 和
HTX_API_SECRET;env_vars 会将它们转发给 MCP 进程,因此不必把 Secret 写入
TOML 文件。
[mcp_servers.htx]
command = "uv"
args = ["run", "htx-mcp"]
cwd = "F:/htxauto"
env = { HTX_ENABLE_TRADING = "false", HTX_TOOLSETS = "analysis,planning,ops" }
env_vars = ["HTX_API_KEY", "HTX_API_SECRET"]此配置只发布语义化的分析、规划和诊断工具;即使工具调用传入 confirm=true,也只会
返回 dry-run。完成配置后重启 Codex,并在 TUI 中使用 /mcp 检查 htx 是否已连接。
需要交易面时,应使用单独的受限执行进程,并显式配置 HTX_TOOLSETS="trading" 和
HTX_ENABLE_TRADING="true"。
stdio 是桌面 MCP 客户端最简单的传输方式。Windows 上可使用绝对路径:
{
"mcpServers": {
"htx": {
"command": "uv",
"args": [
"--directory",
"F:/htxauto",
"run",
"htx-mcp"
],
"env": {
"HTX_API_KEY": "your-access-key",
"HTX_API_SECRET": "your-secret-key",
"HTX_ENABLE_TRADING": "false"
}
}
}
}stdout 只用于 MCP JSON-RPC;正常运行时不向 stderr 写日志,避免调用记录进入 Codex 的
stderr 日志。无法创建日志目录等启动期致命错误仍可能由 Python 在 stderr 报告。
如果使用 sse 或 streamable-http,必须在外部配置认证、反向代理和网络访问
控制;不要将带 Trade 权限的服务直接暴露到公网。
Ubuntu 客户端配置使用同一命令,只需替换项目路径:
{
"mcpServers": {
"htx": {
"command": "uv",
"args": ["--directory", "/home/user/htxauto", "run", "htx-mcp"],
"env": {
"HTX_ENABLE_TRADING": "false",
"HTX_LOG_LEVEL": "INFO"
}
}
}
}调用日志
每次工具调用默认向 ~/.htxmcp/htx-mcp.log 写入单行 JSON 日志:
tool_input:工具名及输入参数。tool_output:结构化返回、是否出错和耗时。tool_error:未能生成正常工具返回时的异常类型、消息和耗时。
call_id 用来关联同一次调用的输入和输出。API Key、Secret、Authorization、Token、
Password、Signature 以及签名 URL 中的认证参数会被替换为 <redacted>。日志仍可能包含
余额、仓位、订单和成交数据,应按敏感交易记录保护,不要上传到公开日志服务。
活动日志默认达到 10 MiB 后滚动为类似
htx-mcp.20260907T120000000000Z.1234.1.log 的文件。滚动文件不压缩、不自动删除,因而会
持续保留;管理员必须自行监控 ~/.htxmcp 的磁盘占用。目录会尝试设置为仅当前用户可访问,
日志文件会尝试设置为 0600;Windows 上最终权限仍由该目录的 ACL 决定。
HTX_LOG_LEVEL=INFO(默认)记录成功和失败调用;DEBUG 还会启用更详细的组件诊断;
WARNING 不记录成功调用;ERROR 只记录失败调用;CRITICAL 关闭普通调用和错误日志。
无效级别会在启动时明确报错。Windows PowerShell 可使用
$env:HTX_LOG_LEVEL = "WARNING",Ubuntu shell 可使用
export HTX_LOG_LEVEL=WARNING。
Ubuntu 可选择由系统 logrotate 管理活动文件。先在 MCP 环境中设置
HTX_LOG_MAX_BYTES=0,再复制 scripts/htx-mcp.logrotate 到
/etc/logrotate.d/htx-mcp,并把其中两处 USERNAME 替换为运行 MCP 的实际用户。模板使用
copytruncate、nocompress 和 rotate -1:只复制后截断活动文件,不压缩且不删除历史日志。
不要同时让内部大小滚动和 logrotate 管理同一活动文件,以免产生难以预测的双重切分。
私有接口认证排障
先调用只读工具 htx_diagnose_private_access。它会分别测试现货账户和合约 API
交易状态,并安全返回 HTX 的 HTTP 状态、错误码和错误消息,不会返回 Secret、签名
或完整请求 URL。
Codex 配置中的布尔值必须使用标准 TOML 字符。只读配置应精确写成:
HTX_ENABLE_TRADING = "false"不要在该行末尾加入中文逗号或其他字符。false 会让 confirm=true 的写工具继续
返回 dry-run;只有诊断通过、你明确准备执行真实交易时,才改为 "true"。
若诊断返回 api-signature-not-valid 或 Incorrect Access Key,依次核对 API Key
是否仍有效、Access Key 与 Secret Key 是否来自同一条 API Key、IP 白名单是否包含
运行 Codex 的出口 IP,以及是否因复制粘贴带入首尾空白。若返回权限错误,请在 HTX
后台为该 API Key 开启所需的 Read 或 Trade 权限。
工具范围
现货
spot_get_ticker、spot_get_tickers、spot_get_klines、spot_get_depth、spot_get_recent_trades:实时行情、全市场快照、K 线、深度和成交。spot_get_symbols、spot_get_currencies、spot_get_currency_reference、spot_get_market_status、spot_get_server_timestamp:交易规则和公共元数据。spot_get_accounts、spot_get_account_balance、spot_get_open_orders、spot_get_order*、spot_get_match_results、spot_get_history_orders:账户和订单查询。spot_place_order、spot_cancel_*、spot_dead_man_switch:现货下单、撤单和断线保护。htx_diagnose_private_access:安全诊断现货与合约私有 API 的认证、权限和 Host 配置。
现货杠杆
spot_margin_get_account、spot_margin_get_loan_info、spot_margin_get_loan_orders:逐仓或全仓的账户风险、借币利率/额度和借币记录;这些原始兼容接口位于advanced工具集。spot_margin_transfer、spot_margin_borrow、spot_margin_repay:划转、借币和按借币单 ID 还款。spot_margin_place_order使用从杠杆账户查询结果取得的显式账户 ID,并自动选择margin-api(逐仓)或super-margin-api(全仓);逐仓必须传symbol,全仓必须省略它;资金接口金额以最多三位小数的固定点字符串传入。日常使用高层工作流:先调用
htx_get_spot_margin_snapshot,再用htx_plan_spot_margin_action检查实时借币额度和规范化请求,最后才用htx_execute_spot_margin_action及显式confirm=true执行。借币、还款与资金划转均不会隐式发生在现货下单中。
USDT 本位合约
futures_get_contracts、futures_get_ticker、futures_get_tickers、futures_get_depth、futures_get_klines、futures_get_recent_trades:合约行情和规则。futures_get_index、futures_get_price_limit、futures_get_open_interest、futures_get_funding_rate、futures_get_historical_funding_rate、futures_get_risk_info、futures_get_liquidation_orders:衍生品市场数据。futures_get_account_info、futures_get_positions、futures_get_open_orders、futures_get_order_*:合约账户、仓位和当前订单查询,支持isolated/cross。futures_get_history_orders、futures_get_match_results、futures_get_financial_records、futures_get_liquidation_orders:使用 HTX 当前 v3 历史订单、成交、财务记录和强平查询接口;已停用的 v1 查询接口不会暴露。futures_v5_get_trade_history:查询 v5 最近三天的成交明细;支持合约、订单、时间范围和游标筛选,属于advanced只读工具集。futures_place_order、futures_place_batch_orders、futures_cancel_*、futures_switch_leverage、futures_lightning_close_position:合约交易。futures_place_trigger_order、futures_get_trigger_*、futures_cancel_trigger_*、futures_switch_position_mode:触发单和持仓模式。
工具的完整名称、参数和 JSON Schema 会由 MCP Server 自动发布给客户端;文档中的 通配符表示同一组工具,而不是可直接调用的工具名。
面向 LLM 的参数约定
工具 Schema 会为每个参数发布用途、单位、默认值、范围和枚举说明。合约筛选参数优先使用
可读值:all、open_long、open_short、close_short、close_long、
liquidate_long、liquidate_short、buy、sell;服务端会在请求 HTX 前转换成官方数字代码。
触发单的 trigger_type 优先使用 greater_or_equal 或 less_or_equal,持仓模式优先使用
one_way 或 hedged;为兼容旧调用,HTX 原始短代码和数字值仍可接受。
批量合约下单的每个 orders 元素也有嵌套 JSON Schema,明确标出
contract_code、volume、direction、order_price_type 等必填字段,以及价格、杠杆、
TP/SL 和 reduce_only 等可选字段。时间参数统一使用 Unix 毫秒时间戳;下单、撤单、切换
杠杆或持仓模式等写工具的 confirm 默认是 false,只会返回 dry-run 预览。
价格、数量、成交量和 TP/SL 价格使用 Decimal 语义处理,并以固定点字符串发送给 HTX。
高精度交易参数建议传字符串,例如 "0.00000001" 或 "60000.123456789012345678",
不要依赖 JSON 浮点数表达超高精度价格。
client_order_id 按产品使用不同类型:现货接受 1-64 位字母、数字、下划线或连字符;合约普通订单只接受范围 1..2^63-1 的十进制正整数(字符串必须全为数字,发送前会规范化为精确字符串)。
U 本位合约接受 1 到 9223372036854775807 的整数。合约查询和撤单会在 HTX 边界按接口
要求转换为字符串,不要给合约订单使用带字母的 client ID。
面向自动分析与交易的工具集
当前 API 映射工具仍完整保留在 advanced 工具集中;高层语义工具负责聚合常用工作流:
analysis:htx_get_market_snapshot、htx_get_market_context、htx_get_technical_indicators、htx_wait_for_market_event、htx_get_instrument_rules、htx_get_account_snapshot、htx_get_portfolio_snapshot、htx_get_trade_history、htx_get_risk_snapshot、htx_get_spot_margin_snapshot。htx_get_portfolio_snapshot是跨现货和合约的盘前账户总览;V5 合约会返回所有合约的当前挂单。htx_get_market_context按需以统一固定点字段返回 K 线、近期成交和合约历史资金费率,供需要审阅市场行为的 REST 分析使用。htx_get_trade_history以统一字段返回实际成交、价格、数量、手续费和时间;复核单笔委托时传order_id,研究近期执行质量时按标的、时间窗和游标分页。htx_get_technical_indicators只返回模型请求的确定性指标(SMA/EMA、RSI、ATR、成交量均线、布林带、MACD、KDJ),默认排除未收盘 K 线;日常分析不暴露原始 K 线。htx_wait_for_market_event只接受有上限的声明式价格/指标阈值,最长一小时且不执行写操作。要让它成为唯一唤醒来源,将外层yield_time_ms设为大于工具timeout_seconds(毫秒)的值并预留响应余量,同时确保 MCP host 的 tool timeout 更长;中途不要 yield。需要研究或排障时,advanced工具集仍提供完整兼容层。
等待工具在条件满足或超时前不会向 LLM 发送中间市场更新;仅在有意延后分析时使用,并在工具返回后重新获取市场快照。
planning:htx_validate_trade_intent、htx_preview_trade、htx_reconcile_trade、htx_plan_spot_margin_action。execution:htx_submit_trade、htx_submit_trade_batch、htx_cancel_trade、htx_cancel_trades、htx_cancel_open_trades、htx_close_position、htx_execute_spot_margin_action、futures_v5_set_leverage。V5 批量下单每次最多 10 笔,且所有委托必须使用同一合约和保证金模式;HTX 可以部分接受批次,必须逐笔复核。批量撤单支持现货 1-50 笔、合约 1-10 笔;全撤现货可选择标的,合约必须明确标的以避免误撤全账户订单。ops:诊断工具。
生产环境可只暴露分析和规划工具:
$env:HTX_TOOLSETS = "analysis,planning"需要交易工具时,再启用:
$env:HTX_TOOLSETS = "trading"未设置 HTX_TOOLSETS 时只发布 analysis,planning,ops;trading 不包含诊断工具,诊断应由单独的 ops 进程提供。需要旧版完整 API 面时显式设置 HTX_TOOLSETS=all。自动交易部署建议使用独立的只读分析进程、诊断进程和交易进程。
语义工具发布明确的 MCP outputSchema。htx_validate_trade_intent 只返回状态、规则和检查项;
需要查看规范化 HTX 请求和采集时的市场上下文时调用 htx_preview_trade。htx_submit_trade
无论校验阻断、dry-run 或真实提交,都稳定返回 validation 与 execution 两部分。
trade_preflight prompt 的参数与交易意图一致,分别接收 product、instrument、action、
side、quantity、order_kind、price、margin_mode、stop_loss 和 take_profit;它只会
引导模型调用分析、校验和预览工具,不会调用执行工具。
交易安全
所有写工具都有两层保护:
调用参数必须显式传
confirm=true;默认false时只返回完整 dry-run 请求。进程必须显式设置
HTX_ENABLE_TRADING=true,否则即使传了confirm=true也只返回预览。
只读模式建议保持:
$env:HTX_ENABLE_TRADING = "false"启用真实交易前,先查询合约规则、账户余额、仓位和未成交订单,再进行本地风险检查。 合约下单支持在开仓请求中传入 HTX 官方 TP/SL 字段,保护单由交易所侧维护。
下单工具返回的是 HTX 的“受理”结果,不代表已经成交。下单、撤单或平仓后,必须
再次调用对应的订单/仓位查询工具确认最终状态。不要因为网络超时就盲目重试,先用
client_order_id 或订单 ID 查询结果。
开发与测试
uv sync --dev
uv run python -m compileall -q src
uv run pytest -qUbuntu 使用相同的 uv 命令,无需 PowerShell。GitHub Actions 会在 Windows 和 Ubuntu、
Python 3.10 和 3.13 的组合上执行锁文件安装、lint、格式、编译、测试和启动导入检查。
测试使用 mock HTTP,不会触碰真实账户。若客户端无法发现工具,先确认 uv、项目
绝对路径和环境变量均可用,并检查 stderr 日志;不要向 stdout 写入调试信息。
tests/test_semantic_tools.py 会用同一组 mock HTX 响应分别调用底层 API 工具和高层
语义工具,交叉校验行情快照、合约规则、账户状态和最终订单请求,防止聚合层与底层接口
语义漂移。只读 API Key 的交易权限验证应在临时进程中设置:
$env:HTX_TOOLSETS = "trading"
$env:HTX_ENABLE_TRADING = "true"
uv run --env-file .env htx-mcp使用 confirm=true 调用 htx_submit_trade 后,预期由 HTX 返回权限错误;验证完成后恢复
HTX_ENABLE_TRADING=false。不要把真实密钥写入仓库或测试 fixture。
官方文档
Available Tools
15 toolshtx_diagnose_private_accessHTX Diagnose Private AccessARead-onlyIdempotent
Diagnose authenticated access to HTX spot and USDT-swap private APIs without trading.
The result reports credential presence, configured hosts, each check's success, and sanitized HTX error codes/messages. It never returns a secret, signature, or signed URL.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Beyond the readOnly/idempotent annotations, the description discloses specific output behavior: reported fields, sanitized error codes/messages, and a guarantee to never return secrets, signatures, or signed URLs. This materially helps an agent trust and interpret the result.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Three short sentences, with the primary action front-loaded and no redundant wording. Every sentence adds useful information about purpose, output, or safety.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a zero-parameter diagnostic tool with an output schema, the description gives all necessary context: what is diagnosed, what the result contains, and critical privacy behavior. Nothing important is missing for an agent to decide to invoke it.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool has zero parameters and the schema coverage is complete, so there are no undocumented inputs for the description to clarify. The baseline for a no-parameter tool applies, and the description appropriately focuses on behavior instead.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a clear, specific purpose: diagnosing authenticated access to HTX spot and USDT-swap private APIs. It also distinguishes itself from trading and snapshot tools by explicitly noting this is a diagnostic action 'without trading.'
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The 'without trading' wording implies the tool is for pre-trade connectivity and credential checks, but it does not explicitly name sibling alternatives or state when to prefer this tool over get_account_snapshot or get_portfolio_snapshot. Usage guidance is implied rather than spelled out.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
htx_get_account_snapshotHTX Get Account SnapshotBRead-onlyIdempotent
Return a compact authenticated snapshot of balances, positions, and orders.
This is read-only and requires API credentials.
| Name | Required | Description | Default |
|---|---|---|---|
| include | No | Account sections to include. Omit for spot balances/open orders or swap balances/positions/open orders/API status. Spot does not support positions or API status; swap open orders require instrument. | |
| product | Yes | HTX product family: spot or USDT-margined perpetual swap. | |
| verbose | No | Return unfiltered per-record balance details for diagnostics. Defaults to false for a compact valued asset view. | |
| instrument | No | Optional exact symbol or contract to narrow positions/orders. | |
| include_raw | No | When true, include the original HTX envelopes in addition to compact normalized data. | |
| margin_mode | No | Swap margin mode: isolated or cross. | isolated |
Output Schema
| Name | Required | Description |
|---|---|---|
| raw | No | |
| product | Yes | |
| as_of_ms | Yes | |
| balances | No | |
| warnings | Yes | |
| positions | No | |
| account_id | No | |
| api_status | No | |
| instrument | Yes | |
| margin_mode | Yes | |
| open_orders | No | |
| account_type | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint=true, idempotentHint=true, and destructiveHint=false, so the description does not need to restate safety. It does add useful context about requiring API credentials and emphasizes a 'compact' representation, which aligns with the verbose parameter. However, it does not disclose behavior such as how missing sections are handled or what happens when unsupported combinations are requested.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two short sentences with no filler, front-loading the core purpose and immediately stating the key constraints. Every sentence earns its place and the structure is easy to parse.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With a rich output schema, six fully documented parameters, and strong annotations, the description covers the operation's basic nature well. It is less complete on selection context: an agent cannot confidently decide between this and the sibling portfolio/risk/margin snapshot tools without more explicit differentiators.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the input schema already documents all parameters thoroughly. The description adds little beyond the general 'compact' framing, but with full schema coverage the baseline of 3 is appropriate; the tool description does not need to repeat parameter details.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a clear action ('Return') and resource ('compact authenticated snapshot of balances, positions, and orders'), which conveys the tool's core purpose. It does not explicitly contrast with sibling snapshot tools like portfolio or risk snapshots, but the phrase 'balances, positions, and orders' gives enough scope to differentiate at a basic level.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides context by noting the operation is read-only and requires API credentials, but it gives no guidance about when to choose this tool over alternatives such as htx_get_portfolio_snapshot or htx_get_risk_snapshot. No exclusions or alternative conditions are mentioned, leaving the agent to infer usage from the name and sibling list.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
htx_get_instrument_rulesHTX Get Instrument RulesARead-onlyIdempotent
Return HTX precision, minimum, status, and contract rules for one product.
Use these rules before constructing any quantity or price.
| Name | Required | Description | Default |
|---|---|---|---|
| product | Yes | HTX product family: spot or USDT-margined perpetual swap. | |
| instrument | No | Optional exact symbol or contract; omit to list all rules. |
Output Schema
| Name | Required | Description |
|---|---|---|
| rules | Yes | |
| matched | Yes | |
| product | Yes | |
| instrument | Yes | |
| available_count | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint, idempotentHint, and non-destructive behavior, so the description has a lower burden. It adds no behavioral traits beyond stating the return content; it also does not contradict the annotations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two short sentences with no filler. It front-loads the purpose and then gives a brief usage directive, making it easy for an agent to scan and act on quickly.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple read-only lookup tool with an output schema, detailed input schema, and strong annotations, the description is sufficient. It states what is returned and when to use it; the schema covers the optional instrument and product families.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Input schema coverage is 100% and parameter descriptions are already detailed, including the product enum and instrument optionality. The description adds no meaningful parameter-level meaning beyond what the schema provides, so the baseline of 3 applies.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with a specific verb and resource: 'Return HTX precision, minimum, status, and contract rules for one product.' This clearly distinguishes it from sibling market/account/risk tools and states the exact kind of data the agent will receive.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explicitly advises when to use the tool: 'Use these rules before constructing any quantity or price.' It does not enumerate alternatives or when-not-to-use cases, but the usage context is clear and actionable.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
htx_get_market_contextHTX Get Market ContextARead-onlyIdempotent
Return bounded research context without exposing raw HTX envelopes.
Use this when indicators alone are insufficient and a trader needs inspectable OHLCV, a recent public trade tape, or swap funding history. It is a REST snapshot, not a low-latency stream.
| Name | Required | Description | Default |
|---|---|---|---|
| include | No | Optional context sections. Omit for candles and recent trades; funding_history is available only for swaps. | |
| product | Yes | HTX product family: spot or USDT-margined perpetual swap. | |
| instrument | Yes | Spot symbol such as 'btcusdt' or swap contract such as 'BTC-USDT'. | |
| candle_size | No | Number of normalized candles (1-500). | |
| candle_period | No | HTX candle interval for candles: 1min, 5min, 15min, 30min, 60min, 4hour, 1day, 1week, or 1mon. | 60min |
| recent_trade_limit | No | Number of normalized tape records (1-200). | |
| funding_history_limit | No | Number of swap funding-rate records (1-50). |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
The description adds the behavioral trait of being a non-streaming snapshot, but the read-only, idempotent, and non-destructive aspects are already covered by annotations. It does not mention rate limits or other potential side effects.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two sentences, immediately states the purpose, and efficiently covers usage and nature without any fluff. It is well-structured and front-loaded.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description provides purpose, usage conditions, and a behavioral distinction, which is sufficient given the full schema and output schema. The only minor gap is the vague 'raw HTX envelopes' phrasing, which could reduce clarity.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the baseline is 3. The tool description does not add parameter-specific meanings beyond what is already in the schema, but it doesn't need to.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states the core purpose—'return bounded research context'—and enumerates the included data types (OHLCV, recent public trade tape, swap funding history). However, the phrase 'raw HTX envelopes' is ambiguous and could confuse agents.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
It clearly specifies when to use the tool ('when indicators alone are insufficient') and contrasts it with streaming via 'REST snapshot, not a low-latency stream'. This gives agents a concrete decision condition.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
htx_get_market_snapshotHTX Get Market SnapshotARead-onlyIdempotent
Return one compact, concurrently collected market snapshot for analysis or execution.
Prefer this aggregate over several low-level market calls. For technical analysis, call htx_get_technical_indicators instead of requesting raw K-lines.
| Name | Required | Description | Default |
|---|---|---|---|
| include | No | Optional fields to include; omit to use the selected profile. | |
| product | Yes | HTX product family: spot or USDT-margined perpetual swap. | |
| profile | No | Snapshot size: minimal ticker, analysis context, or execution context. | analysis |
| instrument | Yes | Spot symbol such as 'btcusdt' or swap contract such as 'BTC-USDT'. | |
| include_raw | No | When true, include the original HTX envelopes in addition to compact normalized data. |
Output Schema
| Name | Required | Description |
|---|---|---|
| raw | No | |
| data | Yes | |
| product | Yes | |
| profile | Yes | |
| as_of_ms | Yes | |
| warnings | Yes | |
| instrument | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
The read-only, idempotent, and non-destructive behavior is already covered by annotations. The description adds useful behavioral context by noting that the snapshot is concurrently collected and compact, and it references optional raw envelope inclusion, which is transparent about output shape.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two sentences, front-loaded with the core purpose, and contains no redundant or vague wording. It efficiently communicates purpose, usage, and an alternative.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With a full output schema and well-documented parameters, the description provides sufficient context for correct use. It clearly addresses the main decision point against sibling tools and explains the aggregate nature of the snapshot.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema covers all five parameters with descriptions and enums, so the baseline is 3. The tool description itself does not add much parameter-level meaning beyond the schema, though schema descriptions are already clear.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states a specific verb and resource: 'Return one compact, concurrently collected market snapshot'. It also distinguishes this aggregate tool from low-level market calls and explicitly names a sibling tool, htx_get_technical_indicators, for technical analysis.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description gives explicit usage guidance: prefer this aggregate over several low-level market calls, and use htx_get_technical_indicators instead when technical analysis is needed. This directly helps an agent choose between competing tools.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
htx_get_portfolio_snapshotHTX Get Portfolio SnapshotARead-onlyIdempotent
Return one compact cross-product portfolio snapshot for account review.
It concurrently reads spot and USDT-swap balances and positions. V5 swap accounts also return open orders across every contract, so this is the preferred pre-session portfolio check; no market data is fetched.
| Name | Required | Description | Default |
|---|---|---|---|
| verbose | No | Return unfiltered per-record balance details for diagnostics. Defaults to false for a compact valued asset view. | |
| margin_mode | No | Swap margin mode: isolated or cross. | isolated |
| include_open_orders | No | Include active orders. For legacy swaps this requires a per-contract account snapshot, so the result reports that limitation as a warning. | |
| include_zero_balances | No | Include zero-valued spot balance records for diagnostics. Defaults to false to keep the compact snapshot bounded. |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already establish read-only, idempotent, and non-destructive behavior, so the description adds valuable non-obvious details: it reads concurrently, V5 swap accounts also include open orders, and no market data is fetched. These traits go beyond the structured annotations and help an agent predict side effects and scope accurately.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two sentences, with the main purpose front-loaded and a second sentence adding useful scope and behavioral context. Every sentence earns its place, and there is no redundant repetition of the title or schema.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the rich annotations, 100% schema coverage, and the presence of an output schema, the description is sufficiently complete. It explains what the tool returns, what accounts it touches, when it is preferred, and what it deliberately avoids doing, leaving no critical gap for correct invocation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema already documents all four parameters well. The tool description does not add much parameter-level meaning beyond reinforcing the 'compact' default behavior, so a baseline score of 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with a specific verb and resource: 'Return one compact cross-product portfolio snapshot for account review.' It further distinguishes itself by stating it reads spot and USDT-swap balances/positions, adds V5 open-order coverage, and explicitly notes that no market data is fetched, separating it from market-oriented sibling tools.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides clear usage context by calling this 'the preferred pre-session portfolio check' and explains that it covers both spot and USDT-swap balances and positions. It does not explicitly name alternative tools or state when not to use it, but the context is strong enough for an agent to infer the right situation.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
htx_get_risk_snapshotHTX Get Risk SnapshotARead-onlyIdempotent
Combine current market and account state into a pre-trade risk snapshot.
The tool supplies facts and warnings; it does not make a trading decision.
| Name | Required | Description | Default |
|---|---|---|---|
| product | Yes | HTX product family: spot or USDT-margined perpetual swap. | |
| instrument | Yes | Spot symbol such as 'btcusdt' or swap contract such as 'BTC-USDT'. | |
| margin_mode | No | Swap margin mode: isolated or cross. | isolated |
Output Schema
| Name | Required | Description |
|---|---|---|
| market | Yes | |
| account | Yes | |
| product | Yes | |
| warnings | Yes | |
| instrument | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already disclose read-only/idempotent behavior; description adds that it supplies facts/warnings and does not make a trading decision, reinforcing the non-destructive nature without contradiction.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two focused sentences: purpose first, behavioral limitation second. No redundant or irrelevant content.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Combined with complete schema and annotations, the description gives enough context for a read-only snapshot tool. Pre-trade framing and the non-decision caveat cover key boundaries, while output details are left to the output schema.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema covers all parameters with descriptions, enums, and defaults. Description adds no parameter-specific meaning beyond the overall pre-trade context.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific purpose: combine current market and account state into a pre-trade risk snapshot. Clearly distinguishes from decision/execution tools and from market/account snapshot siblings.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Implies pre-trade use and non-execution, but does not explicitly state when to choose this over sibling snapshot, validation, or preview tools.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
htx_get_spot_margin_snapshotHTX Get Spot Margin SnapshotARead-onlyIdempotent
Return compact spot-margin balances, debt/risk fields, and current loan quotas.
This read-only preflight is designed to precede borrowing, repayment, or any margin-funded trade.
| Name | Required | Description | Default |
|---|---|---|---|
| instrument | No | Required isolated-margin symbol; omit for cross margin. | |
| include_raw | No | When true, include the original HTX envelopes in addition to compact normalized data. | |
| margin_mode | Yes | Spot-margin mode: isolated per symbol or cross across currencies. |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint, idempotentHint, and destructiveHint=false. The description adds useful behavior beyond that by noting it returns normalized compact data and loan quotas, and that it is intended as a safe preflight check. This is sufficient given the strong annotation coverage.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two tight sentences with no filler. The first sentence front-loads the output, and the second adds the key usage context, so every sentence earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool is simple with three well-documented parameters, a full output schema, and comprehensive annotations. The description adds the missing usage intent and data scope, making it complete for an agent to select and invoke correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, with each parameter already explained including defaults and the conditional use of instrument for isolated margin. The description itself adds no parameter-level detail beyond the schema, so the baseline 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb ('Return') plus a clear resource ('compact spot-margin balances, debt/risk fields, and current loan quotas'), which states exactly what the tool produces. The spot-margin scope separates it from sibling snapshots like account, portfolio, market, and risk snapshots, so an agent can tell it apart.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explicitly positions the tool as a 'read-only preflight' for borrowing, repayment, or margin-funded trades, giving clear when-to-use context. It does not explicitly name alternatives or state when not to use it, but the usage scenario is specific enough to guide selection.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
htx_get_technical_indicatorsHTX Get Technical IndicatorsARead-onlyIdempotent
Return only the requested, Decimal-calculated technical indicators.
The model chooses which named indicators to inspect; it never calculates them itself. Results are display-rounded only at response time: EMA uses candle price precision plus one decimal, MACD uses it plus three, and RSI/KDJ use two decimal places. Raw K-lines remain available solely through the opt-in advanced compatibility toolset for research and diagnostics.
| Name | Required | Description | Default |
|---|---|---|---|
| period | No | HTX candle interval: 1min, 5min, 15min, 30min, 60min, 4hour, 1day, 1week, or 1mon. | 60min |
| product | Yes | HTX product family: spot or USDT-margined perpetual swap. | |
| indicators | Yes | Indicators to calculate. Use sma:N (or ma:N), ema:N, rsi:N, atr:N, volume_sma:N, bbands:N,multiplier, macd:fast,slow,signal, or kdj:N,k_smoothing,d_smoothing. Example: ['sma:20', 'sma:60', 'rsi:14', 'macd:12,26,9']. Values are calculated deterministically from completed HTX candles. | |
| instrument | Yes | Spot symbol such as 'btcusdt' or swap contract such as 'BTC-USDT'. | |
| candle_size | No | Maximum HTX candles to fetch. It must cover the largest requested indicator lookback; 300 is suitable for most standard indicators. | |
| include_current_candle | No | Include the still-forming candle when true. Defaults to false so decisions use only completed candles and do not repaint. |
Output Schema
| Name | Required | Description |
|---|---|---|
| period | Yes | |
| product | Yes | |
| as_of_ms | Yes | |
| indicators | Yes | |
| instrument | Yes | |
| completed_candles | Yes | |
| latest_completed_open_ms | Yes | |
| omitted_incomplete_candles | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Beyond the readOnlyHint and idempotentHint annotations, the description adds meaningful behavioral details: deterministic calculation from completed candles, display rounding behavior, and the default exclusion of the current candle to avoid repainting. These enrich the agent's understanding of side effects and output semantics.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise, front-loaded with the core purpose, and structured to communicate key constraints (rounding, completed candles) without verbosity. Every sentence serves a distinct informative purpose.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description is complete for the tool's scope: it explains the output type, calculation basis, defaults, and the availability of raw data elsewhere. With an output schema present, no further return-value explanation is necessary.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema descriptions already cover all parameters with detailed formats, enumerations, and examples. The tool description itself adds no additional parameter meaning, so it does not exceed the baseline for full schema coverage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool returns requested technical indicators, specifying that the model chooses indicators and the tool calculates them. It is distinct from raw market data tools and establishes a clear resource and action.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies when to use the tool ('Return only the requested indicators', 'never calculates them itself') and contrasts with raw K-line availability, though it does not explicitly name sibling alternatives. This is clear but not fully explicit about when not to use it in favor of other tools.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
htx_get_trade_historyHTX Get Trade HistoryARead-onlyIdempotent
Return compact executed-fill history for one instrument, not order history.
Traders normally review fills to reconcile an order, calculate realized
entry/exit prices and fees, or inspect recent execution quality. Provide
order_id for reconciliation; otherwise use a bounded time window and
cursor to page a recent instrument history. The exchange retention window
is 48 hours for spot and legacy swaps, and three days for v5 swaps.
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum normalized fills to return (1-100). | |
| cursor | No | Opaque cursor from the previous result. Omit on the first page. | |
| product | Yes | HTX product family: spot or USDT-margined perpetual swap. | |
| end_time | No | Optional inclusive millisecond end time for a paged history query. | |
| order_id | No | Optional exchange order ID. When supplied, return fills for that order rather than a paged instrument history. | |
| direction | No | Page direction: prev returns older records and next advances from a cursor. | prev |
| instrument | Yes | Spot symbol such as 'btcusdt' or swap contract such as 'BTC-USDT'. | |
| start_time | No | Optional inclusive millisecond start time for a paged history query. | |
| include_raw | No | When true, include the original HTX envelopes in addition to compact normalized data. | |
| margin_mode | No | Swap margin mode: isolated or cross. | isolated |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnly, idempotent, and non-destructive behavior. The description adds useful behavioral context beyond that: it switches modes based on order_id versus time-window paging, returns compact normalized data by default, and discloses the 48-hour/3-day retention window. No contradiction with annotations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Three sentences with no filler. The opening sentence states the core scope and exclusion, the middle sentence grounds usage in trader workflows, and the final sentence provides the retention constraint. Every sentence earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Despite having 10 parameters, the schema fully documents each one and an output schema exists. The description covers the two key decision paths (order_id versus paged history), the retention limitations, and the distinction from order history. Nothing critical for correct invocation is missing.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so the baseline is 3. The description adds meaningful semantics by explaining that order_id selects reconciliation mode, that cursor is for paging instrument history, that time windows should be bounded, and that 'compact' output contrasts with include_raw. This goes beyond the schema's individual parameter descriptions.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb ('Return') and resource ('executed-fill history for one instrument'), and immediately clarifies it is 'not order history.' This clearly distinguishes the tool from order-history or broader reconciliation tools among the siblings.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
It gives concrete usage conditions: provide order_id for reconciliation, otherwise use a bounded time window with cursor pagination for recent instrument history. It also names trader workflows and retention windows, though it does not explicitly name a sibling alternative for order-history lookups, so it falls just short of full alternative routing.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
htx_plan_spot_margin_actionHTX Plan Spot Margin ActionARead-onlyIdempotent
Validate and normalize one spot-margin transfer, borrow, or targeted repayment.
Borrow plans check HTX's live currency quota where available; a ready plan is still a review artifact, not an execution request.
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| action | Yes | |
| checks | Yes | |
| status | Yes | |
| request | Yes | |
| warnings | Yes | |
| margin_mode | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
The annotations already declare read-only, open-world, idempotent, and non-destructive behavior. The description adds valuable context beyond those annotations: the live quota check for borrow plans and the explicit caveat that a ready plan is still a review artifact, not an execution request. This prevents the agent from misusing the tool's output.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two tight sentences with the core action front-loaded. The second sentence earns its place by adding the quota-check and review-artifact caveats, and there is no filler or duplication of schema content.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the rich nested schema, the output schema, and the read-only/idempotent annotations, the description covers the essential workflow caveat: the result is a plan for review, not an executed order. It could be more explicit about when to invoke this tool relative to validation/preview siblings, but nothing critical for safe invocation is missing.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The top-level schema coverage signal is 0%, but the nested SpotMarginAction schema provides detailed descriptions for action, amount, currency, instrument, margin_mode, and loan_order_id. The tool description only adds borrow-specific semantics and references targeted repayment, so it does not fully compensate for the top-level parameter gap, though it is not misleading.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a specific verb ('Validate and normalize') and a precise resource ('one spot-margin transfer, borrow, or targeted repayment'). It also explicitly frames the output as a review artifact, not an execution request, which clearly distinguishes it from execution or trade-oriented siblings.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description gives actionable usage context: borrow plans check HTX's live currency quota, and the resulting plan must not be treated as an execution request. However, it does not name sibling tools or state explicit conditions for choosing this over htx_validate_trade_intent or htx_preview_trade, so routing guidance is incomplete.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
htx_preview_tradeHTX Preview TradeBRead-onlyIdempotent
Build a normalized dry-run request after validating a product-neutral trade intent.
| Name | Required | Description | Default |
|---|---|---|---|
| intent | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| rules | Yes | |
| checks | Yes | |
| market | Yes | |
| status | Yes | |
| plan_id | Yes | |
| product | Yes | |
| request | Yes | |
| execution | Yes | |
| instrument | Yes | |
| reference_price | Yes | |
| revalidate_before_execution | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already indicate readOnlyHint, idempotentHint, and non-destructive behavior, so the bar is lower. The description adds meaningful behavioral context: it 'validates' and produces a 'normalized dry-run request,' which implies no order placement. It does not disclose what happens on validation failure or what 'normalized' means in practice, and 'dry-run' might be an ambiguous term for some agents.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single compact sentence with the core verb and object front-loaded: 'Build a normalized dry-run request.' There is no redundancy, filler, or repetition of the tool name, and every phrase contributes meaning.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
This is a complex trading-intent tool with a nested 15-field input and a large sibling group. The description does not explain how it relates to htx_validate_trade_intent, whether it is safe to call before placing a real order, or what constitutes a successful dry-run output. The output schema may cover return values, but the surrounding decision context is under-specified.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema description coverage is reported as 0%, so the tool description should help explain the intent parameter. It only calls it a 'product-neutral trade intent,' which is a generic label rather than a useful semantic explanation. The rich nested schema exists, but the description itself does not compensate for the low coverage by explaining required fields, product-specific behavior, or the normalization target.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description names a specific action and object: 'Build a normalized dry-run request' for a 'product-neutral trade intent.' The word 'dry-run' clearly signals preview rather than execution, which separates it from execution flows. It does not explicitly name or compare sibling tools such as htx_validate_trade_intent, so it stops short of full sibling differentiation.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The phrase 'after validating a product-neutral trade intent' gives a prerequisite and suggests the tool is meant to be used once an intent exists, and 'dry-run' implies use before live execution. However, there is no explicit guidance about when to prefer this tool over htx_validate_trade_intent or htx_reconcile_trade, and no exclusions are stated.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
htx_reconcile_tradeHTX Reconcile TradeARead-onlyIdempotent
Read final order and fill state after a submission or network timeout.
Query this before retrying a timed-out submission.
| Name | Required | Description | Default |
|---|---|---|---|
| product | Yes | HTX product family: spot or USDT-margined perpetual swap. | |
| order_id | No | HTX exchange order ID; provide this or client_order_id. | |
| instrument | Yes | Spot symbol such as 'btcusdt' or swap contract such as 'BTC-USDT'. | |
| margin_mode | No | Swap margin mode: isolated or cross. | isolated |
| client_order_id | No | Client order ID used at submission; provide this or order_id. |
Output Schema
| Name | Required | Description |
|---|---|---|
| error | No | |
| order | Yes | |
| status | No | |
| product | Yes | |
| instrument | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
The description adds useful behavioral context beyond the readOnlyHint/idempotentHint annotations by framing this as a reconciliation read for uncertain post-submission states. It does not contradict the annotations and appropriately avoids over-explaining what the annotations already convey.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two short sentences with no filler. The core purpose is front-loaded in the first sentence, and the key usage instruction follows immediately in the second.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a read-only reconciliation tool, the description plus full schema and annotations provide everything an agent needs to select and invoke the tool correctly. The output schema covers return shape, and the description clearly identifies the exact situation that warrants calling it.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema already fully documents all five parameters. The description adds no parameter-level detail beyond the submission/timeout context, so the baseline of 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb and resource: 'Read final order and fill state.' It also names the triggering scenario, 'after a submission or network timeout,' which clearly distinguishes this tool from market snapshot, account snapshot, and pre-trade validation siblings.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The instruction 'Query this before retrying a timed-out submission' gives explicit, actionable guidance for when to use the tool. It does not list alternatives or exclusions, so it falls just short of a 5.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
htx_validate_trade_intentHTX Validate Trade IntentARead-onlyIdempotent
Validate a product-neutral trade intent and return checks without a request preview.
| Name | Required | Description | Default |
|---|---|---|---|
| intent | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| rules | Yes | |
| checks | Yes | |
| status | Yes | |
| plan_id | Yes | |
| product | Yes | |
| instrument | Yes | |
| reference_price | Yes | |
| revalidate_before_execution | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
The description aligns with the annotations (readOnly, idempotent, non-destructive) and adds that it returns checks, implying no side effects. While it doesn't elaborate on specific behaviors, the annotations already provide strong transparency, and the description does not contradict them.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, concise sentence with no unnecessary words or repetition. It efficiently conveys the core function and differentiator.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description, combined with the rich input schema and annotations, provides sufficient context for understanding the tool's role. It does not mention output structure or error handling, but the presence of an output schema and the clear purpose make it adequately complete for usage.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description provides no parameter-level details, but the input schema includes exhaustive descriptions for the nested intent object and its fields. Since the schema coverage is high, the description does not add value to parameter semantics; baseline score of 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's function: validating a product-neutral trade intent and returning checks without a request preview. It distinguishes itself from the sibling preview tool by explicitly noting that it does not perform a preview, making its purpose unambiguous.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage for validation rather than preview by stating 'without a request preview,' which differentiates it from htx_preview_trade. However, it does not explicitly outline when to choose this tool over other siblings or provide comprehensive when-to-use guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
htx_wait_for_market_eventHTX Wait For Market EventARead-onlyIdempotent
Block until bounded declarative market conditions match or the timeout expires.
This safe MCP wait primitive performs read-only calls, executes no caller-supplied code, has a fixed deadline, and returns compact evidence. A future WebSocket market daemon can satisfy the identical contract.
Important: while this call is pending, the agent receives no intermediate
market updates and cannot react to them. For an uninterrupted wait, set
the outer host yield_time_ms longer than timeout_seconds * 1000
(with response margin) and set the host tool deadline longer still. The
MCP result then becomes the sole wake-up source; then re-check market
snapshots after every return.
| Name | Required | Description | Default |
|---|---|---|---|
| match | No | Wake when any condition matches, or only when all match. | any |
| product | No | ||
| conditions | Yes | Declarative conditions to wait for. Each condition may override product and instrument, allowing independent markets in one wait. A condition checks last_price or a supported technical indicator (for example indicator='rsi:14' or 'macd:12,26,9' with component='histogram'). Arbitrary code and expressions are not accepted. | |
| instrument | No | ||
| candle_size | No | Maximum candles fetched for indicator conditions. It must cover every requested indicator lookback. | |
| candle_period | No | HTX candle interval used for indicator conditions: 1min, 5min, 15min, 30min, 60min, 4hour, 1day, 1week, or 1mon. | 60min |
| timeout_seconds | No | Hard maximum blocking duration (one hour). The budget includes polls and sleeps. Configure the MCP host tool deadline and outer yield_time_ms longer than this value so this tool, rather than an intermediate host yield, is the wake-up source. | |
| poll_interval_seconds | No | Target minimum interval between read-only poll starts. A larger interval reduces API use but increases wake latency. |
Output Schema
| Name | Required | Description |
|---|---|---|
| match | Yes | |
| polls | Yes | |
| status | Yes | |
| product | Yes | |
| warnings | Yes | |
| elapsed_ms | Yes | |
| instrument | Yes | |
| failed_polls | Yes | |
| observations | Yes | |
| poll_attempts | Yes | |
| started_at_ms | Yes | |
| finished_at_ms | Yes | |
| successful_polls | Yes | |
| last_success_at_ms | Yes | |
| matched_conditions | Yes | |
| observation_age_ms | Yes | |
| requested_timeout_ms | Yes | |
| effective_deadline_ms | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already mark it read-only and non-destructive. The description adds that it performs no code execution and that the agent receives no intermediate updates during the wait, which is useful for agent planning. Does not mention rate limits or auth, but those are less critical given the read-only annotation.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is moderately long but every sentence adds value. It is well-structured with separate paragraphs for the core purpose, safety notes, and timeout guidance. No redundancy or filler.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the complexity of the tool (8 parameters, nested conditions), the description covers the essential operational aspects: condition semantics, indicator usage, timeout budgeting, and polling behavior. The output schema is present, so return values do not need explanation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Goes beyond the schema: explains that conditions can override product/instrument, gives indicator examples, specifies candle_size must cover lookback, notes that timeout includes polls and sleeps, and explains poll_interval trade-offs. This meaningfully aids correct usage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States the specific purpose: block until bounded declarative market conditions match or timeout expires. Clearly identifies it as a read-only wait primitive, and the description distinguishes it from a future WebSocket daemon, clarifying its polling nature.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Provides concrete guidance on configuring timeouts (yield_time_ms, host deadline) and warns about the lack of intermediate updates. Does not explicitly compare to sibling polling tools, but the blocking behavior is clearly implied and the timeout advice is actionable.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
15 tool updates
v0.7.3- First observed
htx_diagnose_private_access - First observed
htx_get_account_snapshot - First observed
htx_get_instrument_rules - First observed
htx_get_market_context - First observed
htx_get_market_snapshot - First observed
htx_get_portfolio_snapshot - First observed
htx_get_risk_snapshot - First observed
htx_get_spot_margin_snapshot - First observed
htx_get_technical_indicators - First observed
htx_get_trade_history - First observed
htx_plan_spot_margin_action - First observed
htx_preview_trade - First observed
htx_reconcile_trade - First observed
htx_validate_trade_intent - First observed
htx_wait_for_market_event
TDQS
Most tools cleanly separate distinct stages: diagnostics, market data, technical indicators, account/portfolio snapshots, risk, margin, and trade validation/reconciliation. The main ambiguity is between account_snapshot and portfolio_snapshot, and to a lesser extent market_snapshot versus market_context, but the descriptions provide enough guidance.
All tool names follow the htx_ prefix with consistent snake_case and a clear verb_noun pattern: get_* for read operations and wait/plan/validate/preview/reconcile for actions. There is no mixing of conventions or vague verbs.
15 tools is at the upper edge of the well-scoped range, but each tool covers a distinct part of market analysis, account review, risk assessment, margin planning, or trade reconciliation. No tool feels redundant or unnecessary.
The set provides strong coverage for market data, account state, risk, margin preflight, and trade validation/preview/reconciliation. However, there is no actual order submission or cancellation tool, and margin actions are planned but never executed, leaving an obvious lifecycle gap for an exchange-focused MCP.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Trade 16 crypto exchanges + MetaTrader 5 from your AI assistant via one MCP connection.
Read-only China A-share data for AI agents: market, limit-up, capital flow and disclosures.
Trade, monitor portfolios, and build Coinrule strategies by chat.
AI agent access to Asian crypto markets. Korean exchange routing and x402 paid APIs.
Related MCP Servers
- AlicenseAqualityFmaintenanceEnables AI assistants to interact with Bitget cryptocurrency exchange for spot and futures trading. Supports real-time market data, order management, account balances, leverage control, and position tracking with demo trading capabilities.175MIT
- AlicenseAqualityDmaintenanceEnables interaction with the Hyperliquid exchange to trade perpetuals, check positions, and manage risk through natural language. It provides tools for fetching real-time market data, tracking portfolio value, and executing orders with a focus on safety through default paper trading.101MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to securely trade on Hyperliquid perpetual exchange, including order placement, position management, market data retrieval, and vault operations via natural language.21MIT
- AlicenseBqualityDmaintenanceIntegrates with Hyperliquid DEX to enable trading, account management, and market data queries through natural language.12153MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/TeacherLi07/htx-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server