Skip to main content
Glama
argotdev

NHL MCP Server

by argotdev

get_live_games

Retrieve live NHL game scores, period status, and venue details for today or a specified date to track ongoing hockey matches.

Instructions

Get live NHL game scores and status for today or a specific date. Shows current scores, period, game state, and venue information.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dateNoDate in YYYY-MM-DD format (optional, defaults to today)

Implementation Reference

  • MCP tool handler for 'get_live_games' that fetches games via NHLAPIClient.getTodaysScores, handles empty case, formats output using formatGameScore, and returns as MCP content.
    case 'get_live_games': { const games = await client.getTodaysScores(parameters.date as string | undefined); if (games.length === 0) { return { content: [ { type: 'text', text: 'No games scheduled for this date' }, ], }; } const formatted = games.map(formatGameScore).join('\n\n'); return { content: [{ type: 'text', text: formatted }], }; }
  • Tool schema definition in the TOOLS array, including name, description, and inputSchema for date parameter.
    { name: 'get_live_games', description: 'Get live NHL game scores and status for today or a specific date. Shows current scores, period, game state, and venue information.', inputSchema: { type: 'object', properties: { date: { type: 'string', description: 'Date in YYYY-MM-DD format (optional, defaults to today)', }, }, }, },
  • src/index.ts:460-462 (registration)
    Registration of the tool list handler that returns the TOOLS array containing 'get_live_games'.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: TOOLS }; });
  • Core implementation in NHLAPIClient that fetches live game scores from NHL API for a given date.
    async getTodaysScores(date?: string): Promise<GameScore[]> { const dateStr = date || new Date().toISOString().split('T')[0]; const data = await this.fetchJSON(`${NHL_API_BASE}/score/${dateStr}`); return data.games || []; }
  • Helper function to format individual game score information for display.
    function formatGameScore(game: GameScore): string { const status = game.gameState === 'LIVE' || game.gameState === 'CRIT' ? `LIVE - Period ${game.period}` : game.gameState === 'FUT' ? 'Scheduled' : game.gameState === 'FINAL' || game.gameState === 'OFF' ? 'Final' : game.gameState; return `${game.awayTeam.abbrev} ${game.awayTeam.score} @ ${game.homeTeam.abbrev} ${game.homeTeam.score} - ${status}\nVenue: ${game.venue}\nDate: ${game.gameDate}\nGame ID: ${game.id}`; }

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/argotdev/nhl-mcp-ts'

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