remove_from_watchlist
Remove a stock symbol from your watchlist to manage tracked investments and maintain an organized portfolio view.
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)Core handler function that removes the specified symbol (uppercased) from the watchlist.json file if present, 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-412 (registration)Registers the remove_from_watchlist function as an MCP tool in the 'Watchlist' category alongside add_to_watchlist.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 after modification.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 to get current list.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 []