getElementSummary
Fetch player details and statistics from Fantasy Premier League data using the official FPL API to support team management decisions.
Instructions
Fetch details for a specific player (element)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| elementId | Yes |
Implementation Reference
- src/server.ts:267-281 (registration)Registration of the MCP tool 'getElementSummary' including title, description, input schema, and an inline asynchronous handler function.server.registerTool("getElementSummary", { title: "Get Element Summary", description: "Fetch details for a specific player (element)", inputSchema: { elementId: z.number() } }, async ({ elementId }) => { const data = await getElementSummary(elementId); return { content: [ { type: "text", text: JSON.stringify(data) } ] }; });
- src/server.ts:270-270 (schema)Zod-based input schema requiring an 'elementId' number parameter.inputSchema: { elementId: z.number() }
- src/server.ts:271-281 (handler)The tool's handler logic: calls the getElementSummary helper with elementId, stringifies the data as JSON, and returns it in the standard MCP content format.}, async ({ elementId }) => { const data = await getElementSummary(elementId); return { content: [ { type: "text", text: JSON.stringify(data) } ] }; });
- src/fpl.ts:130-133 (helper)Helper function implementing the core logic: fetches player (element) summary data from the official Fantasy Premier League API endpoint.export async function getElementSummary(elementId: number): Promise<any> { const res = await fetch(`https://fantasy.premierleague.com/api/element-summary/${elementId}/`); return res.json(); }