get-indicadores
Retrieves financial indicators for specified stock symbols. Use this tool to get key metrics for investment analysis.
Instructions
Buscar informações de indicadores de ações
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| stocks | Yes | Array of stock symbols |
Implementation Reference
- The tool handler for 'get-indicadores'. It registers the tool with MCP server (name 'get-indicadores', description 'Buscar informações de indicadores de ações'), accepts an array of stock symbols via Zod schema, and delegates to the service's getStockIndicators method.
private registerGetIndicatorsToolHandler(): void { this.server.tool( 'get-indicadores', 'Buscar informações de indicadores de ações', { stocks: z.array(z.string()).describe('Array of stock symbols'), }, async (args) => { const stocks: string[] = Array.isArray(args.stocks) ? args.stocks : [args.stocks]; const infos = await this.service.getStockIndicators(stocks); return { content: [ { type: 'text', text: JSON.stringify(infos, null, 2), }, ], }; }, ); - The registerTools() method that registers all tool handlers, including registerGetIndicatorsToolHandler() for 'get-indicadores'.
private registerTools() { this.registerGetStockToolHandler(); this.registerGetIndicatorsToolHandler(); this.registerGetStockPaymentDatesToolHandler(); this.registerPortfolioAnalysisToolHandler(); } - Schema definition for the 'get-indicadores' tool input: requires an array of stock strings.
{ stocks: z.array(z.string()).describe('Array of stock symbols'), }, - The service method getStockIndicators() that fetches indicators for each stock by calling the API, then parses the HTML response using getResume() and getAllIndicators() helpers.
async getStockIndicators(stocks: string[]) { const baseUrl = this.apiService.getUrlBase(); const stockData = []; for (const stock of stocks) { const response = await this.apiService.getIndicators(stock); if (!response) continue; const resume = this.getResume(response); const indicators = this.getAllIndicators(response); const data = { stock: stock, url: `${baseUrl}/acoes/${stock.toLowerCase()}`, resume: { price: { value: resume.price.value, variation: resume.price.variation, }, min52weeks: { value: resume.min52Weeks.value, }, max52weeks: { value: resume.max52Weeks.value, }, minMonth: { value: resume.minMonth.value, }, maxMonth: { value: resume.maxMonth.value, }, valuation12Months: { value: resume.valuation12Months.value, }, valuationCurrentMonth: { value: resume.valuationCurrentMonth.value, }, }, indicators, }; stockData.push(data); } return stockData; } - The API service method that fetches raw HTML for a stock's indicators page from statusinvest.com.br.
async getIndicators(stock: string): Promise<string | null> { const data = await this.makeTextRequest<string>( `/acoes/${stock.toLowerCase()}`, ); if (!data) return null; return data; }