Skip to main content
Glama

get-tasks-by-day

Retrieve tasks scheduled for a specific date from Sunsama, with options to filter by completion status to focus on pending or finished work.

Instructions

Get tasks for a specific day with optional filtering by completion status

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
completionFilterNoFilter tasks by completion status. 'all' returns all tasks, 'incomplete' returns only incomplete tasks, 'completed' returns only completed tasks. Defaults to 'all'
dayYes
timezoneNoTimezone string (e.g., 'America/New_York'). If not provided, uses user's default timezone

Implementation Reference

  • The primary handler for the 'get-tasks-by-day' tool. Fetches tasks for a given day (resolving timezone if needed), applies completion filtering, trims response data, and formats as TSV.
    export const getTasksByDayTool = withTransportClient({ name: "get-tasks-by-day", description: "Get tasks for a specific day with optional filtering by completion status", parameters: getTasksByDaySchema, execute: async ( { day, timezone, completionFilter = "all" }: GetTasksByDayInput, context: ToolContext, ) => { // If no timezone provided, get the user's default timezone let resolvedTimezone = timezone; if (!resolvedTimezone) { resolvedTimezone = await context.client.getUserTimezone(); } const tasks = await context.client.getTasksByDay(day, resolvedTimezone); const filteredTasks = filterTasksByCompletion(tasks, completionFilter); const trimmedTasks = trimTasksForResponse(filteredTasks); return formatTsvResponse(trimmedTasks); }, });
  • Zod input schema validating parameters for get-tasks-by-day: required 'day' (YYYY-MM-DD), optional 'timezone', optional 'completionFilter'.
    export const getTasksByDaySchema = z.object({ day: z.string().regex( /^\d{4}-\d{2}-\d{2}$/, "Day must be in YYYY-MM-DD format", ), timezone: z.string().optional().describe( "Timezone string (e.g., 'America/New_York'). If not provided, uses user's default timezone", ), completionFilter: completionFilterSchema.optional().describe( "Filter tasks by completion status. 'all' returns all tasks, 'incomplete' returns only incomplete tasks, 'completed' returns only completed tasks. Defaults to 'all'", ), });
  • src/main.ts:33-44 (registration)
    Final MCP server registration of all tools (including get-tasks-by-day) by iterating allTools and calling server.registerTool with name, schema, and execute function.
    allTools.forEach((tool) => { server.registerTool( tool.name, { description: tool.description, inputSchema: "shape" in tool.parameters ? tool.parameters.shape : tool.parameters, }, tool.execute, ); });
  • Local registration of getTasksByDayTool within the taskTools array, which is later spread into allTools.
    export const taskTools = [ // Query tools getTasksBacklogTool, getTasksByDayTool,
  • Helper function used in the handler to filter fetched tasks by completion status (all, incomplete, completed).
    export function filterTasksByCompletion(tasks: Task[], filter: CompletionFilter): Task[] { // Validate filter parameter if (!["all", "incomplete", "completed"].includes(filter)) { throw new Error(`Invalid completion filter: ${filter}. Must be 'all', 'incomplete', or 'completed'.`); } switch (filter) { case "all": return tasks; // No filtering - return all tasks case "incomplete": return tasks.filter(task => !task.completed); case "completed": return tasks.filter(task => task.completed); default: // TypeScript exhaustiveness check - should never reach here throw new Error(`Unhandled completion filter: ${filter satisfies never}`); } }

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/robertn702/mcp-sunsama'

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