Skip to main content
Glama

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
NameRequiredDescriptionDefault
symbolYes

Implementation Reference

  • 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"
    )
  • 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)
  • 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

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/N-lia/MonteWalk'

If you have feedback or need assistance with the MCP directory API, please join our Discord server