getGameweekData
Fetch comprehensive gameweek data from Fantasy Premier League, including fixtures, player statistics, and league standings for analysis and decision-making.
Instructions
Fetch all gameweek data
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/fpl.ts:111-116 (handler)Core handler function that fetches the FPL bootstrap-static API and returns the events (gameweek data) as Partial<FplApiObject>.export async function getGameweekData(): Promise<Partial<FplApiObject>> { const data = await getBootstrapStatic(); return { events: data.events, }; }
- src/server.ts:217-231 (registration)Registers the "getGameweekData" MCP tool, specifying title, description, empty input schema (no parameters), and an inline handler that invokes getGameweekData() and formats the response as MCP content.server.registerTool("getGameweekData", { title: "Get Gameweek Data", description: "Fetch all gameweek data", inputSchema: {} }, async () => { const data = await getGameweekData(); return { content: [ { type: "text", text: JSON.stringify(data) } ] }; });
- src/types.ts:145-151 (schema)TypeScript interface defining the structure of FplApiObject, used in the return type of getGameweekData (Partial<FplApiObject> with events).export interface FplApiObject { chips: Partial<Chip>[]; events: Partial<Event>[]; element_types: Partial<ElementType>[]; teams: Partial<Team>[]; elements: Partial<Element>[]; }
- src/fpl.ts:92-95 (helper)Helper function that fetches the full FPL bootstrap-static data, called by getGameweekData to retrieve the events.export async function getBootstrapStatic(): Promise<FplApiObject> { const res = await fetch('https://fantasy.premierleague.com/api/bootstrap-static/'); return res.json() as Promise<FplApiObject>; }