get_watchlist
Retrieve your stock watchlist with current prices and daily changes to monitor market positions on Groww.
Instructions
List all watchlist symbols with LTP and day change
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/watchlist.ts:20-41 (handler)The handler function for get_watchlist that fetches the watchlist data and formats it for output.
async () => { try { const items = await growwClient.getWatchlist(); if (items.length === 0) return mcpText("📭 Watchlist is empty. Add symbols to track them."); const lines = items.map((w) => { const emoji = pnlEmoji(w.change); return `${emoji} ${w.symbol.padEnd(12)} ${formatCurrencyExact(w.ltp).padStart(12)} ${pnlSign(w.change)} (${formatPercent(w.changePercent)}) ${w.name}`; }); const text = [ `👁️ WATCHLIST (${items.length} symbols)`, `${"─".repeat(70)}`, ...lines, ``, `As of ${nowIST()}`, ].join("\n"); return mcpText(text); } catch (err) { return mcpError(normalizeError(err)); } } - src/tools/watchlist.ts:16-42 (registration)Registration of the get_watchlist tool using server.tool.
server.tool( "get_watchlist", "List all watchlist symbols with LTP and day change", {}, async () => { try { const items = await growwClient.getWatchlist(); if (items.length === 0) return mcpText("📭 Watchlist is empty. Add symbols to track them."); const lines = items.map((w) => { const emoji = pnlEmoji(w.change); return `${emoji} ${w.symbol.padEnd(12)} ${formatCurrencyExact(w.ltp).padStart(12)} ${pnlSign(w.change)} (${formatPercent(w.changePercent)}) ${w.name}`; }); const text = [ `👁️ WATCHLIST (${items.length} symbols)`, `${"─".repeat(70)}`, ...lines, ``, `As of ${nowIST()}`, ].join("\n"); return mcpText(text); } catch (err) { return mcpError(normalizeError(err)); } } );