Skip to main content
Glama

abort_backtest

Stop a running backtest in the Freqtrade trading bot to halt simulation and free resources for other tasks.

Instructions

Abort currently running backtest task.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the abort_backtest tool. It retrieves the Freqtrade REST client from the context and calls the backtest/abort endpoint to abort a running backtest task.
    @mcp.tool()
    def abort_backtest(ctx: Context) -> str:
        """Abort currently running backtest task."""
        client: FtRestClient = ctx.request_context.lifespan_context["client"]
        return str(_client_get(client, "backtest/abort"))
  • __main__.py:385-389 (registration)
    The @mcp.tool() decorator registers the abort_backtest function as an MCP tool with the FastMCP server instance.
    @mcp.tool()
    def abort_backtest(ctx: Context) -> str:
        """Abort currently running backtest task."""
        client: FtRestClient = ctx.request_context.lifespan_context["client"]
        return str(_client_get(client, "backtest/abort"))
  • Helper utilities for calling Freqtrade REST client methods. _call_client_method provides version compatibility by trying multiple method names, and _client_get wraps it for HTTP GET requests.
    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}")
    
    
    def _client_get(client: FtRestClient, path: str, params: Dict[str, Any] | None = None):
        return _call_client_method(client, ["_get"], path, params=params)
  • Import of Context type from MCP FastMCP library, used for type annotation in the abort_backtest function signature to provide access to request context and lifespan-managed client.
    from mcp.server.fastmcp import FastMCP, Context
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('abort') but doesn't explain what happens after aborting (e.g., whether data is saved, if the task can be resumed, or error handling). For a mutation tool with zero annotation coverage, this leaves critical behavioral traits unspecified, though it's not misleading.

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 a single, clear sentence with no wasted words. It's front-loaded with the core action and target, making it easy to parse quickly. Every word earns its place by conveying essential information without redundancy.

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

Completeness2/5

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

Given the complexity of aborting a task (a mutation with potential side effects), no annotations, and no output schema, the description is incomplete. It doesn't cover what the tool returns, error conditions, or behavioral details like whether the abort is immediate or reversible. For a tool with this context, more information is needed to guide safe and effective use.

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?

The tool has 0 parameters, and schema description coverage is 100%, so there are no parameters to document. The description appropriately doesn't discuss parameters, which is correct for this case. It doesn't add semantic value beyond the schema, but with no parameters, a baseline of 4 is warranted as there's nothing missing.

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 action ('abort') and the target ('currently running backtest task'), making the purpose immediately understandable. It doesn't explicitly distinguish from siblings like 'reset_backtest' or 'stop_bot', but the specificity of 'backtest task' provides reasonable differentiation. This is not a tautology of the name, as it adds context about what is being aborted.

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. It doesn't mention prerequisites (e.g., that a backtest must be running), exclusions, or comparisons to siblings like 'reset_backtest' or 'stop_bot'. The agent must infer usage from context alone, which is insufficient for clear decision-making.

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