Add JSON MCP tools for richer usage queries#70
Conversation
|
/prerelease |
|
/prerelease |
|
Prerelease |
|
Hi @rowesk, thanks again for digging into the MCP usage data here. Could you help me understand the concrete use case for the new JSON tools, specifically why an AI agent would need the data in this format? I ask because #69 already adds CSV/plain-text export through MCP, which seems aligned with lower token usage and should still be easy for AI clients to parse. For the kind of user questions I have in mind, such as summarizing activity or finding top apps/sites, CSV seems to provide the same underlying information with less MCP/API surface area. Is there a specific workflow or AI client behavior where CSV/plain text is not enough and structured JSON materially helps? |
|
Also tagging @xverges here since you mentioned in #3 that having this available without UI interaction, via CLI or MCP, would be useful. If you have a concrete workflow in mind, I would be interested in your opinion too: would CSV/plain-text MCP output from #69 cover your use case, or would the JSON tools proposed here make something materially easier? |
|
I think the distinction is that #69 is a great export feature, while this PR is more about making SimplyTrack queryable as a local activity API for agents. CSV/plain text works well when I want to export a day/week of completed sessions and then analyse it elsewhere. But for agent workflows, the useful pattern is often smaller/more targeted:
A few concrete places where JSON should help materially:
So I’d frame the use cases as:
I do understand the concern about MCP/API surface area. If you’d prefer fewer tools, I’d be happy to simplify the shape. For example, we could consolidate around a smaller set like:
and potentially fold daily/hourly summaries into parameters rather than separate tools. But I do think structured JSON is still worth having for the agent use case. It is less about replacing CSV export and more about avoiding “export a big file, then parse it” as the default interaction model for agents. |
|
Thanks, I understand the query use cases better now. The part I am still trying to pin down is the JSON-specific need. Most examples seem to require query semantics, not necessarily JSON; active/current sessions, arbitrary ranges, clipping and optional aggregation. Those could also be returned as compact CSV/plain text. Is the concrete use case that you want to pipe this into One more point on current/live activity; I am not sure it is as useful in a normal interactive agent workflow as it first sounds. From the current tracking lifecycle, app sessions are ended when the active app changes and website sessions are ended when the detected domain changes or no website is detected. So if the user switches to Claude Desktop, ChatGPT, Cursor or another MCP client to ask "what am I doing right now?", the active SimplyTrack session is likely to become that AI client itself. That makes |
Summary
get_usage_rangeget_raw_sessionsget_current_activityget_hourly_timelineget_daily_summaryget_usage_activitytool available for backwards compatibility.SimplyTrackMCPand the main app.UsageAggregatorwith reusable APIs for clipped session ranges, grouped summaries, current activity, daily summaries, and hourly buckets.Why
The existing MCP integration is useful, but it only exposes a compact pipe-separated daily summary. That works for quick display, but it is awkward for AI clients and automation because callers have to parse human-oriented text and cannot ask more targeted questions.
These additions make the local MCP integration more useful while preserving the current behavior:
Testing
xcodebuild -project SimplyTrack.xcodeproj -scheme SimplyTrackMCP -configuration Debug CODE_SIGNING_ALLOWED=NO buildxcodebuild -project SimplyTrack.xcodeproj -scheme SimplyTrack -configuration Debug -skip-testing:SimplyTrackUITests CODE_SIGNING_ALLOWED=NO testgit diff --checktools/listexposes all six tools.tools/callworks for each tool.[1, 2, 3, 4, 5, 6, 7].Verified tools:
get_usage_activityget_usage_rangeget_raw_sessionsget_current_activityget_hourly_timelineget_daily_summaryNotes
get_usage_activityintentionally remains unchanged for existing clients.