Skip to main content
Glama

fetch_backtest_history

Retrieve historical backtest results from Freqtrade cryptocurrency trading bot to analyze past trading strategy performance and identify patterns.

Instructions

Get backtest result history; optionally filter by filename.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filenameNo

Implementation Reference

  • Main handler function for the 'fetch_backtest_history' MCP tool. Decorated with @mcp.tool() to register it as an MCP tool. Takes a Context and optional filename parameter, retrieves the Freqtrade REST client from context, and calls the backtest/history endpoint with optional filename filtering.
    @mcp.tool()
    def fetch_backtest_history(ctx: Context, filename: str = "") -> str:
        """Get backtest result history; optionally filter by filename."""
        client: FtRestClient = ctx.request_context.lifespan_context["client"]
        params = {"filename": filename} if filename else None
        return str(_client_get(client, "backtest/history", params=params))
  • Helper function that wraps _call_client_method to make GET requests to the Freqtrade REST client. Used by fetch_backtest_history to call the 'backtest/history' endpoint.
    def _client_get(client: FtRestClient, path: str, params: Dict[str, Any] | None = None):
        return _call_client_method(client, ["_get"], path, params=params)
  • Core helper utility that calls client methods with version compatibility support. Iterates through method names to find the first matching callable method on the client, supporting multiple freqtrade-client versions.
    def _call_client_method(client: FtRestClient, method_names: List[str], *args, **kwargs):
        """Call first matching client method to support multiple freqtrade-client versions."""
        for method_name in method_names:
            method = getattr(client, method_name, None)
            if callable(method):
                return method(*args, **kwargs)
        raise AttributeError(f"No supported method found in {method_names}")
  • Import statements defining the type system for the tool. Imports Context from mcp.server.fastmcp (used for MCP context), and FtRestClient from freqtrade_client (the REST client type used in the handler).
    # freqtrade_mcp.py
    import logging
    import os
    from typing import List, AsyncIterator, Dict, Any
    from contextlib import asynccontextmanager
    from mcp.server.fastmcp import FastMCP, Context
    
    # Import Freqtrade REST client
    from freqtrade_client.ft_rest_client import FtRestClient
Behavior2/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. While 'Get' implies a read operation, the description doesn't specify whether this requires authentication, what format the history is returned in, whether results are paginated, or if there are rate limits. For a tool with no annotation coverage, this leaves significant behavioral gaps.

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

Conciseness5/5

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

The description is perfectly concise at just one sentence that efficiently communicates the core purpose and optional parameter. Every word earns its place with no redundancy or unnecessary elaboration.

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

Completeness3/5

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

Given the tool's moderate complexity (fetching historical data with optional filtering), no annotations, and no output schema, the description provides a basic but incomplete picture. It covers the main action and parameter purpose but lacks details about return format, error conditions, or how this tool relates to other backtest operations in the sibling set.

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

Parameters4/5

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

With only one parameter and 0% schema description coverage, the description effectively compensates by explaining the parameter's purpose: 'optionally filter by filename.' This adds meaningful context beyond the bare schema, though it doesn't specify filename format or filtering behavior details.

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

Purpose4/5

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

The description clearly states the tool's purpose with a specific verb ('Get') and resource ('backtest result history'), and includes optional filtering capability. However, it doesn't explicitly differentiate this tool from sibling tools like 'fetch_backtest_status' or 'fetch_performance', which might also retrieve related backtest data.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. With multiple sibling tools like 'fetch_backtest_status', 'fetch_performance', and 'fetch_trades' that might retrieve different aspects of backtest data, the description fails to specify what distinguishes this tool's scope or when it should be preferred over other fetch operations.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/worlddebugger/freqtrade-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server