Skip to main content
Glama
argotdev

NHL MCP Server

by argotdev

compare_teams

Compare head-to-head statistics between two NHL teams, including recent matchups and historical records, to analyze team performance and rivalries.

Instructions

Compare head-to-head statistics between two NHL teams including recent matchups and historical records.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
team1YesFirst team abbreviation (e.g., TOR)
team2YesSecond team abbreviation (e.g., MTL)
seasonNoSeason in format YYYYYYYY (optional, defaults to current)

Implementation Reference

  • The core handler function that implements the compare_teams tool logic by fetching team schedules from NHLAPIClient, filtering head-to-head matchups, calculating wins, and formatting the comparison results.
    async function compareTeamsHeadToHead(team1: string, team2: string, season?: string): Promise<string> {
      try {
        const schedule1 = await client.getTeamSchedule(team1, season);
    
        if (!schedule1.games) {
          return `No schedule data found for ${team1}`;
        }
    
        // Find games between these two teams
        const matchups = schedule1.games.filter((game: any) => {
          return (
            (game.homeTeam.abbrev === team1 && game.awayTeam.abbrev === team2) ||
            (game.homeTeam.abbrev === team2 && game.awayTeam.abbrev === team1)
          );
        });
    
        if (matchups.length === 0) {
          return `No matchups found between ${team1} and ${team2} this season`;
        }
    
        let team1Wins = 0;
        let team2Wins = 0;
        const results: string[] = [];
    
        matchups.forEach((game: any) => {
          const isTeam1Home = game.homeTeam.abbrev === team1;
          const team1Score = isTeam1Home ? game.homeTeam.score : game.awayTeam.score;
          const team2Score = isTeam1Home ? game.awayTeam.score : game.homeTeam.score;
    
          if (game.gameState === 'OFF' || game.gameState === 'FINAL') {
            if (team1Score > team2Score) {
              team1Wins++;
              results.push(`${game.gameDate}: ${team1} ${team1Score}, ${team2} ${team2Score} - ${team1} WIN`);
            } else {
              team2Wins++;
              results.push(`${game.gameDate}: ${team1} ${team1Score}, ${team2} ${team2Score} - ${team2} WIN`);
            }
          } else if (game.gameState === 'FUT') {
            results.push(`${game.gameDate}: Upcoming game`);
          } else {
            results.push(`${game.gameDate}: ${team1} ${team1Score}, ${team2} ${team2Score} - IN PROGRESS`);
          }
        });
    
        return `Head-to-Head: ${team1} vs ${team2}\n\nSeason Series: ${team1} ${team1Wins}-${team2Wins} ${team2}\n\nGames:\n${results.join('\n')}`;
      } catch (error: any) {
        return `Error comparing teams: ${error.message}`;
      }
    }
  • The tool schema definition including name, description, input schema with properties for team1, team2 (required), and optional season.
    {
      name: 'compare_teams',
      description: 'Compare head-to-head statistics between two NHL teams including recent matchups and historical records.',
      inputSchema: {
        type: 'object',
        properties: {
          team1: {
            type: 'string',
            description: 'First team abbreviation (e.g., TOR)',
          },
          team2: {
            type: 'string',
            description: 'Second team abbreviation (e.g., MTL)',
          },
          season: {
            type: 'string',
            description: 'Season in format YYYYYYYY (optional, defaults to current)',
          },
        },
        required: ['team1', 'team2'],
      },
    },
  • src/index.ts:575-584 (registration)
    The registration and dispatch logic in the CallToolRequestSchema handler that matches the tool name and calls the compareTeamsHeadToHead handler with parsed parameters.
    case 'compare_teams': {
      const comparison = await compareTeamsHeadToHead(
        parameters.team1 as string,
        parameters.team2 as string,
        parameters.season as string | undefined
      );
      return {
        content: [{ type: 'text', text: comparison }],
      };
    }
Behavior2/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It mentions 'recent matchups and historical records' but doesn't disclose data freshness, rate limits, authentication needs, or what specific statistics are included, leaving gaps for a tool that likely queries external 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 a single, efficient sentence that front-loads the core purpose ('compare head-to-head statistics') and includes key scope details ('between two NHL teams including recent matchups and historical records') without any wasted words.

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

Completeness2/5

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

Given no annotations and no output schema, the description is incomplete for a tool with three parameters and likely complex return data. It lacks details on output format, error handling, or data sources, which are critical for an agent to use this tool effectively in context with siblings.

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 100%, so the schema already documents all parameters (team1, team2, season). The description adds no additional meaning beyond implying these parameters are used for comparison, maintaining the baseline score as the schema handles the heavy lifting.

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

Purpose5/5

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

The description clearly states the specific action ('compare head-to-head statistics') and resource ('between two NHL teams'), distinguishing it from sibling tools like get_team_stats or get_standings by focusing on direct team comparisons rather than individual team metrics or broader league 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?

No explicit guidance is provided on when to use this tool versus alternatives. While it implies comparison of two teams, it doesn't specify scenarios where this is preferred over other tools like get_team_stats for individual team analysis or compare_seasons for temporal comparisons.

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

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