An agent-ergonomics pass on the MCP read/management surface, from a red-team of how an agent perceives and acts through these tools.
Fixed
close_perp_positioncould not close short positions. It hardcodedisLong: false(with a false "reduce-only determines direction" comment), so closing a short submitted a sell that could not reduce it — the primary risk-management tool silently failed for half of all positions. Direction and size are now resolved from the live position (a short closes with a buy).
Added
get_hl_trade_historylimit(default 20, most recent first) — the tool returned the entire lifetime fill history (~90KB in practice) and overflowed an agent's context.get_hl_meta_and_asset_ctxscoinsfilter — return only the requested assets instead of all ~231.
Changed
- Tool results serialize compact (no 2-space indent tax).
- Failures set
isError: truewith a structured{ error }payload so a caller can branch on success/failure; the stack is logged server-side, not shipped into the agent's context.
Impact
trade_history on a real account: ~19k tokens unbounded → ~1.9k at limit=20 (~17k tokens/call saved).
Tests
107 mcp-server tests passing.
Full changelog: CHANGELOG.md.