get_most_active_lobbyists
Identify organizations with the most EU lobbying meetings to analyze influence in regulatory processes.
Instructions
Get organizations with the most EU lobbying meetings
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of results |
Implementation Reference
- src/database.ts:294-328 (handler)Core handler function that fetches lobbying meetings data from the API, groups meetings by organization, counts occurrences, aggregates institutions and spending, then returns the top N most active lobbyists sorted by meeting count.async getMostActiveLobbyists(limit: number = 10): Promise<any[]> { const data = await this.fetchAPI('/api/lobbying'); const meetings = data.meetings || data.lobbying || []; // Group by organization and count meetings const orgCounts = new Map(); meetings.forEach(meeting => { const org = meeting.organization_name; if (!org) return; if (!orgCounts.has(org)) { orgCounts.set(org, { organization_name: org, meeting_count: 0, institutions: new Set(), spending: [] }); } const entry = orgCounts.get(org); entry.meeting_count++; if (meeting.eu_institution) entry.institutions.add(meeting.eu_institution); if (meeting.quarterly_spending) entry.spending.push(meeting.quarterly_spending); }); return Array.from(orgCounts.values()) .map(entry => ({ ...entry, institutions: Array.from(entry.institutions).join(','), avg_spending: entry.spending.length > 0 ? entry.spending.reduce((sum, val) => sum + val, 0) / entry.spending.length : null })) .sort((a, b) => b.meeting_count - a.meeting_count) .slice(0, limit); }
- src/index.ts:285-298 (registration)Tool registration in the listTools handler, defining the tool name, description, and input schema (optional limit parameter).{ name: 'get_most_active_lobbyists', description: 'Get organizations with the most EU lobbying meetings', inputSchema: { type: 'object', properties: { limit: { type: 'number', description: 'Maximum number of results', default: 10, }, }, }, },
- src/index.ts:637-639 (handler)MCP CallToolRequest handler switch case that extracts the limit argument and delegates to the DatabaseManager's getMostActiveLobbyists method.case 'get_most_active_lobbyists': result = await this.db.getMostActiveLobbyists((args as any)?.limit || 10); break;
- src/index.ts:288-297 (schema)JSON schema defining the tool's input parameters (optional limit with default 10).inputSchema: { type: 'object', properties: { limit: { type: 'number', description: 'Maximum number of results', default: 10, }, }, },