Skip to main content
Glama

create_time_entry

Log work hours in Clockify by creating time entries with start times, descriptions, and optional project, task, or tag assignments.

Instructions

Create a new time entry

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workspaceIdYesWorkspace ID
descriptionNoTime entry description
startYesStart time (ISO 8601 format)
endNoEnd time (ISO 8601 format, optional for ongoing entries)
projectIdNoProject ID (optional)
taskIdNoTask ID (optional)
tagIdsNoArray of tag IDs (optional)
billableNoWhether the entry is billable (optional)

Implementation Reference

  • The core handler function that processes input arguments, formats dates to ISO 8601, makes a POST request to Clockify's /workspaces/{workspaceId}/time-entries API endpoint to create the time entry, and returns a formatted success message with entry details.
    private async createTimeEntry(args: any) { const { workspaceId, ...timeEntryData } = args; // Ensure start time is in ISO format if (!timeEntryData.start.includes("T")) { timeEntryData.start = new Date(timeEntryData.start).toISOString(); } // If end time is provided, ensure it's in ISO format if (timeEntryData.end && !timeEntryData.end.includes("T")) { timeEntryData.end = new Date(timeEntryData.end).toISOString(); } const timeEntry = await this.makeRequest( `/workspaces/${workspaceId}/time-entries`, "POST", timeEntryData ); return { content: [ { type: "text", text: `Time entry created successfully!\nID: ${timeEntry.id}\nDescription: ${timeEntry.description || "No description"}\nStart: ${timeEntry.timeInterval.start}\nEnd: ${timeEntry.timeInterval.end || "Ongoing"}`, }, ], isError: false, }; }
  • src/index.ts:283-299 (registration)
    Registers the create_time_entry tool in the ListToolsRequestSchema response, including its description and detailed inputSchema for validation.
    name: "create_time_entry", description: "Create a new time entry", inputSchema: { type: "object", properties: { workspaceId: { type: "string", description: "Workspace ID" }, description: { type: "string", description: "Time entry description" }, start: { type: "string", description: "Start time (ISO 8601 format)" }, end: { type: "string", description: "End time (ISO 8601 format, optional for ongoing entries)" }, projectId: { type: "string", description: "Project ID (optional)" }, taskId: { type: "string", description: "Task ID (optional)" }, tagIds: { type: "array", items: { type: "string" }, description: "Array of tag IDs (optional)" }, billable: { type: "boolean", description: "Whether the entry is billable (optional)" }, }, required: ["workspaceId", "start"], }, },
  • src/index.ts:731-733 (registration)
    In the CallToolRequestSchema handler's switch statement, maps incoming create_time_entry calls to the createTimeEntry method, with basic param validation.
    case "create_time_entry": if (!args?.workspaceId) throw new McpError(ErrorCode.InvalidParams, 'workspaceId is required'); return await this.createTimeEntry(args as any);
  • TypeScript interface defining the TimeEntry structure, which aligns with the tool's input schema properties.
    interface TimeEntry { id?: string; description?: string; start: string; end?: string; projectId?: string; taskId?: string; tagIds?: string[]; billable?: boolean; }

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/ratheesh-aot/clockify-mcp'

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