MTContext Docs
Tool Reference

Journal

4 tools in this category.

Overview

Journal includes 4 tools for this workflow area.

Available tools: explain_setup, query_journal, score_journal_entry, write_trade_note.

Use the parameter tables and examples below as the canonical request contract.

explain_setup

Returns historical performance statistics for a named setup, aggregated over journal entries whose setup field matches, joined to realized P&L per ticket. Setup labels are supplied by the caller at journaling time (write_trade_note's setup parameter) — these statistics describe the caller's own labelling, not an independently detected pattern. avg_r_multiple is always null: no stop-loss value is currently persisted anywhere the server can join at query time. Results are scoped to the session's bound terminal. Available at Free+ tier.

Parameters

NameTypeRequiredDefaultDescription
setupstringYes——
symbolstringNo——
from_datestringNo—ISO date
to_datestringNo—ISO date
lookback_daysintegerNo90Used only when from_date/to_date are omitted.

Example Request

{
  "tool": "explain_setup",
  "arguments": {
    "setup": "setup_value"
  }
}

query_journal

Queries trade journal entries (rationale/setup notes written via write_trade_note), newest first — NOT the MT5 terminal's system log (see get_terminal_journal_log for that). Filters: ticket, tag, setup, run_id, role, kind, from_date/to_date (ISO, inclusive), and search (case-insensitive text match); all filters combine with AND, and entries without structured fields never match run_id/role/kind. Each entry carries run_id, role, kind and payload (null when absent); payload is returned unmodified. Entries linked to closed trades include realized_pnl when the terminal is connected (null otherwise). Entries written by the platform for automated actions have role "system". Results are scoped to the session's bound terminal. Available at Free+ tier.

Parameters

NameTypeRequiredDefaultDescription
ticketintegerNo——
tagstringNo——
setupstringNo——
run_idstringNo—Only entries of this multi-agent run.
rolestringNo—Only entries written by this role, e.g. risk or system.
kindanyNo—Only entries of this kind, e.g. verdict or action.
from_datestringNo—ISO date
to_datestringNo—ISO date
searchstringNo——
limitintegerNo20—
offsetintegerNo0—

Example Request

{
  "tool": "query_journal",
  "arguments": {}
}

score_journal_entry

Scores a journal entry's self-review quality: rationale_clarity, evidence_cited, and plan_adherence (0-5 each) plus a 0-100 total, with suggested_tags. plan_adherence_basis reports whether the SL/TP comparison used the linked trade's actual exit price ('trade_history') or the text alone ('text_only', when unlinked or the terminal is unreachable). scorer is 'heuristic' (deterministic, computed on every call) or 'llm' (an optional enrichment computed out-of-path and persisted, preferred when present). The entry itself is never modified — this is a read-only score of an immutable entry. Available at Free+ tier.

Parameters

NameTypeRequiredDefaultDescription
entry_idstringYes——

Example Request

{
  "tool": "score_journal_entry",
  "arguments": {
    "entry_id": "entry_id_value"
  }
}

write_trade_note

Persists a trade journal entry: rationale, setup label, and tags, optionally linked to a position/order ticket. Entries are append-only and immutable — to correct one, write a new note with amends_entry_id pointing at the original. The ticket may be an open position, a pending or cancelled order, a position id, or a deal ticket; the related identifiers of the same trade are stored with the note so it can be found by any of them later. Use at order time to capture WHY a trade was taken; query later with query_journal for post-trade review and per-setup statistics. Free tier stores up to 100 entries (license-wide, not per-terminal); entries written by the platform itself (automated-action audit entries) do not count toward that limit. Entries are tagged with the session's bound terminal automatically. Available at Free+ tier.

Structured fields (all optional, for multi-agent workflows that must read each other's decisions reliably): run_id groups every entry of one run (≤ 64 chars); role names the writer, e.g. researcher, bull, bear, risk, head_trader, position_manager, guardian, curator, reviewer (lowercase, ≤ 32 chars; "system" is reserved for the platform and rejected); kind names the entry type, e.g. claim, rebuttal, verdict, decision, action, outcome (lowercase, ≤ 32 chars); payload is a JSON object carrying the machine-readable content, at most 32768 bytes serialized (INVALID_PARAMETER beyond that). Never put credentials or account secrets in payload. Notes without these fields work exactly as before.

Parameters

NameTypeRequiredDefaultDescription
textstringYes——
ticketintegerNo——
tagsarrayNo[]—
setupstringNo——
amends_entry_idstringNo——
run_idstringNo—Groups the entries of one multi-agent run.
rolestringNo—Writer role, e.g. risk, bull, head_trader. "system" is reserved.
kindanyNo—Entry type, e.g. claim, verdict, decision, action, outcome.
payloadobjectNo—JSON object, ≤ 32768 bytes serialized.

Example Request

{
  "tool": "write_trade_note",
  "arguments": {
    "text": "text_value"
  }
}

On this page