UNPKG

@bdmarvin/mcp-server-sleeper

Version:

A Model Context Protocol (MCP) server providing access to the Sleeper Fantasy Football API.

84 lines (83 loc) 4.04 kB
import { z } from 'zod'; // Schemas for Sleeper API Endpoints export const GetUserSchema = z.object({ identifier: z.string().describe('The username or user ID of the user.'), }); export const GetUserLeaguesSchema = z.object({ userId: z.string().describe('The numerical ID of the user.'), sport: z.string().describe('The sport (e.g., "nfl").'), season: z.string().describe('The season (e.g., "2018").'), }); export const GetLeagueSchema = z.object({ leagueId: z.string().describe('The ID of the league to retrieve.'), }); export const GetLeagueRostersSchema = z.object({ leagueId: z.string().describe('The ID of the league to retrieve rosters from.'), }); export const GetLeagueUsersSchema = z.object({ leagueId: z.string().describe('The ID of the league to retrieve users from.'), }); export const GetLeagueMatchupsSchema = z.object({ leagueId: z.string().describe('The ID of the league to retrieve matchups from.'), week: z.number().describe('The week number.'), }); export const GetLeagueWinnersBracketSchema = z.object({ leagueId: z.string().describe('The ID of the league to retrieve the winners bracket for.'), }); export const GetLeagueLosersBracketSchema = z.object({ leagueId: z.string().describe('The ID of the league to retrieve the losers bracket for.'), }); export const GetLeagueTransactionsSchema = z.object({ leagueId: z.string().describe('The ID of the league.'), round: z.number().describe('The week/round to pull from.'), }); export const GetLeagueTradedPicksSchema = z.object({ leagueId: z.string().describe('The ID of the league to retrieve traded picks for.'), }); export const GetNFLStateSchema = z.object({ // No parameters required for this endpoint as per documentation }); const FilterOperatorSchema = z.enum([ 'eq', // Equals 'ne', // Not Equals 'contains', // String contains 'gt', // Greater than 'gte', // Greater than or equal to 'lt', // Less than 'lte', // Less than or equal to 'in', // Value is one of a list (value should be an array) 'exists', // Field exists (value can be true/false or ignored) 'notExists', // Field does not exist (value can be true/false or ignored) ]); export const FilterConditionSchema = z.object({ field: z.string().describe('The player attribute to filter on (e.g., age, position, metadata.channel_id).'), operator: FilterOperatorSchema.describe('The comparison operator.'), value: z.any().describe('The value to compare against. For "in" operator, this should be an array.'), }); export const GetAllPlayersSchema = z.object({ filters: z.array(FilterConditionSchema).optional().describe('An array of filter conditions to apply. All conditions are ANDed.'), fields: z.array(z.string()).optional().describe('Comma-separated list of player object fields to return (e.g., player_id,full_name,position).'), }); export const GetTrendingPlayersSchema = z.object({ sport: z.string().describe('The sport, such as nfl.'), type: z.enum(['add', 'drop']).describe('Either add or drop.'), lookbackHours: z.number().optional().describe('Number of hours to look back (default is 24).'), limit: z.number().optional().describe('Number of results you want, (default is 25).'), }); export const GetUserDraftsSchema = z.object({ userId: z.string().describe('The numerical ID of the user.'), sport: z.string().describe('The sport (e.g., "nfl").'), season: z.string().describe('Season can be 2017, 2018, etc...'), }); export const GetLeagueDraftsSchema = z.object({ leagueId: z.string().describe('The ID of the league for which you are trying to retrieve drafts.'), }); export const GetDraftSchema = z.object({ draftId: z.string().describe('The ID of the draft to retrieve.'), }); export const GetDraftPicksSchema = z.object({ draftId: z.string().describe('The ID of the draft to retrieve picks for.'), }); export const GetDraftTradedPicksSchema = z.object({ draftId: z.string().describe('The ID of the draft to retrieve picks for.'), });