add_blacklist
Prevent specific cryptocurrency trading pairs from being traded by adding them to Freqtrade's exclusion list, helping users avoid undesirable assets.
Instructions
Add a pair to the blacklist.
Parameters: pair (str): Trading pair to blacklist (e.g., "ETH/USDT"). ctx (Context): MCP context object for logging and client access.
Returns: str: Stringified JSON response with updated blacklist, or error if failed.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pair | Yes |
Implementation Reference
- __main__.py:272-290 (handler)The add_blacklist tool handler function that adds a trading pair to the blacklist. It's decorated with @mcp.tool() which registers it as an MCP tool. The function takes a 'pair' parameter (str) and a Context object, retrieves the FtRestClient from the context, and calls either client.add_blacklist(pair) or client.blacklist(pair) depending on method availability. Returns a stringified JSON response.
@mcp.tool() def add_blacklist(pair: str, ctx: Context) -> str: """ Add a pair to the blacklist. Parameters: pair (str): Trading pair to blacklist (e.g., "ETH/USDT"). ctx (Context): MCP context object for logging and client access. Returns: str: Stringified JSON response with updated blacklist, or error if failed. """ client: FtRestClient = ctx.request_context.lifespan_context["client"] if hasattr(client, "add_blacklist"): response = client.add_blacklist(pair) else: response = client.blacklist(pair) logger.info(f"Added {pair} to blacklist") return str(response) - __main__.py:272-272 (registration)The @mcp.tool() decorator registers the add_blacklist function as an MCP tool with the FastMCP server instance defined at line 34.
@mcp.tool() - __main__.py:273-283 (schema)The function signature and docstring define the input schema: 'pair' parameter (str) for the trading pair to blacklist, and 'ctx' (Context) for MCP context. The return type is str (stringified JSON response).
def add_blacklist(pair: str, ctx: Context) -> str: """ Add a pair to the blacklist. Parameters: pair (str): Trading pair to blacklist (e.g., "ETH/USDT"). ctx (Context): MCP context object for logging and client access. Returns: str: Stringified JSON response with updated blacklist, or error if failed. """