Skip to main content
Glama

get_top_performers

Identify top-performing stocks in the Spanish stock exchange over a specified period to inform investment decisions.

Instructions

Get top performing stocks over a specified period

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
daysNoPeriod in days
limitNoMaximum number of results

Implementation Reference

  • The core handler function that implements get_top_performers by fetching all companies, retrieving historical prices for the top 20, calculating percentage change over the specified days, sorting by performance, and returning 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);
    }
  • The tool schema definition including name, description, and input schema for parameters 'days' (default 7) and 'limit' (default 10), registered in the ListTools handler.
    {
      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,
          },
        },
      },
    },
  • src/index.ts:621-623 (registration)
    The registration/dispatcher in the CallToolRequest handler that routes calls to get_top_performers to the DatabaseManager's getTopPerformers method.
    case 'get_top_performers':
      result = await this.db.getTopPerformers((args as any)?.days || 7, (args as any)?.limit || 10);
      break;
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It states the tool retrieves data but does not disclose behavioral traits such as whether it requires authentication, has rate limits, returns real-time or historical data, or how 'top performing' is defined (e.g., by return percentage, volume). This leaves significant gaps for an agent to understand operational constraints.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose without unnecessary words. Every part earns its place by specifying the action, resource, and key constraint, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description is incomplete. It does not explain what 'top performing' entails, the return format, or any behavioral aspects like data freshness or error handling. For a tool with two parameters and no structured safety hints, more context is needed to guide effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with clear parameter descriptions for 'days' and 'limit'. The description adds minimal value beyond the schema by implying a 'specified period' but does not elaborate on parameter interactions or semantics like what 'top performing' means in relation to these inputs. Baseline 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Get' and the resource 'top performing stocks', specifying the action and target. It distinguishes itself from siblings like 'get_historical_prices' or 'get_all_companies' by focusing on performance ranking. However, it lacks explicit differentiation from tools like 'screen_opportunities' which might also identify high-performing assets, making it a 4 rather than a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It does not mention when-not scenarios or compare to siblings like 'analyze_trends' or 'screen_opportunities' that might serve similar purposes. Without any usage context, the agent must infer based on tool names alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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