getPlayerData
Fetch comprehensive Fantasy Premier League player statistics and performance data to analyze team selections and track player form.
Instructions
Fetch all player data
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/server.ts:185-199 (registration)Registration of the MCP tool 'getPlayerData' including inline input schema (empty object) and the thin handler wrapper that calls the helper function and formats response as JSON text content.server.registerTool("getPlayerData", { title: "Get Player Data", description: "Fetch all player data", inputSchema: {} }, async () => { const data = await getPlayerData(); return { content: [ { type: "text", text: JSON.stringify(data) } ] }; });
- src/fpl.ts:97-102 (handler)Core handler logic for fetching player data (elements) from FPL bootstrap-static API, returning a partial FplApiObject.export async function getPlayerData(): Promise<Partial<FplApiObject>> { const data = await getBootstrapStatic(); return { elements: data.elements, }; }
- src/fpl.ts:92-95 (helper)Helper function called by getPlayerData to fetch the full bootstrap-static data from FPL API.export async function getBootstrapStatic(): Promise<FplApiObject> { const res = await fetch('https://fantasy.premierleague.com/api/bootstrap-static/'); return res.json() as Promise<FplApiObject>; }
- src/types.ts:145-151 (schema)TypeScript interface defining the structure of FPL API response object, used in getPlayerData return type.export interface FplApiObject { chips: Partial<Chip>[]; events: Partial<Event>[]; element_types: Partial<ElementType>[]; teams: Partial<Team>[]; elements: Partial<Element>[]; }