getLeagueStandings
Retrieve Fantasy Premier League standings by league ID to view team rankings and performance data.
Instructions
Fetch information about a league by ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| leagueId | Yes |
Implementation Reference
- src/server.ts:122-132 (handler)MCP tool handler function for getLeagueStandings that calls the helper function and returns the data as JSON text content.}, async ({ leagueId }) => { const data = await getLeagueStandings(leagueId); return { content: [ { type: "text", text: JSON.stringify(data) } ] }; });
- src/server.ts:121-121 (schema)Zod input schema defining leagueId as a required number.inputSchema: { leagueId: z.number() }
- src/server.ts:118-132 (registration)Registration of the getLeagueStandings tool with the MCP server, including metadata, schema, and handler.server.registerTool("getLeagueStandings", { title: "Get League Standings", description: "Fetch information about a league by ID", inputSchema: { leagueId: z.number() } }, async ({ leagueId }) => { const data = await getLeagueStandings(leagueId); return { content: [ { type: "text", text: JSON.stringify(data) } ] }; });
- src/fpl.ts:70-73 (helper)Core helper function that performs the HTTP fetch to the FPL API for league standings.export async function getLeagueStandings(leagueId: number): Promise<any> { const res = await fetch(`https://fantasy.premierleague.com/api/leagues-classic/${leagueId}/standings/`); return res.json(); }