remove_from_watchlist
Remove a stock symbol from your watchlist to declutter your portfolio tracking and focus on relevant assets.
Instructions
Removes a symbol from the watchlist.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | Yes |
Implementation Reference
- tools/watchlist.py:38-49 (handler)The core handler function for the 'remove_from_watchlist' tool. It uppercases the symbol, loads the watchlist from JSON, removes the symbol if present, saves the updated list, and returns a confirmation message.def remove_from_watchlist(symbol: str) -> str: """ Removes a symbol from the watchlist. """ symbol = symbol.upper() watchlist = _load_watchlist() if symbol in watchlist: watchlist.remove(symbol) _save_watchlist(watchlist) logger.info(f"Removed {symbol} from watchlist") return f"Removed {symbol} from watchlist." return f"{symbol} was not in the watchlist."
- server.py:410-413 (registration)MCP tool registration block in the FastMCP server where remove_from_watchlist is registered via the register_tools helper function.register_tools( [add_to_watchlist, remove_from_watchlist], "Watchlist" )
- tools/watchlist.py:21-23 (helper)Helper function to persist the watchlist to JSON file, used by remove_from_watchlist.def _save_watchlist(watchlist: List[str]): with open(WATCHLIST_FILE, "w") as f: json.dump(watchlist, f, indent=4)
- tools/watchlist.py:12-19 (helper)Helper function to load the watchlist from JSON file, used by remove_from_watchlist.def _load_watchlist() -> List[str]: if not WATCHLIST_FILE.exists(): return [] try: with open(WATCHLIST_FILE, "r") as f: return json.load(f) except Exception: return []
- server.py:20-20 (registration)Import statement in MCP server bringing in the remove_from_watchlist function for registration.from tools.watchlist import add_to_watchlist, remove_from_watchlist, get_watchlist_data