get_shareholder_overlap
Identify investors holding shares across multiple companies in Spain's IBEX 35 stock index to analyze market concentration and investment patterns.
Instructions
Find shareholders who own stakes in multiple IBEX 35 companies
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/database.ts:168-200 (handler)Core implementation of getShareholderOverlap: fetches shareholder data via API, groups positions by shareholder name, identifies overlaps (multiple companies), calculates average ownership percentage, and sorts by company count.async getShareholderOverlap(): Promise<any[]> { const data = await this.fetchAPI('/api/shareholder-positions'); const shareholders = data.shareholderPositions || data.positions || []; // Group by shareholder name const shareholderMap = new Map(); shareholders.forEach(position => { const name = position.shareholder_name || position.name; if (!name) return; if (!shareholderMap.has(name)) { shareholderMap.set(name, []); } shareholderMap.get(name).push(position); }); const overlaps = []; for (const [name, positions] of shareholderMap.entries()) { if (positions.length > 1) { const companies = positions.map(p => p.company_symbol || p.ticker).filter(Boolean); const avgPercentage = positions.reduce((sum, p) => sum + (p.percentage || 0), 0) / positions.length; overlaps.push({ shareholder_name: name, companies: companies.join(','), company_count: companies.length, avg_percentage: avgPercentage }); } } return overlaps.sort((a, b) => b.company_count - a.company_count); }
- src/index.ts:158-165 (registration)Registers the MCP tool 'get_shareholder_overlap' with description and parameterless input schema in the ListToolsRequestSchema response.{ name: 'get_shareholder_overlap', description: 'Find shareholders who own stakes in multiple IBEX 35 companies', inputSchema: { type: 'object', properties: {}, }, },
- src/index.ts:609-611 (handler)Tool dispatch handler in CallToolRequestSchema: maps tool call to this.db.getShareholderOverlap() execution.case 'get_shareholder_overlap': result = await this.db.getShareholderOverlap(); break;
- src/index.ts:161-164 (schema)Input schema definition: empty properties object indicating no required parameters.inputSchema: { type: 'object', properties: {}, },