← TradeMemory Protocol

TradeMemory Protocol 0.5.4

pypi · tradememory-protocol · current release

20
Tools
0
Resources
0
Templates
0
Prompts

Observation

Observed 2026-08-17T07:52:27.889Z using mcpSecurity-inventory. Status: succeeded. Negotiated protocol: 2025-06-18.

Server capabilities
{
  "experimental": {},
  "logging": {},
  "prompts": {
    "listChanged": false
  },
  "resources": {
    "subscribe": false,
    "listChanged": false
  },
  "tools": {
    "listChanged": true
  },
  "extensions": {
    "io.modelcontextprotocol/ui": {}
  }
}

Tools 20

ToolCategoryAnnotationsRisk
check_active_plansCheck active trading plans against current market context. Queries all active prospective plans, expires any past their expiry date, and matches remaining plans against the provided context.
Input schema
{
  "additionalProperties": false,
  "properties": {
    "context_regime": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Current market regime (trending_up/trending_down/ranging/volatile)"
    },
    "context_atr_d1": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Current ATR(14) on D1 in dollars"
    }
  },
  "type": "object"
}
Output schema
{
  "additionalProperties": true,
  "type": "object"
}
— · —
check_trade_legitimacyCheck if the agent has sufficient data and confidence to trade. Call this before making any trade decision. Evaluates sample size, memory quality, regime experience, streak state, and drawdown to determine whether the agent has earned the right to trade at full size.
Input schema
{
  "additionalProperties": false,
  "properties": {
    "strategy_name": {
      "type": "string",
      "description": "Strategy to evaluate (e.g. \"VolBreakout\")."
    },
    "symbol": {
      "default": "XAUUSD",
      "type": "string",
      "description": "Trading instrument (default \"XAUUSD\")."
    },
    "current_regime": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Current market regime (trending_up/trending_down/ranging/volatile)."
    },
    "current_atr_d1": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Current ATR(14) on D1 in dollars (informational)."
    }
  },
  "required": [
    "strategy_name"
  ],
  "type": "object"
}
Output schema
{
  "additionalProperties": true,
  "type": "object"
}
— · —
compute_dqsCompute Decision Quality Score before executing a trade. Evaluates the quality of the decision *process* (not outcome) across 5 factors: regime match, position sizing vs Kelly, process adherence (OWM similarity), risk state, and historical pattern.
Input schema
{
  "additionalProperties": false,
  "properties": {
    "symbol": {
      "type": "string",
      "description": "Trading instrument (e.g. \"XAUUSD\")."
    },
    "strategy_name": {
      "type": "string",
      "description": "Strategy being considered (e.g. \"VolBreakout\")."
    },
    "direction": {
      "type": "string",
      "description": "Intended direction (\"long\" or \"short\")."
    },
    "proposed_lot_size": {
      "default": 0.1,
      "type": "number",
      "description": "Planned position size in lots (default 0.1)."
    },
    "market_context": {
      "default": "",
      "type": "string",
      "description": "Description of current market conditions."
    },
    "context_regime": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Market regime (trending_up/trending_down/ranging/volatile)."
    },
    "context_atr_d1": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "ATR(14) on D1 in dollars."
    }
  },
  "required": [
    "symbol",
    "strategy_name",
    "direction"
  ],
  "type": "object"
}
Output schema
{
  "additionalProperties": true,
  "type": "object"
}
— · —
create_trading_planCreate a prospective trading plan that activates when conditions are met. Stores a rule-based plan in prospective memory. The plan stays active until triggered, expired, or manually cancelled.
Input schema
{
  "additionalProperties": false,
  "properties": {
    "trigger_type": {
      "type": "string",
      "description": "Type of trigger (e.g. \"market_condition\", \"drawdown\", \"time_based\")"
    },
    "trigger_condition": {
      "type": "string",
      "description": "JSON string describing when to trigger (e.g. '{\"regime\": \"ranging\"}')"
    },
    "planned_action": {
      "type": "string",
      "description": "JSON string describing what to do (e.g. '{\"type\": \"skip_trade\"}')"
    },
    "reasoning": {
      "type": "string",
      "description": "Why this plan was created"
    },
    "expiry_days": {
      "default": 30,
      "type": "integer",
      "description": "Days until plan expires (default 30)"
    },
    "priority": {
      "default": 0.5,
      "type": "number",
      "description": "Priority 0-1, higher = checked first (default 0.5)"
    }
  },
  "required": [
    "trigger_type",
    "trigger_condition",
    "planned_action",
    "reasoning"
  ],
  "type": "object"
}
Output schema
{
  "additionalProperties": true,
  "type": "object"
}
— · —
evolution_discover_patternsDiscover trading patterns from market data using LLM analysis. Uses Claude to analyze OHLCV data and generate candidate trading patterns with entry/exit conditions. Each pattern can be backtested afterward.
Input schema
{
  "additionalProperties": false,
  "properties": {
    "symbol": {
      "type": "string",
      "description": "Trading pair (e.g. \"BTCUSDT\")"
    },
    "timeframe": {
      "default": "1h",
      "type": "string",
      "description": "Bar timeframe — \"5m\", \"15m\", \"1h\", \"4h\", \"1d\""
    },
    "count": {
      "default": 5,
      "type": "integer",
      "description": "Number of patterns to generate (default 5)"
    },
    "temperature": {
      "default": 0.7,
      "type": "number",
      "description": "LLM creativity 0-1 (default 0.7, higher = more diverse)"
    },
    "days": {
      "default": 90,
      "type": "integer",
      "description": "Days of history to analyze (default 90)"
    }
  },
  "required": [
    "symbol"
  ],
  "type": "object"
}
Output schema
{
  "additionalProperties": true,
  "type": "object"
}
— · —
evolution_evolve_strategyRun full evolution loop — generate, backtest, select, eliminate. Multi-generation strategy evolution: generates candidate patterns via LLM, backtests on in-sample data, validates survivors on out-of-sample data, eliminates weak hypotheses. Returns graduated strategies and graveyard.
Input schema
{
  "additionalProperties": false,
  "properties": {
    "symbol": {
      "type": "string",
      "description": "Trading pair (e.g. \"BTCUSDT\")"
    },
    "timeframe": {
      "default": "1h",
      "type": "string",
      "description": "Bar timeframe — \"5m\", \"15m\", \"1h\", \"4h\", \"1d\""
    },
    "generations": {
      "default": 3,
      "type": "integer",
      "description": "Number of evolution generations (default 3)"
    },
    "population_size": {
      "default": 10,
      "type": "integer",
      "description": "Hypotheses per generation (default 10)"
    },
    "days": {
      "default": 90,
      "type": "integer",
      "description": "Days of history to use (default 90)"
    }
  },
  "required": [
    "symbol"
  ],
  "type": "object"
}
Output schema
{
  "additionalProperties": true,
  "type": "object"
}
— · —
evolution_fetch_market_dataFetch OHLCV market data from Binance for evolution analysis. Downloads historical price bars for backtesting and pattern discovery. Use this before discover_patterns or run_backtest to get data.
Input schema
{
  "additionalProperties": false,
  "properties": {
    "symbol": {
      "type": "string",
      "description": "Trading pair (e.g. \"BTCUSDT\", \"ETHUSDT\")"
    },
    "timeframe": {
      "default": "1h",
      "type": "string",
      "description": "Bar timeframe — \"5m\", \"15m\", \"1h\", \"4h\", \"1d\""
    },
    "days": {
      "default": 90,
      "type": "integer",
      "description": "Number of days of history to fetch (default 90)"
    }
  },
  "required": [
    "symbol"
  ],
  "type": "object"
}
Output schema
{
  "additionalProperties": true,
  "type": "object"
}
— · —
evolution_get_logGet the log of past evolution runs from this session. Returns a list of all evolution runs with their results, including graduated strategies, graveyard, token usage, and backtest counts. Data is in-memory (resets on server restart).
Input schema
{
  "additionalProperties": false,
  "properties": {},
  "type": "object"
}
Output schema
{
  "additionalProperties": true,
  "type": "object"
}
— · —
evolution_run_backtestBacktest a candidate pattern against historical OHLCV data. Takes a pattern dict (from discover_patterns) and runs a vectorized backtest. Returns fitness metrics: Sharpe ratio, win rate, trade count, max drawdown, total PnL.
Input schema
{
  "additionalProperties": false,
  "properties": {
    "pattern_dict": {
      "additionalProperties": true,
      "type": "object",
      "description": "CandidatePattern as dict (from discover_patterns output)"
    },
    "symbol": {
      "default": "BTCUSDT",
      "type": "string",
      "description": "Trading pair (e.g. \"BTCUSDT\")"
    },
    "timeframe": {
      "default": "1h",
      "type": "string",
      "description": "Bar timeframe — \"5m\", \"15m\", \"1h\", \"4h\", \"1d\""
    },
    "days": {
      "default": 90,
      "type": "integer",
      "description": "Days of history to backtest against (default 90)"
    }
  },
  "required": [
    "pattern_dict"
  ],
  "type": "object"
}
Output schema
{
  "additionalProperties": true,
  "type": "object"
}
— · —
export_audit_trailExport Trading Decision Records for audit and compliance review. Provides a complete, tamper-evident record of trading decisions including the memory context (similar trades, beliefs) that informed each decision.
Input schema
{
  "additionalProperties": false,
  "properties": {
    "trade_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Get a single TDR by trade ID (e.g., \"MT5-7047640363\").\nIf provided, other filters are ignored."
    },
    "strategy": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Filter by strategy name (e.g., \"VolBreakout\")."
    },
    "start": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Start date (ISO format, inclusive). E.g., \"2026-03-01\"."
    },
    "end": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "End date (ISO format, exclusive). E.g., \"2026-04-01\"."
    },
    "limit": {
      "default": 50,
      "type": "integer",
      "description": "Maximum records to return (default 50)."
    }
  },
  "type": "object"
}
Output schema
{
  "additionalProperties": true,
  "type": "object"
}
— · —
get_agent_stateGet the current agent affective state (confidence, risk, drawdown). Returns confidence level, risk appetite, drawdown percentage, win/loss streaks, equity tracking, and a recommended action based on current drawdown severity.
Input schema
{
  "additionalProperties": false,
  "properties": {},
  "type": "object"
}
Output schema
{
  "additionalProperties": true,
  "type": "object"
}
— · —
get_behavioral_analysisGet behavioral analysis from procedural memory. Returns aggregate trading behavior stats: hold times, disposition ratio, lot sizing variance, and Kelly criterion comparison.
Input schema
{
  "additionalProperties": false,
  "properties": {
    "strategy_name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Filter by strategy name. Returns all if omitted."
    },
    "symbol": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Filter by symbol. Returns all if omitted."
    }
  },
  "type": "object"
}
Output schema
{
  "additionalProperties": true,
  "type": "object"
}
— · —
get_daily_rootGet (or rebuild) the daily Merkle root for a UTC date. The Merkle root summarises every audit_chain entry whose `chained_at` falls inside the UTC day. Verifying this single 32-byte root proves the integrity of every TDR for that day without re-walking each one.
Input schema
{
  "additionalProperties": false,
  "properties": {
    "date": {
      "type": "string",
      "description": "Date in YYYY-MM-DD format (or full ISO datetime)."
    },
    "rebuild": {
      "default": false,
      "type": "boolean",
      "description": "If True, recompute and overwrite the stored root."
    },
    "request_tsa": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Whether to submit the rebuilt root to the configured\nRFC 3161 TSA (default freetsa.org) and store the returned\nTimeStampToken. None (default) follows the TRADEMEMORY_TSA env\nsetting — ON unless set to \"off\". TSA failures are logged but\ndo not abort the rebuild."
    },
    "include_token": {
      "default": false,
      "type": "boolean",
      "description": "If True, include a base64-encoded `tsa_token`\nin the response (default False — the token can be large)."
    }
  },
  "required": [
    "date"
  ],
  "type": "object"
}
Output schema
{
  "additionalProperties": true,
  "type": "object"
}
— · —
get_strategy_performanceGet aggregate performance stats per strategy. Use this to evaluate which strategies are working and which need adjustment.
Input schema
{
  "additionalProperties": false,
  "properties": {
    "strategy_name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Filter by strategy name. Returns all strategies if omitted."
    },
    "symbol": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Filter by symbol. Returns all symbols if omitted."
    }
  },
  "type": "object"
}
Output schema
{
  "additionalProperties": true,
  "type": "object"
}
— · —
get_trade_reflectionGet the full context and reflection for a specific trade. Use this to deep-dive into a particular trade's reasoning and lessons.
Input schema
{
  "additionalProperties": false,
  "properties": {
    "trade_id": {
      "type": "string",
      "description": "The trade ID to look up"
    }
  },
  "required": [
    "trade_id"
  ],
  "type": "object"
}
Output schema
{
  "additionalProperties": true,
  "type": "object"
}
— · —
recall_memoriesRecall memories using OWM outcome-weighted scoring. Queries episodic and semantic memories, scores them by outcome quality, context similarity, recency, confidence, and affective modulation. Returns ranked memories with score breakdown.
Input schema
{
  "additionalProperties": false,
  "properties": {
    "symbol": {
      "type": "string",
      "description": "Trading instrument (e.g. \"XAUUSD\")"
    },
    "market_context": {
      "type": "string",
      "description": "Current market conditions to match against"
    },
    "context_regime": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Current market regime (trending_up/trending_down/ranging/volatile)"
    },
    "context_atr_d1": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Current ATR(14) on D1 in dollars"
    },
    "strategy_name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Optional strategy filter"
    },
    "memory_types": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Types to query (default: [\"episodic\", \"semantic\"])"
    },
    "limit": {
      "default": 10,
      "type": "integer",
      "description": "Max results (default 10)"
    },
    "use_hybrid": {
      "default": true,
      "type": "boolean",
      "description": "If True (default), enable vector + OWM hybrid scoring when\nan embedding backend is available. Falls back to pure OWM silently\nwhen sentence-transformers is not installed."
    },
    "hybrid_alpha": {
      "default": 0.3,
      "type": "number",
      "description": "Vector vs OWM blend weight [0..1] when hybrid is active.\n0.0 = pure OWM, 1.0 = pure vector. Default 0.3 (OWM-dominant)."
    }
  },
  "required": [
    "symbol",
    "market_context"
  ],
  "type": "object"
}
Output schema
{
  "additionalProperties": true,
  "type": "object"
}
— · —
remember_tradeStore a trade into OWM multi-layer memory with automatic updates. Writes to episodic memory and automatically updates semantic (Bayesian), procedural (running averages + hold time + Kelly), and affective (EWMA confidence/streaks). Also writes to trade_records for backward compatibility.
Input schema
{
  "additionalProperties": false,
  "properties": {
    "symbol": {
      "type": "string",
      "description": "Trading instrument (e.g. \"XAUUSD\")"
    },
    "direction": {
      "type": "string",
      "description": "\"long\" or \"short\""
    },
    "entry_price": {
      "type": "number",
      "description": "Entry price of the trade"
    },
    "exit_price": {
      "type": "number",
      "description": "Exit price of the trade"
    },
    "pnl": {
      "type": "number",
      "description": "Profit/loss in account currency"
    },
    "strategy_name": {
      "type": "string",
      "description": "Strategy used (e.g. \"VolBreakout\")"
    },
    "market_context": {
      "type": "string",
      "description": "Description of market conditions"
    },
    "pnl_r": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "P&L as R-multiple (risk units). Improves OWM scoring quality."
    },
    "context_regime": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Market regime (trending_up/trending_down/ranging/volatile)"
    },
    "context_atr_d1": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "ATR(14) on D1 in dollars"
    },
    "confidence": {
      "default": 0.5,
      "type": "number",
      "description": "Agent confidence level 0-1 (default 0.5)"
    },
    "reflection": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Lessons learned from this trade"
    },
    "max_adverse_excursion": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Maximum adverse excursion during the trade"
    },
    "trade_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Optional custom ID. Auto-generated if omitted."
    },
    "timestamp": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "ISO format timestamp. Defaults to now (UTC)."
    },
    "entry_timestamp": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "ISO format entry time. Used to compute hold duration."
    },
    "exit_timestamp": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "ISO format exit time. Used to compute hold duration."
    }
  },
  "required": [
    "symbol",
    "direction",
    "entry_price",
    "exit_price",
    "pnl",
    "strategy_name",
    "market_context"
  ],
  "type": "object"
}
Output schema
{
  "additionalProperties": true,
  "type": "object"
}
— · —
validate_strategyValidate a trading strategy using statistical tests (DSR + Walk-Forward + Regime + CPCV). For educational and research purposes only. Not financial advice. Upload a trade log CSV (QuantConnect format) or daily returns CSV. The tool runs four statistical tests: 1. Deflated Sharpe Ratio (DSR) — detects overfitting from multiple testing 2. Walk-Forward Validation — checks out-of-sample consistency 3. Regime Analysis — performance across bull/bear/crisis markets 4. CPCV — cross-validated Sharpe stability across time periods
Input schema
{
  "additionalProperties": false,
  "properties": {
    "file_path": {
      "type": "string",
      "description": "Absolute path to the CSV file on your local machine."
    },
    "format": {
      "default": "quantconnect",
      "type": "string",
      "description": "CSV format — \"quantconnect\" for trade logs (columns: Entry Time, Exit Time,\n    Direction, Entry Price, Exit Price, Quantity, P&L, Fees, IsWin) or\n    \"returns\" for daily returns (columns: date,return or single column of returns)."
    },
    "strategy_name": {
      "default": "",
      "type": "string",
      "description": "Name of the strategy (for the report)."
    },
    "num_strategies": {
      "default": 1,
      "type": "integer",
      "description": "How many strategies you tested before picking this one.\n            Higher M = stricter DSR threshold (corrects for selection bias)."
    }
  },
  "required": [
    "file_path"
  ],
  "type": "object"
}
Output schema
{
  "additionalProperties": true,
  "type": "object"
}
— · —
verify_audit_chainVerify the integrity of the audit chain. Walks the chain from `from_seq` (default: 1, the genesis record) to `to_seq` (default: latest), checking that every record's `prev_hash` matches the previous record's `data_hash`, and that each `data_hash` equals SHA256(prev_hash || content_hash). Returns a dict with `verified`, `checked_count`, `first_break_at`, `reason`. A `first_break_at` of None with `verified=True` means the chain is intact across the verified range.
Input schema
{
  "additionalProperties": false,
  "properties": {
    "from_seq": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Starting sequence_num (inclusive). None = from beginning."
    },
    "to_seq": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Ending sequence_num (inclusive). None = through latest."
    }
  },
  "type": "object"
}
Output schema
{
  "additionalProperties": true,
  "type": "object"
}
— · —
verify_audit_hashVerify the integrity of a Trading Decision Record. Recomputes the SHA256 data_hash from stored inputs and compares with the hash computed at decision time. A mismatch indicates tampering.
Input schema
{
  "additionalProperties": false,
  "properties": {
    "trade_id": {
      "type": "string",
      "description": "Trade ID to verify (e.g., \"MT5-7047640363\")."
    }
  },
  "required": [
    "trade_id"
  ],
  "type": "object"
}
Output schema
{
  "additionalProperties": true,
  "type": "object"
}
— · —

Resources 0

Resource templates 0

Prompts 0

Let’s talk about MCP security.

Share your details and our security team will contact you.