toggl_stop_timer
Stop the currently running Toggl timer to accurately track time spent on tasks and maintain precise time records for reporting.
Instructions
Stop the currently running timer
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:520-550 (handler)Handler logic for the 'toggl_stop_timer' tool. Retrieves current running entry, stops it using TogglAPI, hydrates with project/workspace names from cache, and returns formatted response.case 'toggl_stop_timer': { const current = await api.getCurrentTimeEntry(); if (!current) { return { content: [{ type: 'text', text: JSON.stringify({ success: false, message: 'No timer currently running' }) }] }; } const stopped = await api.stopTimer(current.workspace_id, current.id); await ensureCache(); const hydrated = await cache.hydrateTimeEntries([stopped]); return { content: [{ type: 'text', text: JSON.stringify({ success: true, message: 'Timer stopped', entry: hydrated[0] }, null, 2) }] }; }
- src/index.ts:218-226 (schema)Schema definition for 'toggl_stop_timer' tool, registered in the tools list for MCP ListTools request. No input parameters required.{ name: 'toggl_stop_timer', description: 'Stop the currently running timer', inputSchema: { type: 'object', properties: {}, required: [] }, },
- src/toggl-api.ts:221-224 (helper)Supporting utility in TogglAPI class: stops a timer by updating the time entry with the current timestamp via the Toggl API.async stopTimer(workspaceId: number, timeEntryId: number): Promise<TimeEntry> { const now = new Date().toISOString(); return this.updateTimeEntry(workspaceId, timeEntryId, { stop: now }); }
- src/index.ts:386-388 (registration)Registers the ListToolsRequestHandler which returns the tools array containing 'toggl_stop_timer'.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools }; });