activity_log
Review recent changes by filtering entity type, action, or date. Track progress and see what happened since your last session.
Instructions
View the activity log showing what changed and when. Useful for understanding recent progress or reviewing what happened since the last session.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| entity_type | No | Filter by entity type | |
| entity_id | No | Filter by specific entity | |
| action | No | Filter by action type | |
| since | No | ISO 8601 datetime - show only activity after this time | |
| limit | No |
Implementation Reference
- src/tools/activity.ts:70-103 (handler)The main handler function for the activity_log tool. Queries the activity_log table with optional filters (entity_type, entity_id, action, since) and returns results ordered by created_at DESC.
function handleActivityLog(args: Record<string, unknown>) { const db = getDb(); const entityType = args.entity_type as string | undefined; const entityId = args.entity_id as number | undefined; const action = args.action as string | undefined; const since = args.since as string | undefined; const limit = (args.limit as number) ?? 50; const whereClauses: string[] = []; const params: unknown[] = []; if (entityType) { whereClauses.push('entity_type = ?'); params.push(entityType); } if (entityId !== undefined) { whereClauses.push('entity_id = ?'); params.push(entityId); } if (action) { whereClauses.push('action = ?'); params.push(action); } if (since) { whereClauses.push('created_at > ?'); params.push(since); } const whereStr = whereClauses.length > 0 ? `WHERE ${whereClauses.join(' AND ')}` : ''; const sql = `SELECT * FROM activity_log ${whereStr} ORDER BY created_at DESC LIMIT ?`; params.push(limit); return db.prepare(sql).all(...params); } - src/tools/activity.ts:14-30 (schema)Input schema for the activity_log tool defining optional filters: entity_type (enum), entity_id (integer), action (enum), since (ISO 8601 string), and limit (integer, default 50).
type: 'object', properties: { entity_type: { type: 'string', enum: ['project', 'epic', 'task', 'subtask', 'note'], description: 'Filter by entity type', }, entity_id: { type: 'integer', description: 'Filter by specific entity' }, action: { type: 'string', enum: ['created', 'updated', 'deleted', 'status_changed'], description: 'Filter by action type', }, since: { type: 'string', description: 'ISO 8601 datetime - show only activity after this time' }, limit: { type: 'integer', default: 50 }, }, }, - src/tools/activity.ts:241-245 (registration)Handler registry mapping 'activity_log' string to the handleActivityLog function.
export const handlers: Record<string, ToolHandler> = { activity_log: handleActivityLog, tracker_session_diff: handleSessionDiff, task_batch_update: handleTaskBatchUpdate, }; - src/index.ts:37-49 (registration)Top-level handler registration spreading activityHandlers (which includes activity_log) into the ALL_HANDLERS map.
const ALL_HANDLERS: Record<string, (args: Record<string, unknown>) => unknown> = { ...projectHandlers, ...epicHandlers, ...taskHandlers, ...subtaskHandlers, ...noteHandlers, ...commentHandlers, ...templateHandlers, ...dashboardHandlers, ...searchHandlers, ...activityHandlers, ...exportImportHandlers, }; - src/helpers/activity-logger.ts:3-17 (helper)Helper function that inserts a row into the activity_log table. Used by other tools (tasks, projects, epics, etc.) to log changes.
export function logActivity( db: Database.Database, entityType: string, entityId: number, action: string, fieldName: string | null, oldValue: string | null, newValue: string | null, summary: string ): void { db.prepare( `INSERT INTO activity_log (entity_type, entity_id, action, field_name, old_value, new_value, summary) VALUES (?, ?, ?, ?, ?, ?, ?)` ).run(entityType, entityId, action, fieldName, oldValue, newValue, summary); }