Skip to main content
Glama

Fantasy Premier League MCP Server

get_double_gameweeks

Identify upcoming double gameweeks in Fantasy Premier League where teams play multiple matches within a gameweek. Specify the number of future gameweeks to analyze and receive details on affected teams for strategic FPL planning.

Instructions

Get information about upcoming double gameweeks where teams play multiple times

Args: num_gameweeks: Number of upcoming gameweeks to check (default: 5) Returns: Information about double gameweeks and affected teams

Input Schema

NameRequiredDescriptionDefault
num_gameweeksNo

Input Schema (JSON Schema)

{ "properties": { "num_gameweeks": { "default": 5, "title": "Num Gameweeks", "type": "integer" } }, "title": "get_double_gameweeksArguments", "type": "object" }

Implementation Reference

  • The core handler function that implements the logic to find upcoming double gameweeks by fetching fixtures, identifying current gameweek, analyzing upcoming gameweeks, counting fixtures per team per gameweek, and collecting gameweeks where teams have more than one fixture.
    async def get_double_gameweeks(num_gameweeks: int = 5) -> List[Dict[str, Any]]: """ Identify upcoming double gameweeks where teams have multiple fixtures. Args: num_gameweeks: Number of upcoming gameweeks to analyze Returns: List of double gameweeks with affected teams """ # Get gameweek data all_gameweeks = await api.get_gameweeks() all_fixtures = await api.get_fixtures() team_data = await api.get_teams() # Get current gameweek current_gw = None for gw in all_gameweeks: if gw.get("is_current", False) or gw.get("is_next", False): current_gw = gw break if not current_gw: return [] current_gw_id = current_gw["id"] # Limit to specified number of upcoming gameweeks upcoming_gameweeks = [gw for gw in all_gameweeks if gw["id"] >= current_gw_id and gw["id"] < current_gw_id + num_gameweeks] # Map team IDs to names team_map = {t["id"]: t for t in team_data} # Results to return double_gameweeks = [] # Analyze each upcoming gameweek for gameweek in upcoming_gameweeks: gw_id = gameweek["id"] # Get fixtures for this gameweek gw_fixtures = [f for f in all_fixtures if f.get("event") == gw_id] # Count fixtures per team team_fixture_count = {} for fixture in gw_fixtures: home_team = fixture.get("team_h") away_team = fixture.get("team_a") team_fixture_count[home_team] = team_fixture_count.get(home_team, 0) + 1 team_fixture_count[away_team] = team_fixture_count.get(away_team, 0) + 1 # Identify teams with multiple fixtures (double gameweek) teams_with_doubles = [] for team_id, count in team_fixture_count.items(): if count > 1: team = team_map.get(team_id, {}) teams_with_doubles.append({ "id": team_id, "name": team.get("name", f"Team {team_id}"), "short_name": team.get("short_name", ""), "fixture_count": count }) # If teams have double gameweek, add to results if teams_with_doubles: double_gameweeks.append({ "gameweek": gw_id, "name": gameweek.get("name", f"Gameweek {gw_id}"), "teams_with_doubles": teams_with_doubles, "count": len(teams_with_doubles) }) return double_gameweeks

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/rishijatia/fantasy-pl-mcp'

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