Skip to content

Latest commit

 

History

History
78 lines (64 loc) · 2.83 KB

File metadata and controls

78 lines (64 loc) · 2.83 KB
name timing-local-mcp
description Query the Timing app's local SQLite database to retrieve time tracking data: app usage, window titles, durations, and project assignments. Uses three read-only MCP tools: list_timing_tables, get_timing_schema, and query_timing_db.
compatibility
required_tools
timing-local

Available tools

  • list_timing_tables() — lists all tables in the database
  • get_timing_schema(table_name) — returns column definitions for a table
  • query_timing_db(sql_query, limit) — executes a read-only SQL query; limit defaults to 200 rows, increase as needed for large date ranges

Key tables

  • AppActivity — core records: app, window title, start/end timestamps, project assignment
  • Application — app metadata: bundle ID, display name
  • Title — window title strings referenced by AppActivity
  • Project — Timing projects for categorising entries
  • TaskActivity — task-level time tracking

SQL conventions

Timestamps

All startDate and endDate fields in AppActivity are Unix timestamps (REAL). Always convert using:

datetime(startDate, 'unixepoch', 'localtime')

Deleted records

Always exclude soft-deleted entries:

WHERE aa.isDeleted = 0

Title column

The Title table uses stringValue for the window title string — not title.

Row limit

Pass a higher limit value when querying large date ranges to avoid truncated results.

Example queries

-- Time spent per app today
SELECT app.title AS app,
       ROUND(SUM(aa.endDate - aa.startDate) / 60.0, 1) AS minutes
FROM AppActivity aa
JOIN Application app ON aa.applicationID = app.id
WHERE aa.isDeleted = 0
  AND datetime(aa.startDate, 'unixepoch', 'localtime') >= date('now')
GROUP BY app.title
ORDER BY minutes DESC;
-- Activity log for a specific hour
SELECT datetime(aa.startDate, 'unixepoch', 'localtime') AS start,
       datetime(aa.endDate,   'unixepoch', 'localtime') AS end,
       app.title AS app,
       t.stringValue AS window
FROM AppActivity aa
JOIN Application app ON aa.applicationID = app.id
LEFT JOIN Title t ON aa.titleID = t.id
WHERE aa.isDeleted = 0
  AND datetime(aa.startDate, 'unixepoch', 'localtime') >= '2026-01-01 09:00:00'
  AND datetime(aa.startDate, 'unixepoch', 'localtime') <  '2026-01-01 10:00:00'
ORDER BY aa.startDate;

Approach

When the user asks about their time tracking data:

  1. If the question is exploratory (e.g. "what did I work on today?"), start with the time-per-app query and offer to drill down.
  2. If a specific app, project, or time range is mentioned, query directly with the appropriate filters.
  3. If the schema is unfamiliar, call get_timing_schema on the relevant table before querying.
  4. Always present results in a readable format — convert minutes to hours where appropriate, and summarise before listing raw rows.