-
Notifications
You must be signed in to change notification settings - Fork 0
Add FindTrainConnections MCP tool for train route analysis with real-time status #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: abeckDev <[email protected]>
Co-authored-by: abeckDev <[email protected]>
Co-authored-by: abeckDev <[email protected]>
The path variable at line 323 (originally line 316) was always empty because:
Root Cause: The code was trying to read the ppth attribute from the <s> element (stop.Attribute("ppth")), but according to the Deutsche Bahn Timetable API XML schema, the ppth (path) attribute is actually located on the <dp> (departure) or <ar> (arrival) child elements, not on the parent <s> (stop) element.
The Fix:
Moved the departureElement declaration earlier in the loop
Read the ppth attribute from departureElement instead of stop
Removed the duplicate departureElement declaration later in the code
Now the code correctly retrieves the path information from <dp ppth="..."> and should be able to find train connections that go through both stations.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #11 +/- ##
==========================================
+ Coverage 72.89% 76.11% +3.21%
==========================================
Files 5 5
Lines 107 314 +207
Branches 5 56 +51
==========================================
+ Hits 78 239 +161
- Misses 29 46 +17
- Partials 0 29 +29 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
abeckDev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot please check the issue with the missing live changes check and implement it according to the comment on line 356.
…rain - Changed from GetRecentTimetableChangesAsync to GetFullChangesAsync to get all changes instead of just last 2 minutes - Implemented proper matching of changes data to each specific train by train ID - Extract live delay, cancellation status, platform changes, and messages from the full changes data - Added test case to verify live delay information is properly extracted and displayed Co-authored-by: abeckDev <[email protected]>
Implemented in commit adc2725. The code now uses |
|
@copilot add some tests for the missing "no train is available" sections in the TimeTable Service (Line 157 - 175) so that the code coverage can reach the threshold of 73% |
- Added test for when GetFullChangesAsync fails (no changes available case) - Added test for when no train connections match the destination station - Coverage increased from previous level to 86.87% line coverage (well above 73% threshold) - All 42 tests passing Co-authored-by: abeckDev <[email protected]>
Added in commit ed1a02c. Created two new test cases:
Code coverage now at 86.87% line coverage, exceeding the 73% threshold. All 42 tests passing. |
Train Connection Assessment Tool Implementation ✅
Successfully implemented a comprehensive MCP server tool to assess and find train connections between stations.
✅ Completed Tasks
FindTrainConnectionsMCP tool interface📊 Changes Summary
Files Modified: 6
Total Tests: 42 (all passing)
Code Coverage: 86.87% line coverage (exceeds 73% threshold)
🎯 Key Features
🔒 Security Summary
CodeQL analysis completed successfully with 0 alerts found. All code changes passed security validation.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.