search_stocks
Search for stocks and mutual funds by name or ticker symbol to find investment opportunities on Groww.
Instructions
Fuzzy search stocks and MFs by name or ticker
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query — stock name, ticker, or keyword |
Implementation Reference
- src/tools/market.ts:48-70 (handler)The "search_stocks" tool is registered and its handler logic is implemented within the server.tool block in src/tools/market.ts. It uses growwClient.searchStocks to perform the search.
// ── search_stocks ───────────────────────────────────────── server.tool( "search_stocks", "Fuzzy search stocks and MFs by name or ticker", { query: z.string().describe("Search query — stock name, ticker, or keyword"), }, async ({ query }) => { try { const results = await growwClient.searchStocks(query); if (results.length === 0) return mcpText(`🔍 No results found for "${query}"`); const lines = results.map((r, i) => `${i + 1}. ${r.symbol} — ${r.name} [${r.exchange}] (${r.type}) ISIN: ${r.isin}` ); const text = [`🔍 SEARCH: "${query}" — ${results.length} results`, `${"─".repeat(40)}`, ...lines].join("\n"); return mcpText(text); } catch (err) { return mcpError(normalizeError(err)); } } );