Skip to main content
Glama
justfeltlikerunning

Sleeper Fantasy MCP

get_my_roster

Retrieve your fantasy football team roster with detailed player information from Sleeper leagues to manage your lineup and make informed decisions.

Instructions

Get your team's roster with player details

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
leagueNoLeague name (ROAD_TO_GLORY or DYNASTY), defaults to configured default

Implementation Reference

  • The execute method that implements the core logic of the 'get_my_roster' tool. It fetches rosters, users, and NFL players from the Sleeper API for the specified league, identifies the user's roster by matching username or team name, enriches players with details, and returns a formatted JSON structure with team record, starters, bench, etc.
    async execute(args: any) {
      const leagueConfig = getLeagueConfig(args.league);
      
      if (!leagueConfig) {
        throw new Error(`League configuration not found for: ${args.league}`);
      }
    
      try {
        const [rostersResponse, usersResponse, playersResponse] = await Promise.all([
          fetch(`${config.api.baseUrl}/league/${leagueConfig.id}/rosters`),
          fetch(`${config.api.baseUrl}/league/${leagueConfig.id}/users`),
          fetch(`${config.api.baseUrl}/players/nfl`)
        ]);
    
        if (!rostersResponse.ok || !usersResponse.ok || !playersResponse.ok) {
          throw new Error('Failed to fetch roster data');
        }
    
        const rosters: SleeperRoster[] = await rostersResponse.json();
        const users: SleeperUser[] = await usersResponse.json();
        const players = await playersResponse.json();
    
        const userMap = new Map(users.map(user => [user.user_id, user]));
        
        // Match by display_name first (which is "Richard1012"), then fallback to team names
        const myRoster = rosters.find(roster => {
          const user = userMap.get(roster.owner_id);
          return user?.display_name === config.username || 
                 user?.username === config.username ||
                 user?.display_name === leagueConfig.teamName || 
                 user?.username === leagueConfig.teamName;
        });
    
        if (!myRoster) {
          throw new Error(`Could not find roster for user: ${config.username} or team: ${leagueConfig.teamName}`);
        }
    
        const getPlayerInfo = (playerId: string) => {
          const player = players[playerId];
          return player ? {
            name: `${player.first_name} ${player.last_name}`,
            position: player.position,
            team: player.team,
            status: player.status
          } : { name: 'Unknown Player', position: 'UNK', team: 'UNK', status: 'unknown' };
        };
    
        const result = {
          teamName: leagueConfig.teamName,
          rosterId: myRoster.roster_id,
          record: {
            wins: myRoster.settings.wins,
            losses: myRoster.settings.losses,
            ties: myRoster.settings.ties
          },
          points: {
            for: myRoster.settings.fpts,
            against: myRoster.settings.fpts_against
          },
          starters: myRoster.starters.map(playerId => ({
            playerId,
            ...getPlayerInfo(playerId)
          })),
          bench: myRoster.players.filter(p => !myRoster.starters.includes(p)).map(playerId => ({
            playerId,
            ...getPlayerInfo(playerId)
          })),
          totalPlayers: myRoster.players.length
        };
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(result, null, 2),
            },
          ],
        };
      } catch (error) {
        throw new Error(`Failed to get roster: ${error instanceof Error ? error.message : String(error)}`);
      }
    }
  • Tool metadata: name, description, and input schema. The schema allows an optional 'league' parameter to specify ROAD_TO_GLORY or DYNASTY leagues.
    name = "get_my_roster";
    description = "Get your team's roster with player details";
    inputSchema = {
      type: "object",
      properties: {
        league: {
          type: "string",
          description: "League name (ROAD_TO_GLORY or DYNASTY), defaults to configured default",
          enum: ["ROAD_TO_GLORY", "DYNASTY"]
        }
      }
    };
  • src/index.ts:72-73 (registration)
    In the CallToolRequest handler switch statement, maps the 'get_my_roster' tool name to the execution of RosterTool's execute method.
    case "get_my_roster":
      return await rosterTool.execute(args);
  • src/index.ts:48-63 (registration)
    Registers the list of available tools for ListToolsRequest, including the RosterTool instance which provides the 'get_my_roster' tool.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: [
        leagueTool,
        rosterTool,
        matchupTool,
        playerTool,
        projectionsTool,
        matchupProjectionsTool,
        lineupOptimizerTool,
        trendingTool,
        historicalScoresTool,
        playerNewsTool,
        transactionsTool,
        stateScheduleTool,
      ],
    }));
  • src/index.ts:24-24 (registration)
    Instantiates the RosterTool class instance used for the 'get_my_roster' tool.
    const rosterTool = new RosterTool();
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves data ('Get'), implying a read-only operation, but doesn't specify if it requires authentication, has rate limits, returns paginated results, or what format the 'player details' include. For a tool with no annotation coverage, this leaves significant gaps in understanding its behavior.

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 a single, efficient sentence: 'Get your team's roster with player details'. It's front-loaded with the core purpose, has zero wasted words, and is appropriately sized for a simple retrieval tool. Every part of the sentence contributes to understanding the tool's function.

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 the tool's low complexity (1 optional parameter, no output schema, no annotations), the description is minimally adequate. It covers the basic purpose but lacks details on behavioral aspects like authentication or output format. For a read operation with no annotations, it should ideally mention more about the return data or usage context to be fully complete.

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?

The input schema has 100% description coverage, with the 'league' parameter well-documented in the schema itself. The description doesn't add any parameter-specific information beyond what the schema provides, such as explaining the 'league' context or default behavior. With high schema coverage, the baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't need to.

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: 'Get your team's roster with player details'. It specifies the action ('Get'), resource ('team's roster'), and scope ('player details'), which distinguishes it from siblings like 'get_available_players' or 'get_historical_scores'. However, it doesn't explicitly differentiate from all siblings, such as 'get_my_matchup', which might also relate to user-specific data.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, such as needing to be logged in or having a team, or compare it to siblings like 'get_available_players' for broader player lists. There's an implied context of user-specific data, but no explicit usage instructions.

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/justfeltlikerunning/sleeper-fantasy-mcp'

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