add_to_watchlist
Add a financial symbol to your monitoring watchlist for real-time tracking and analysis within quantitative finance tools.
Instructions
Adds a symbol to the monitoring watchlist.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | Yes |
Implementation Reference
- tools/watchlist.py:25-36 (handler)Core handler function that uppercases the symbol, loads current watchlist, appends if not present, saves to JSON file, logs, and returns confirmation message.def add_to_watchlist(symbol: str) -> str: """ Adds a symbol to the monitoring watchlist. """ symbol = symbol.upper() watchlist = _load_watchlist() if symbol not in watchlist: watchlist.append(symbol) _save_watchlist(watchlist) logger.info(f"Added {symbol} to watchlist") return f"Added {symbol} to watchlist." return f"{symbol} is already in the watchlist."
- tools/watchlist.py:12-19 (helper)Internal helper to load the watchlist from JSON file, handling missing or corrupt files gracefully.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 []
- tools/watchlist.py:21-23 (helper)Internal helper to persist the watchlist to JSON file.def _save_watchlist(watchlist: List[str]): with open(WATCHLIST_FILE, "w") as f: json.dump(watchlist, f, indent=4)
- server.py:410-413 (registration)MCP tool registration of add_to_watchlist function via register_tools helper.register_tools( [add_to_watchlist, remove_from_watchlist], "Watchlist" )