# Offside Line Calculator AI Agent Connect

> Offside Line Calculator MCP uses X and Y coordinates to determine if an attacking player is in an offside position. It applies the second-last opponent rule to calculate exact margins in meters and identifies whether the goal line or a defender defines the offside line.

## Overview
- **Category:** analytics
- **Price:** Free
- **Endpoint:** https://edge.vinkius.com/vk_preview_TMqCCRatpsJAnhWe12yehzpBJiaIxYiobh9H5x4I/ai-agent-connect
- **Tags:** football, soccer, offside, geometry, sports-analytics

## Description

You can use this MCP to turn raw coordinate data into actionable football analytics. Instead of guessing if a player was offside, you provide the X and Y positions of the attacker, the ball, and the defenders. The MCP handles the geometry, applying the second-last opponent rule to find the offside line. It tells you if the player was onside or offside and provides the exact distance in meters. It also checks if your input data stays within the pitch boundaries to prevent errors in your analysis. This is a specialized tool for anyone needing to automate spatial reasoning for football match data.

## Tools

### get_defender_proximity
This tool calculates how close a player is to the defenders. It helps you identify defensive gaps or tight marking situations.

### get_offside_status
This tool determines if a player is in an offside position. It returns the status and the specific margin in meters.

### get_reference_line_type
This tool identifies the reference line used for the offside rule. It tells you if the line is set by a defender or the goal line.

### validate_pitch_coordinates
This tool checks that your X and Y coordinates fall within the actual pitch boundaries. It prevents calculation errors from out-of-bounds data.

## Prompt Examples

**Prompt:** 
```
Is the attacker at (85, 34) offside? The ball is at (80, 34), the goal line is at 105, and defenders are at (90, 30) and (95, 35).
```

**Response:** 
```
No, the attacker is onside because they are behind the ball.
```

**Prompt:** 
```
Calculate the offside status for an attacker at (92, 34) when the ball is at (80, 34) and defenders are at (95, 30) and (98, 35). The goal line is at 105.
```

**Response:** 
```
The attacker is offside with a margin of 3 meters from the reference line.
```

**Prompt:** 
```
Check if the coordinates (110, 40) are valid for a standard pitch of 105x68.
```

**Response:** 
```
The coordinates are invalid because the X-coordinate exceeds the pitch length.
```

## Capabilities

### Offside Determination
Your agent uses this to decide if an attacking player is in an offside position.

### Margin Calculation
Your agent calculates the exact distance in meters between the player and the offside line.

### Coordinate Validation
Your agent checks that all player and ball positions are within the pitch limits.

### Defensive Gap Analysis
Your agent measures the proximity of players to defenders to evaluate defensive structures.

### Reference Line Identification
Your agent determines if the offside line is defined by the goal line or the second-last opponent.

## Use Cases

### Post-Match Review
You can feed tracking data into your agent to review controversial offside calls.

### Defensive Structure Analysis
Use the proximity tool to see how well defenders are maintaining the offside line.

### Data Cleaning
Run coordinate validation to ensure tracking data hasn't drifted outside the pitch.

### Automated Reporting
Generate precise offside statistics for match reports using coordinate inputs.

## Benefits

- Automates the second-last opponent rule calculation.
- Provides exact distance margins in meters.
- Prevents errors by validating pitch boundaries.
- Identifies the specific type of reference line used.

## How It Works

Connect your client to Vinkius and start sending coordinates to your agent.

1. Connect your MCP-compatible client to Vinkius.
2. Provide the X and Y coordinates for the attacker, ball, and defenders.
3. The agent calls the necessary tools to process the geometry.
4. The agent returns the offside status and distance margins.

## Frequently Asked Questions

**How does this MCP determine offside?**
It uses the X and Y coordinates of the players and the ball to apply the second-last opponent rule.

**Can I use this with Claude or Cursor?**
Yes, you can connect this MCP to any MCP-compatible client like Claude, Cursor, or Windsurf.

**What kind of data do I need to provide?**
You need to provide the X and Y coordinates for the attacking player, the ball, and the defenders.

**Does it check if the data is actually on the pitch?**
Yes, the validate_pitch_coordinates tool checks that all coordinates are within the pitch boundaries.

**Will it tell me how far offside a player was?**
Yes, the get_offside_status tool provides the exact margin in meters.

**How is the offside line determined?**
The offside line is defined by the second-to-last opponent. If there are fewer than two opponents between the attacker and the goal, the goal line itself becomes the reference line.

**Does the ball position affect the offside decision?**
Yes. If the attacking player is behind the ball at the moment of the pass, they are considered onside regardless of the defenders' positions.

**What happens if a player is perfectly level with the defender?**
If an attacker is perfectly level with the reference line or the ball, they are considered onside.
