Skip to main content
Glama

get_top_shareholders_by_sector

Identify the largest shareholders within a specific sector of the Spanish stock exchange to analyze ownership structures and investment patterns.

Instructions

Get top shareholders in a specific sector

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of results
sectorYesSector name

Implementation Reference

  • The core handler function that executes the tool logic: fetches companies by sector, retrieves all shareholder positions from API, filters those belonging to sector companies, sorts by descending ownership percentage, and returns the top N.
    async getTopShareholdersBySector(sector: string, limit: number = 10): Promise<any[]> { const companies = await this.getCompaniesBySector(sector); const data = await this.fetchAPI('/api/shareholder-positions'); const shareholders = data.shareholderPositions || data.positions || []; const sectorSymbols = companies.map(c => c.symbol); const sectorShareholders = shareholders.filter(position => sectorSymbols.includes(position.company_symbol || position.ticker) ); return sectorShareholders .sort((a, b) => (b.percentage || 0) - (a.percentage || 0)) .slice(0, limit); }
  • src/index.ts:613-615 (registration)
    The switch case that registers and dispatches calls to the tool handler in the MCP server's CallToolRequest handler.
    case 'get_top_shareholders_by_sector': result = await this.db.getTopShareholdersBySector((args as any)?.sector, (args as any)?.limit || 10); break;
  • The tool schema definition including name, description, and input schema validation registered in ListToolsRequestHandler.
    { name: 'get_top_shareholders_by_sector', description: 'Get top shareholders in a specific sector', inputSchema: { type: 'object', properties: { sector: { type: 'string', description: 'Sector name', }, limit: { type: 'number', description: 'Maximum number of results', default: 10, }, }, required: ['sector'], }, },
  • Helper function used by the handler to retrieve companies filtered by sector name.
    async getCompaniesBySector(sector: string): Promise<any[]> { const companies = await this.getAllCompanies(); return companies.filter(company => company.sector && company.sector.toLowerCase().includes(sector.toLowerCase()) ); }

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