stop_seeding
Provide a torrent infohash to stop seeding, optionally confirm, and keep the downloaded files intact.
Instructions
Stop seeding without deleting on-disk files. mutates: true
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| infohash | Yes | ||
| confirm | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The 'stop_seeding' MCP tool handler. Loads config, creates a Qbittorrent client, calls qb.delete(infohash, delete_files=False) to stop seeding without removing on-disk files, and returns a confirmation dict.
@mcp.tool(description="Stop seeding without deleting on-disk files. mutates: true") @confirm_required("stop_seeding") def stop_seeding(infohash: str, confirm: bool = False) -> dict[str, Any]: cfg = _cfg.load() qb = Qbittorrent(cfg.qbittorrent) qb.delete(infohash, delete_files=False) return {"ok": True, "infohash": infohash, "kept_files": True} - The schema is implicitly defined by the function signature of stop_seeding: accepts 'infohash' (str) and 'confirm' (bool, default False). The return type is dict[str, Any]. The @mcp.tool decorator registers this via FastMCP.
@mcp.tool(description="Stop seeding without deleting on-disk files. mutates: true") @confirm_required("stop_seeding") def stop_seeding(infohash: str, confirm: bool = False) -> dict[str, Any]: cfg = _cfg.load() qb = Qbittorrent(cfg.qbittorrent) qb.delete(infohash, delete_files=False) return {"ok": True, "infohash": infohash, "kept_files": True} - src/lutris_source_mcp/server.py:7-24 (registration)The FastMCP server instance 'mcp' is created here. The tool registers itself via the @mcp.tool decorator when the module is imported through _register() → from lutris_source_mcp.tools import install_pipeline.
mcp = FastMCP( name="lutris-source-mcp", instructions=( "Source pipeline for lutris-mcp. prepare_install_source(query) " "searches Prowlarr, hands off to qBittorrent, polls every 5s with " "a stdout heartbeat, abandons after stall_timeout_seconds of zero " "progress, classifies the resulting tree, and returns a path " "lutris-mcp consumes via install_from_yaml or install_from_directory." ), ) def _register() -> None: # Side-effect imports register tools. from lutris_source_mcp.tools import diagnostics, install_pipeline # noqa: F401 _register() - The confirm_required decorator wraps destructive tools. For stop_seeding, if confirm=False (default), it returns a Preview object instead of executing. When confirm=True, the actual handler runs.
def confirm_required(action: str) -> Callable[[F], F]: def decorator(fn: F) -> F: @wraps(fn) def wrapper(*args: Any, **kwargs: Any) -> Any: if not kwargs.get("confirm", False): target = ( kwargs.get("query") or kwargs.get("infohash") or kwargs.get("target") or "<unknown>" ) return Preview(action=action, target=str(target), would_do=f"{action} on {target}") return fn(*args, **kwargs) return wrapper # type: ignore[return-value] return decorator