toggl_get_current_entry
Retrieve the currently active time entry from Toggl Track to monitor ongoing work sessions or check timer status.
Instructions
Get the currently running time entry, if any
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:462-489 (handler)Handler logic for the 'toggl_get_current_entry' tool: fetches the current running time entry using the TogglAPI, hydrates it with project/workspace names from cache, and returns a JSON response indicating if a timer is running and entry details.case 'toggl_get_current_entry': { const entry = await api.getCurrentTimeEntry(); if (!entry) { return { content: [{ type: 'text', text: JSON.stringify({ running: false, message: 'No timer currently running' }) }] }; } await ensureCache(); const hydrated = await cache.hydrateTimeEntries([entry]); return { content: [{ type: 'text', text: JSON.stringify({ running: true, entry: hydrated[0] }, null, 2) }] }; }
- src/index.ts:179-187 (schema)Schema definition for the tool, including name, description, and empty input schema (no parameters required). This is part of the tools array used for MCP tool listing.{ name: 'toggl_get_current_entry', description: 'Get the currently running time entry, if any', inputSchema: { type: 'object', properties: {}, required: [] }, },
- src/toggl-api.ts:180-183 (helper)Supporting method in TogglAPI class that makes the HTTP request to Toggl Track API endpoint '/me/time_entries/current' to retrieve the currently running time entry.async getCurrentTimeEntry(): Promise<TimeEntry | null> { const result = await this.request<TimeEntry | null>('GET', '/me/time_entries/current'); return result; }
- src/index.ts:386-388 (registration)Registration of the tools list handler for MCP ListToolsRequestSchema, which returns the array of tools including 'toggl_get_current_entry'.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools }; });