Skip to main content
Glama

toggl_daily_report

Generate daily time tracking reports by project and workspace with hours breakdown in JSON or text format for productivity analysis.

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 execution logic for the 'toggl_daily_report' tool. Fetches time entries for the given date (or today), hydrates with project/workspace names from cache, generates structured report using helper, and returns as JSON or formatted text.
    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) }] }; }
  • Tool metadata and input schema definition, including parameters for date and output format.
    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)' } } }, }, {
  • Generates the structured DailyReport from hydrated time entries, computing totals, transforming entries, and creating summaries grouped by project and workspace.
    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 }; }
  • src/index.ts:386-388 (registration)
    Registers the tool list (including toggl_daily_report) for the ListToolsRequestSchema, making it discoverable by MCP clients.
    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