Skip to main content
Glama

toggl_daily_report

Generate a daily report showing hours worked by project and workspace from Toggl Track data. Specify a date and output format to track time allocation.

Instructions

Generate a daily report with hours by project and workspace

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dateNoDate for report (YYYY-MM-DD format, defaults to today)
formatNoOutput format (default: json)

Implementation Reference

  • Main handler logic for the 'toggl_daily_report' tool. Fetches time entries for the given date using TogglAPI, hydrates them with project/workspace names using CacheManager, generates the structured report using the generateDailyReport helper from utils.ts, and returns either JSON or formatted text output.
    case 'toggl_daily_report': { await ensureCache(); const date = args?.date ? new Date(args.date as string) : new Date(); const nextDay = new Date(date); nextDay.setDate(nextDay.getDate() + 1); const entries = await api.getTimeEntriesForDateRange(date, nextDay); const hydrated = await cache.hydrateTimeEntries(entries); const report = generateDailyReport(date.toISOString().split('T')[0], hydrated); if (args?.format === 'text') { return { content: [{ type: 'text', text: formatReportForDisplay(report) }] }; } return { content: [{ type: 'text', text: JSON.stringify(report, null, 2) }] }; }
  • src/index.ts:229-246 (registration)
    Tool registration in the tools list, including name, description, and input schema. This array is returned by the ListToolsRequestHandler.
    { name: 'toggl_daily_report', description: 'Generate a daily report with hours by project and workspace', inputSchema: { type: 'object', properties: { date: { type: 'string', description: 'Date for report (YYYY-MM-DD format, defaults to today)' }, format: { type: 'string', enum: ['json', 'text'], description: 'Output format (default: json)' } } }, },
  • Input schema definition for validating tool arguments: optional date (YYYY-MM-DD) and format (json/text).
    { name: 'toggl_daily_report', description: 'Generate a daily report with hours by project and workspace', inputSchema: { type: 'object', properties: { date: { type: 'string', description: 'Date for report (YYYY-MM-DD format, defaults to today)' }, format: { type: 'string', enum: ['json', 'text'], description: 'Output format (default: json)' } } }, },
  • Core helper function that processes hydrated time entries to generate the DailyReport structure, including totals, individual entries, project summaries, and workspace summaries using other utilities like groupEntriesByProject, calculateTotalDuration, etc.
    export function generateDailyReport(date: string, entries: HydratedTimeEntry[]): DailyReport { const totalSeconds = calculateTotalDuration(entries); const reportEntries = entries.map(createReportEntry); // Group by project const byProject = groupEntriesByProject(entries); const projectSummaries: ProjectSummary[] = []; byProject.forEach((projectEntries, projectName) => { projectSummaries.push(generateProjectSummary(projectName, projectEntries)); }); // Group by workspace const byWorkspace = groupEntriesByWorkspace(entries); const workspaceSummaries: WorkspaceSummary[] = []; byWorkspace.forEach((wsEntries, wsName) => { const wsId = wsEntries[0]?.workspace_id || 0; workspaceSummaries.push(generateWorkspaceSummary(wsName, wsId, wsEntries)); }); return { date, total_hours: secondsToHours(totalSeconds), total_seconds: totalSeconds, entries: reportEntries, by_project: projectSummaries, by_workspace: workspaceSummaries }; }

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