get_stock_price_fireant
Retrieve real-time stock prices for Vietnam market symbols using FireAnt data sources. Input stock symbols to get current market pricing information.
Instructions
Get real-time stock price from FireAnt. Uses FireAnt API or web scraping to retrieve current stock prices for Vietnam stock market symbols (e.g., VIC, VNM, VCB).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | Yes | Stock symbol (e.g., 'VIC', 'VNM', 'VCB'). Use comma-separated for multiple symbols. |
Implementation Reference
- src/index.ts:372-476 (handler)The handler function `getStockPriceFireAnt` that implements the tool logic. It fetches real-time stock prices from FireAnt API for given symbols, handles multiple symbols, API fallbacks, authentication notes, and returns structured JSON results or errors.private async getStockPriceFireAnt(args: { symbol: string }) { const { symbol } = args; const symbols = symbol.split(",").map((s) => s.trim().toUpperCase()); try { // Try FireAnt API first const results: any[] = []; for (const sym of symbols) { try { // FireAnt API endpoint for stock quotes const apiUrl = `https://restv2.fireant.vn/stocks/${sym}/quotes`; const response = await fetch(apiUrl, { headers: { "User-Agent": "Mozilla/5.0", "Accept": "application/json", }, }); if (response.ok) { const data = await response.json(); results.push({ symbol: sym, source: "FireAnt API", data: data, timestamp: new Date().toISOString(), }); } else { // Fallback: Try alternative endpoint const altUrl = `https://restv2.fireant.vn/symbols/${sym}/intraday`; const altResponse = await fetch(altUrl, { headers: { "User-Agent": "Mozilla/5.0", "Accept": "application/json", }, }); if (altResponse.ok) { const altData = await altResponse.json(); results.push({ symbol: sym, source: "FireAnt API (alternative)", data: altData, timestamp: new Date().toISOString(), }); } else { // If API fails, provide information about how to access results.push({ symbol: sym, source: "FireAnt", status: "API endpoint may require authentication", note: "FireAnt API may require API key or authentication. Please check FireAnt API documentation or use Firecrawl to scrape from https://www.fireant.vn", documentationUrl: "https://api.fireant.vn/", webUrl: `https://www.fireant.vn/symbol/${sym}`, }); } } } catch (error) { results.push({ symbol: sym, error: error instanceof Error ? error.message : String(error), note: "Unable to fetch from API. Consider using Firecrawl MCP to scrape from FireAnt website.", webUrl: `https://www.fireant.vn/symbol/${sym}`, }); } } return { content: [ { type: "text", text: JSON.stringify( { provider: "FireAnt", symbols: symbols, results: results, note: results.some((r) => r.note) && "Some data may require authentication. Consider using Firecrawl MCP server to scrape real-time data from FireAnt website.", }, null, 2 ), }, ], }; } catch (error) { return { content: [ { type: "text", text: JSON.stringify( { error: error instanceof Error ? error.message : String(error), note: "Unable to fetch stock prices. You may need to use Firecrawl MCP to scrape data from FireAnt website at https://www.fireant.vn", }, null, 2 ), }, ], isError: true, }; } }
- src/index.ts:229-230 (registration)Registration of the tool handler in the CallToolRequestSchema switch statement within setupHandlers().case "get_stock_price_fireant": return await this.getStockPriceFireAnt(args as any);
- src/index.ts:121-134 (schema)Tool schema definition including name, description, and input schema (requires 'symbol' string) in the tools array used for ListToolsRequestHandler.name: "get_stock_price_fireant", description: "Get real-time stock price from FireAnt. Uses FireAnt API or web scraping to retrieve current stock prices for Vietnam stock market symbols (e.g., VIC, VNM, VCB).", inputSchema: { type: "object", properties: { symbol: { type: "string", description: "Stock symbol (e.g., 'VIC', 'VNM', 'VCB'). Use comma-separated for multiple symbols.", }, }, required: ["symbol"], }, },