feat(mcp): expose entry info and time balance to agents (ADR-021 Phase 5)#570
Conversation
Add two read tools mirroring what the tracking UI shows for a booking: - get_ticket_info (reporting:read): the per-scope totals from the entry "Info" (I) popup — customer/project/activity/ticket own+total minutes plus the project estimate, with a near/over status and warnings. - get_time_balance (reporting:read): today/week/month IST vs SOLL (total and so-far), the diff, and a behind/over status with warnings. log_time now returns that same context inline after a successful booking (ticket_info + balance), so an agent sees limits reached/exceeded/underrun without a second call. Both surfaces are thin wrappers over the new EntrySummaryService and TimeBalanceService (ADR-021 Phase 5). Signed-off-by: Sebastian Mendel <info@sebastianmendel.de>
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
There was a problem hiding this comment.
Pull request overview
This PR expands the MCP toolset so agents can access the same “after-booking” context shown in the tracking UI: per-scope ticket aggregation (“Info” popup) and the user’s IST-vs-SOLL time balance, both as dedicated read tools and (for convenience) inline after log_time.
Changes:
- Added MCP read tools
get_ticket_infoandget_time_balance(bothreporting:read) backed by new thin servicesEntrySummaryServiceandTimeBalanceService. - Enriched
log_timeresponses withticket_infoandbalanceto avoid a second agent round-trip after booking. - Extended MCP tool tests and updated ADR-021 documentation to reflect the Phase 5 toolset.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/Mcp/McpToolsTest.php | Adds coverage for the new read tools and verifies log_time enrichment. |
| src/Service/TimeBalanceService.php | New service computing today/week/month IST vs SOLL totals/so-far, diff, status, and warnings. |
| src/Service/EntrySummaryService.php | New service wrapping EntryRepository::getEntrySummary() and adding estimate status + warnings. |
| src/Mcp/Tool/LogTimeTool.php | Enriches log_time output with ticket_info and balance. |
| src/Mcp/Tool/GetTimeBalanceTool.php | New MCP tool exposing time-balance data via TimeBalanceService. |
| src/Mcp/Tool/GetTicketInfoTool.php | New MCP tool exposing per-entry “Info” aggregation via EntrySummaryService. |
| docs/adr/ADR-021-api-token-authentication.md | Documents the new tools and the log_time “info-on-write” enrichment. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #570 +/- ##
============================================
- Coverage 83.22% 82.14% -1.08%
- Complexity 3337 3378 +41
============================================
Files 237 241 +4
Lines 9091 9210 +119
============================================
Hits 7566 7566
- Misses 1525 1644 +119
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
getEntrySummary aggregates customer/project/activity/ticket totals across all users, so returning a summary for an entry the caller does not own would disclose other users' scope names and totals. Treat "not owned by the authenticated user" as "not found" in EntrySummaryService::forEntry. Signed-off-by: Sebastian Mendel <info@sebastianmendel.de>
|



Gives MCP agents the same booking context a user sees in the tracking UI, both inline after a write and as dedicated read tools.
Tools
reporting:read) — the per-scope totals from an entry’s "Info" (I) popup: customer / project / activity / ticket, each with the user’s own booked minutes and everyone’s total, plus the project estimate. Adds anear/overstatus andwarnings.reporting:read) — today / week / month IST vs SOLL (both whole-period and "so far"), the diff, and abehind/overstatus withwarnings.log_time enrichment
After a successful booking,
log_timenow returns:ticket_info— the same aggregation asget_ticket_infofor the created entrybalance— the same data asget_time_balanceso an agent sees an estimate or time target being neared / exceeded / underrun without a second round-trip.
Both tools are thin wrappers over two new services —
EntrySummaryService(wrapsEntryRepository::getEntrySummary) andTimeBalanceService(IST fromEntryRepository::getWorkByUser, SOLL fromExpectedWorkTimeCalculatorover the user’s contracts minus public holidays). No business logic is reimplemented.Tests
tests/Mcp/McpToolsTest.php: happy path + scope-denied for each new tool, an unknown-entry error path, and thatlog_timereturnsticket_info+balance.Docs: ADR-021 Phase 5 toolset section updated.