Skip to main content
Glama

toggl_get_time_entries

Retrieve time entries from Toggl Track with date range, workspace, or project filters to track and analyze logged work hours.

Instructions

Get time entries with optional date range filters. Returns hydrated entries with project/workspace names.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
end_dateNoEnd date (YYYY-MM-DD format)
periodNoPredefined period to fetch entries for
project_idNoFilter by project ID
start_dateNoStart date (YYYY-MM-DD format)
workspace_idNoFilter by workspace ID

Implementation Reference

  • Main handler logic for the 'toggl_get_time_entries' tool. Computes date range from parameters, fetches entries via TogglAPI, applies optional filters for workspace and project, hydrates with project/workspace names using cache, and returns formatted JSON response.
    case 'toggl_get_time_entries': { await ensureCache(); let entries: TimeEntry[]; if (args?.period) { const range = getDateRange(args.period as any); entries = await api.getTimeEntriesForDateRange(range.start, range.end); } else if (args?.start_date || args?.end_date) { const start = args?.start_date ? new Date(args.start_date as string) : new Date(); const end = args?.end_date ? new Date(args.end_date as string) : new Date(); entries = await api.getTimeEntriesForDateRange(start, end); } else { entries = await api.getTimeEntriesForToday(); } // Filter by workspace/project if specified if (args?.workspace_id) { entries = entries.filter(e => e.workspace_id === args.workspace_id); } if (args?.project_id) { entries = entries.filter(e => e.project_id === args.project_id); } // Hydrate with names const hydrated = await cache.hydrateTimeEntries(entries); return { content: [{ type: 'text', text: JSON.stringify({ count: hydrated.length, entries: hydrated }, null, 2) }] }; }
  • Schema definition for the 'toggl_get_time_entries' tool, including name, description, and input schema with optional parameters for period, dates, workspace, and project filters.
    { name: 'toggl_get_time_entries', description: 'Get time entries with optional date range filters. Returns hydrated entries with project/workspace names.', inputSchema: { type: 'object', properties: { period: { type: 'string', enum: ['today', 'yesterday', 'week', 'lastWeek', 'month', 'lastMonth'], description: 'Predefined period to fetch entries for' }, start_date: { type: 'string', description: 'Start date (YYYY-MM-DD format)' }, end_date: { type: 'string', description: 'End date (YYYY-MM-DD format)' }, workspace_id: { type: 'number', description: 'Filter by workspace ID' }, project_id: { type: 'number', description: 'Filter by project ID' } } }, },
  • src/index.ts:386-388 (registration)
    Registers the list of tools including 'toggl_get_time_entries' for the ListToolsRequestSchema handler.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools }; });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/verygoodplugins/mcp-toggl'

If you have feedback or need assistance with the MCP directory API, please join our Discord server