Function dumpMCPStatus

  • Dumps an MCP (Model Context Protocol) status snapshot scoped to the current signal.

    Resolves the active pending or scheduled signal automatically from execution context. Automatically detects backtest/live mode from execution context.

    With the default markdown backend, image messages are decoded from base64 and written to ./dump/image/{message.id}.png; the whole message list is rendered into a single ./dump/mcp/{dumpId}.md - text messages inlined in order, images embedded via {id} relative links. The snapshot follows the swappable Dump backend: useDummy() silences it, useMemory() keeps a searchable text-only projection.

    Parameters

    • dto: {
          bucketName: string;
          description: string;
          dumpId: string;
          messages: IMCPMessage[];
      }
      • bucketName: string

        Bucket name grouping dumps by strategy or agent name

      • description: string

        Human-readable label describing the snapshot; included in the BM25 index for Memory search

      • dumpId: string

        Unique identifier for this dump entry

      • messages: IMCPMessage[]

        Status messages as returned by MCP.getStatus

    Returns Promise<void>

    Promise that resolves when the dump is complete

    Error if no pending or scheduled signal exists

    import { MCP, dumpMCPStatus } from "backtest-kit";

    const messages = await MCP.getStatus("my-mcp");
    await dumpMCPStatus({ bucketName: "my-agent", dumpId: String(Date.now()), messages, description: "Portfolio snapshot before rebalance" });