Skip to main content
Glama

get_top_performers

Identify top-performing stocks in the Spanish IBEX 35 index over a specified time period to support investment analysis and decision-making.

Instructions

Get top performing stocks over a specified period

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
daysNoPeriod in days
limitNoMaximum number of results

Implementation Reference

  • Main handler logic for the get_top_performers tool. Fetches all companies, retrieves historical prices for the top 20, calculates percentage change over the specified period, sorts by performance, and returns the top limit performers.
    async getTopPerformers(days: number = 7, limit: number = 10): Promise<any[]> { const companies = await this.getAllCompanies(); // Get recent performance data for each company const performances = []; for (const company of companies.slice(0, 20)) { // Limit to avoid too many requests try { const historical = await this.getHistoricalPrices(company.id, days); if (historical.length >= 2) { const recent = historical[0]; const old = historical[historical.length - 1]; const changePercent = ((recent.close - old.close) / old.close) * 100; performances.push({ symbol: company.symbol, name: company.name, sector: company.sector, current_price: recent.close, period_change: changePercent }); } } catch (error) { // Skip companies with no data continue; } } return performances .sort((a, b) => b.period_change - a.period_change) .slice(0, limit); }
  • MCP tool call handler dispatcher that receives tool arguments and delegates to DatabaseManager.getTopPerformers.
    case 'get_top_performers': result = await this.db.getTopPerformers((args as any)?.days || 7, (args as any)?.limit || 10); break;
  • Input schema definition and tool registration for get_top_performers in the ListTools response.
    name: 'get_top_performers', description: 'Get top performing stocks over a specified period', inputSchema: { type: 'object', properties: { days: { type: 'number', description: 'Period in days', default: 7, }, limit: { type: 'number', description: 'Maximum number of results', default: 10, }, }, }, },
  • Usage of getTopPerformers as a helper in natural language query analysis fallback.
    const top_performers = await this.db.getTopPerformers(7, 5);
  • Usage of getTopPerformers as a helper in price/trend query handling.
    const topPerformers = await this.db.getTopPerformers(30, 10);

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/anbrme/ibex35-mcp-server'

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