Skip to main content
Glama

AIKIT by Trading Checkup

Explain a trading error code

explain_trading_error
Read-onlyIdempotent

Use it when an order is rejected or a bot/EA log shows an error code or message (e.g. retcode=10016, {"code":-1013,"msg":"Filter failure: LOT_SIZE"}, retCode 110007, sCode 51008) - instead of recalling error meanings from memory. Covers MT5 / MQL5 trade return codes (10004-10046) and GetLastError, Binance spot + USDS-M futures, Bybit v5 and OKX v5. Returns what it means, likely causes ranked, fix steps, a short tested code snippet where safe, the official source URL and the date it was read, with a signed receipt. A code that is not in the venue's official list is answered 'not covered' - never guessed. Paste the code and/or the log line as it is. 1 credit (free trial without a key).

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "explain_trading_error"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeNoThe error code as shown, e.g. 10016, TRADE_RETCODE_INVALID_STOPS, 4756, -2010, 110007, 51008 or 51008_1000. Optional if 'message' has it.
venueNoWhere the error came from: mt5 (MetaTrader 5 / MQL5), binance (spot or USDS-M futures), bybit (v5) or okx (v5). If left out it is detected from the text when it is clear (e.g. retCode = Bybit, sCode = OKX).
marketNoOptional: spot or perp (futures). Only matters for the few Binance codes whose meaning differs between spot and futures; also detected from words like fapi.
messageNoThe error message or the whole log line / JSON reply as pasted (up to 4 kB), e.g. 'failed market buy 0.01 EURUSD [Invalid volume]' or '{"retCode":10002,"retMsg":"..."}'. Not stored.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.4/5.0
Behavior5/5

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

Annotations already declare read-only, idempotent, non-destructive, closed-world, but the description adds real behavioral detail beyond them: what the response contains (meaning, ranked causes, fix steps, tested snippet, official source URL plus read date, signed receipt), the refusal path for unknown codes, and the cost model (1 credit, free trial without a key). This is exactly the value-add layer annotations cannot supply.

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?

Front-loaded with the trigger condition and the alternative (don't recall from memory), then coverage, then return shape, then cost. The inline example list (retcode=10016, LOT_SIZE, retCode 110007, sCode 51008) is long but each example earns its place by signaling detectable venue markers. Slightly dense single paragraph but no filler.

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

Completeness5/5

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

There is no output schema, so the description must describe what comes back, and it does so explicitly: meaning, ranked likely causes, fix steps, optional safe code snippet, official source URL with retrieval date, and a signed receipt. Combined with the no-guessing fallback and cost note, nothing an agent needs before calling is missing.

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?

Schema coverage is 100%, so code/venue/market/message semantics are already documented in the schema, including venue auto-detection from retCode/sCode. The description repeats detection hints and the 'paste as-is' instruction but adds no new syntax or format guidance for the parameters. Baseline 3 applies when the schema carries the load.

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

Purpose5/5

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

States a specific verb+resource (explain a trading error code) and immediately scopes it with concrete triggers: rejected orders or EA/bot logs showing retcodes. Names the exact coverage envelope (MT5/MQL5 10004-10046, GetLastError, Binance spot + USDS-M, Bybit v5, OKX v5), which makes it clearly distinct from siblings like check_order or check_bot_code.

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?

Strong usage context: use it when an order is rejected or a log line shows a code, explicitly instead of recalling meanings from memory, and 'paste the code and/or the log line as it is.' It also bounds behavior with 'not in the official list is answered not covered - never guessed.' It stops short of routing against sibling tools (e.g. when to prefer check_order), so it is clear but not fully exhaustive.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources