delete_lock
Remove a specific trade lock by ID to allow trading operations to proceed in the Freqtrade cryptocurrency trading bot.
Instructions
Delete a specific trade lock by ID.
Parameters: lock_id (int): ID of the trade lock to delete. ctx (Context): MCP context object for logging and client access.
Returns: str: Stringified JSON response with updated locks, or error if failed.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lock_id | Yes |
Implementation Reference
- __main__.py:312-327 (handler)The delete_lock tool handler function that deletes a trade lock by ID. It takes a lock_id parameter, accesses the FtRestClient from the MCP context, calls client.delete_lock(lock_id), logs the action, and returns the stringified JSON response.
@mcp.tool() def delete_lock(lock_id: int, ctx: Context) -> str: """ Delete a specific trade lock by ID. Parameters: lock_id (int): ID of the trade lock to delete. ctx (Context): MCP context object for logging and client access. Returns: str: Stringified JSON response with updated locks, or error if failed. """ client: FtRestClient = ctx.request_context.lifespan_context["client"] response = client.delete_lock(lock_id) logger.info(f"Deleted lock with ID {lock_id}") return str(response) - __main__.py:312-312 (registration)The @mcp.tool() decorator registers the delete_lock function as an MCP tool with the FastMCP server instance 'mcp'.
@mcp.tool() - __main__.py:313-323 (schema)The function signature and docstring define the input schema: lock_id (int) is the ID of the trade lock to delete. The return type is str (stringified JSON response).
def delete_lock(lock_id: int, ctx: Context) -> str: """ Delete a specific trade lock by ID. Parameters: lock_id (int): ID of the trade lock to delete. ctx (Context): MCP context object for logging and client access. Returns: str: Stringified JSON response with updated locks, or error if failed. """ - __main__.py:324-325 (helper)Retrieves the FtRestClient from the MCP lifespan context and calls client.delete_lock(lock_id) to perform the actual API operation.
client: FtRestClient = ctx.request_context.lifespan_context["client"] response = client.delete_lock(lock_id)