Skip to main content
Glama
owen-lacey

FPL MCP Server

by owen-lacey

Get Live Event

getLiveEvent

Fetch live gameweek statistics for Fantasy Premier League matches. Filter results to specific players by providing element IDs for targeted performance data.

Instructions

Fetch focused live stats for a gameweek. Optionally filter to specific players by providing elementIds array.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
gwYes
elementIdsNo

Implementation Reference

  • Core handler function that fetches live gameweek data, optionally filters by player element IDs, extracts essential stats, and returns structured player data.
    export async function getLiveEvent(gw: number, elementIds?: number[]): Promise<any> {
      const data = await fetchLiveEventRaw(gw);
    
      // Filter elements if specific IDs requested
      let elements = data.elements || [];
      if (elementIds && elementIds.length > 0) {
        elements = elements.filter((element: any) => elementIds.includes(element.id));
      }
    
      // Return only essential stats for each player
      const focusedElements = elements.map((element: any) => ({
        id: element.id,
        stats: {
          minutes: element.stats.minutes,
          goals_scored: element.stats.goals_scored,
          assists: element.stats.assists,
          clean_sheets: element.stats.clean_sheets,
          goals_conceded: element.stats.goals_conceded,
          own_goals: element.stats.own_goals,
          penalties_saved: element.stats.penalties_saved,
          penalties_missed: element.stats.penalties_missed,
          yellow_cards: element.stats.yellow_cards,
          red_cards: element.stats.red_cards,
          saves: element.stats.saves,
          bonus: element.stats.bonus,
          bps: element.stats.bps,
          influence: element.stats.influence,
          creativity: element.stats.creativity,
          threat: element.stats.threat,
          ict_index: element.stats.ict_index,
          starts: element.stats.starts,
          expected_goals: element.stats.expected_goals,
          expected_assists: element.stats.expected_assists,
          expected_goal_involvements: element.stats.expected_goal_involvements,
          expected_goals_conceded: element.stats.expected_goals_conceded,
          total_points: element.stats.total_points,
        }
      }));
    
      return {
        elements: focusedElements
      };
    }
  • Zod input schema defining parameters: required gameweek (gw) as number, optional elementIds as array of numbers.
    inputSchema: { gw: z.number(), elementIds: z.array(z.number()).optional() }
  • src/server.ts:50-64 (registration)
    Registers the 'getLiveEvent' tool with the MCP server, providing title, description, schema, and a wrapper that calls the core handler and formats the response.
    server.registerTool("getLiveEvent", {
      title: "Get Live Event",
      description: "Fetch focused live stats for a gameweek. Optionally filter to specific players by providing elementIds array.",
      inputSchema: { gw: z.number(), elementIds: z.array(z.number()).optional() }
    }, async ({ gw, elementIds }) => {
      const data = await getLiveEvent(gw, elementIds);
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(data)
          }
        ]
      };
    });
  • Internal helper function to fetch raw live event data from the Fantasy Premier League API.
    async function fetchLiveEventRaw(gw: number): Promise<any> {
      const res = await fetch(`https://fantasy.premierleague.com/api/event/${gw}/live/`);
      return res.json();
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions fetching 'focused live stats' but doesn't specify what 'focused' entails, whether data is real-time or cached, or any rate limits or authentication needs. This leaves significant gaps for a tool that likely involves dynamic data.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose in the first sentence and adds optional details in the second. Every sentence earns its place by clarifying functionality without redundancy, making it appropriately sized and efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, no output schema, and 0% schema coverage, the description is incomplete. It covers basic purpose and parameters but lacks details on return values, error handling, or behavioral traits like data freshness. For a tool with live data, this is a minimal viable description with clear gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It explains that 'gw' is for a gameweek and 'elementIds' filters to specific players, adding basic meaning beyond the schema. However, it doesn't detail format constraints (e.g., valid gw ranges) or provide examples, resulting in a baseline 3.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verbs ('fetch focused live stats') and resource ('for a gameweek'), distinguishing it from siblings like getGameweekData or getFixturesForGameweek. However, it doesn't explicitly differentiate from all possible siblings, keeping it at a 4 rather than a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage by mentioning optional filtering with elementIds, but lacks explicit guidance on when to use this tool versus alternatives like getPlayerData or getElementSummary. No exclusions or prerequisites are stated, leaving room for ambiguity.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/owen-lacey/fpl-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server