Skip to main content
Glama

BotSpot: AI Trading, Backtests and Bots

Fetch backtest logs

get_backtest_logs
Read-onlyIdempotent

Fetch runtime logs for an identified historical backtest simulation. This tool does not read live/paper bot or scheduled-deployment logs. Use get_deployment_logs for those runtime logs and list_deployment_artifacts/query_deployment_artifact for decisions, preserving the discovered deploymentId and runId. A deploymentId or deployment runId is not a backtestId. Use this, not get_backtest_artifact or query_csv, for backtest runtime errors, warnings, tracebacks, startup lines, order/fill log lines, broker messages, strategy print/log output, and questions like why a backtest failed or why it made no trades. backtestId must be the actual backtest run id from list_backtests or an explicit user-provided backtest id; never pass a strategy id, aiStrategyId, revisionId, browser URL revisionId, conversation id, or placeholder such as . Keep the same backtestId for every log/artifact/query call in one answer unless the user explicitly asks to compare multiple runs. Do not mix stats/trades/agent_detail/log evidence from different backtest ids. Supports time-range filtering (startTimeIso/endTimeIso), CloudWatch filter patterns (query), local multi-query diagnostics (queries), diagnosticPreset, noise suppression, pagination (nextToken), and grep-style context lines. Default limit is bounded; use limit near 1000 when diagnosing failures. For failed/no-trade/runtime-failure backtests, logs are mandatory evidence before editing code when logs are available. Prefer one batched queries call with at least three bounded searches: errors/exceptions/tracebacks, orders/trades/fills/positions, and strategy/runtime/main.py/on_trading_iteration lines. A single newest-first page or one warning line is not enough for root cause. For completed-backtest performance-improvement or tuning questions, this tool is also required evidence when logs are available; stats/trades/agent_detail queries do not replace runtime log checks. Use one batched queries call covering errors/exceptions, order/trade/fill/position activity, and strategy/runtime lines before final advice. diagnosticPreset values: broker_order_failure searches broker/order rejects, permission failures, and tracebacks; runtime_failure searches crashes, imports, dependency/build failures, kills, and exceptions; startup searches startup/stream/broker initialization; orders searches order/fill/cancel/reject activity; errors_and_warnings keeps error, critical and warning lines plus tracebacks; performance searches rate limits, retries, timeouts, cache/download/history lines and timing lines (use it after a slow backtest, together with backtest_status includeTiming=true). levels keeps only lines at the given log levels (for example ["ERROR","WARNING"]). For a failed run the response starts with failureSummary, one line saying what failed and why. Storage paths and cloud resource names are hidden from returned logs. Pass contextLines (0-50) with query, queries, or a preset to preserve surrounding lines. When contextLines, queries, diagnosticPreset, or noise suppression is set, the tool fetches one bounded raw CloudWatch window and filters locally so surrounding context is preserved. The response includes runtimeProvenance. It uses the exact run's structured settings.json.lumibot_version as the primary source, then the canonical bootstrap package-metadata line INFO: lumibot version: ... from the fetched raw CloudWatch window as a fallback or corroborating source. It reports conflicts instead of choosing one value, and preserves provenance even when the requested filtered log view omits the startup line. Treat runtimeProvenance.runtimeVersion as the installed runtime version only when its status is confirmed; a LumiBot source/reference version is not runtime evidence. The response also includes logs, perQuery match counts, totalLines, scannedLines, returnedLines, scannedStart/scannedEnd timestamps when visible, noiseSuppressedLines, truncatedQueryCount, nextToken, and paginationWarning when more pages may need checking. Broad queries are capped; if truncatedQueryCount is nonzero, run a narrower follow-up query. Do not substitute runtime log CSV artifacts.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "backtestId": "<backtestId>"
    },
    "name": "get_backtest_logs"
  }
}

Input Schema

NameRequiredDescriptionDefault
sortNo
limitNo
queryNoCloudWatch filter pattern when contextLines is omitted. For a case-insensitive JavaScript regex such as ERROR|Exception, set contextLines (0 means matching lines only), or use queries instead.
levelsNoKeep only log lines at these levels, e.g. ["ERROR","WARNING"]. Matches the level word in the line prefix, not the same word inside a message.
queriesNoCase-insensitive JavaScript regex searches applied locally to the fetched log page.
nextTokenNo
backtestIdYesActual backtest run UUID for a historical simulation, from list_backtests or an explicitly identified user-provided backtest. A bot/deployment id or a list_deployment_runs runId is not a backtestId: use get_deployment_logs with that deploymentId instead. Do not use a strategy id, aiStrategyId, revisionId, browser URL revisionId, conversation id, or a placeholder such as <unknown>.
endTimeIsoNo
contextLinesNoApply query locally as a regex and include this many surrounding lines. Zero returns matching lines only and still avoids CloudWatch filter syntax.
startTimeIsoNo
suppressNoiseNo
diagnosticPresetNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • addedInput schema / properties / contextLines / description
      Added value: +"Apply query locally as a regex and include this many surrounding lines. Zero returns matching lines only and still avoids CloudWatch filter syntax."
    • addedInput schema / properties / queries / description
      Added value: +"Case-insensitive JavaScript regex searches applied locally to the fetched log page."
    • addedInput schema / properties / query / description
      Added value: +"CloudWatch filter pattern when contextLines is omitted. For a case-insensitive JavaScript regex such as ERROR|Exception, set contextLines (0 means matching lines only), or use queries instead."
  2. Changed2 schema fields changed
    • changedInput schema / properties / diagnosticPreset / enum
      Previous value: -[
      -  "broker_order_failure",
      -  "runtime_failure",
      -  "startup",
      -  "orders"
      -]New value: +[
      +  "broker_order_failure",
      +  "runtime_failure",
      +  "startup",
      +  "orders",
      +  "errors_and_warnings",
      +  "performance"
      +]
    • addedInput schema / properties / levels
      Added value: +{
      +  "description": "Keep only log lines at these levels, e.g. [\"ERROR\",\"WARNING\"]. Matches the level word in the line prefix, not the same word inside a message.",
      +  "items": {
      +    "enum": [
      +      "CRITICAL",
      +      "ERROR",
      +      "WARNING",
      +      "INFO",
      +      "DEBUG"
      +    ],
      +    "type": "string"
      +  },
      +  "maxItems": 5,
      +  "minItems": 1,
      +  "type": "array"
      +}
  3. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already declare readOnly/idempotent/openWorld/non-destructive, and the description adds substantial behavior beyond that: failureSummary prefix on failed runs, hidden storage paths and cloud resource names, local-window filtering when contextLines/queries/preset are set, runtimeProvenance resolution logic with confirmed-vs-source version semantics, truncation/pagination warnings, and noise suppression counts.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The critical scoping and identity constraints are front-loaded, which is good, but the text is very long and repetitive — the 'logs are mandatory evidence' and 'one batched queries call with three searches' points are restated across several sentences, and the evaluation would read better if those were consolidated.

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?

No output schema exists, yet the description fully documents the return surface (logs, perQuery match counts, totalLines, scannedLines, returnedLines, scannedStart/End, noiseSuppressedLines, truncatedQueryCount, nextToken, paginationWarning, runtimeProvenance) and the storage-path redaction. For a 12-parameter diagnostic tool this leaves nothing an agent needs missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is only 42%, so the description must compensate, and it does: it explains time-range filtering (startTimeIso/endTimeIso), CloudWatch `query` vs local `queries`, every diagnosticPreset value with its search scope, contextLines 0-50 grep semantics, levels filtering, noise suppression, nextToken pagination, and the backtestId provenance rules that are the highest-risk parameter.

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 and resource — 'Fetch runtime logs for an identified historical backtest simulation' — and immediately scopes what it does not do (live/paper bot or scheduled-deployment logs), naming get_deployment_logs as the sibling for that case. The agent can distinguish it from get_backtest_artifact and query_csv without opening any schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicit when-to-use (failed/no-trade/runtime-failure backtests, completed-backtest tuning) and when-not-to-use, with named alternatives: get_deployment_logs for deployment runtime logs, list_deployment_artifacts/query_deployment_artifact for decisions, get_backtest_artifact/query_csv explicitly ruled out. It also prescribes batching via `queries` and diagnosticPreset values mapped to scenarios.

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.