Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new LTA (Lawn Tennis Association) connector that enables finding tennis courts in the UK with availability information based on location and time preferences.
- Adds a new LTA connector for finding tennis courts with availability data
- Implements two search methods: by coordinates and by city name with geocoding
- Integrates the new connector into the main connector registry
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| packages/mcp-connectors/src/index.ts | Imports and exports the new LTAConnectorConfig in the connector registry |
| packages/mcp-connectors/src/connectors/lta.ts | Implements the complete LTA tennis court finder with web scraping and geocoding |
| .mcp.json | Adds local development server configuration for testing |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| try { | ||
| const response = await fetch(url, { | ||
| headers: { | ||
| 'User-Agent': | ||
| 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36', | ||
| }, | ||
| }); | ||
|
|
||
| if (!response.ok) { | ||
| throw new Error(`HTTP error! Status: ${response.status}`); | ||
| } | ||
|
|
||
| const html = await response.text(); | ||
| const courts = parseCourtResults(html); | ||
| return courts; | ||
| } catch (error) { | ||
| throw error; | ||
| } |
There was a problem hiding this comment.
Unnecessary try-catch block that re-throws the error without adding value. Either handle the error appropriately or remove the try-catch block entirely.
| try { | |
| const response = await fetch(url, { | |
| headers: { | |
| 'User-Agent': | |
| 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36', | |
| }, | |
| }); | |
| if (!response.ok) { | |
| throw new Error(`HTTP error! Status: ${response.status}`); | |
| } | |
| const html = await response.text(); | |
| const courts = parseCourtResults(html); | |
| return courts; | |
| } catch (error) { | |
| throw error; | |
| } | |
| const response = await fetch(url, { | |
| headers: { | |
| 'User-Agent': | |
| 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36', | |
| }, | |
| }); | |
| if (!response.ok) { | |
| throw new Error(`HTTP error! Status: ${response.status}`); | |
| } | |
| const html = await response.text(); | |
| const courts = parseCourtResults(html); | |
| return courts; |
| const name = nameElem?.text.trim() || ''; | ||
|
|
||
| // Extract address from the court details span | ||
| const detailsElem = listing.querySelector('.lta-cart-court-details span'); |
There was a problem hiding this comment.
There's a typo in the CSS selector. 'lta-cart-court-details' should be 'lta-card-court-details' to match the intended element structure.
| const detailsElem = listing.querySelector('.lta-cart-court-details span'); | |
| const detailsElem = listing.querySelector('.lta-card-court-details span'); |
| const parseTimeRange = (timeRange: string): { startHour: number; endHour: number } => { | ||
| const [start, end] = timeRange.split('-'); | ||
| const startHour = parseInt(start.split(':')[0], 10); | ||
| const endHour = parseInt(end.split(':')[0], 10); | ||
| return { startHour, endHour }; | ||
| }; | ||
|
|
There was a problem hiding this comment.
The parseTimeRange function is defined but never used anywhere in the code. This could indicate incomplete implementation or dead code that should be removed.
| const parseTimeRange = (timeRange: string): { startHour: number; endHour: number } => { | |
| const [start, end] = timeRange.split('-'); | |
| const startHour = parseInt(start.split(':')[0], 10); | |
| const endHour = parseInt(end.split(':')[0], 10); | |
| return { startHour, endHour }; | |
| }; |
| timeRange, | ||
| }); | ||
|
|
||
| const url = `${BASE_URL}?${params.toString()}`; |
There was a problem hiding this comment.
The function uses BASE_URL for constructing the search URL, but based on the constants defined, it should use SEARCH_URL instead for the actual search functionality.
| const url = `${BASE_URL}?${params.toString()}`; | |
| const url = `${SEARCH_URL}?${params.toString()}`; |
| const name = nameElem?.text.trim() || ''; | ||
|
|
||
| // Extract address from the court details span | ||
| const detailsElem = listing.querySelector('.lta-cart-court-details span'); |
There was a problem hiding this comment.
Functional correctness: Typo in CSS selector ('lta-cart-court-details') breaks address extraction for venues.
Prompt for AI agents
Address the following comment on packages/mcp-connectors/src/connectors/lta.ts at line 67:
<comment>Functional correctness: Typo in CSS selector ('lta-cart-court-details') breaks address extraction for venues.</comment>
<file context>
@@ -0,0 +1,239 @@
+ const name = nameElem?.text.trim() || '';
+
+ // Extract address from the court details span
+ const detailsElem = listing.querySelector('.lta-cart-court-details span');
+ let address = '';
+ if (detailsElem) {
</file context>
|
@claude resolve the conflicts and fix linting |
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
Summary by cubic
Adds an LTA tennis court finder MCP connector to search UK courts and return availability, with tools for coordinate-based and city-based queries. Registers the connector and adds a local MCP endpoint for testing.