Skip to main content
Glama

get_time_entries

Retrieve time entries for a user in Clockify by applying filters such as date range, project, task, tags, or running status. Manage and organize time tracking data efficiently using workspace and user IDs.

Instructions

Get time entries for a user

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
consideredRunningNoInclude running time entries
descriptionNoFilter by description
endNoEnd date filter (ISO 8601)
hydratedNoInclude additional data
inProgressNoFilter by running status
pageNoPage number (default: 1)
pageSizeNoPage size (default: 50, max: 5000)
projectNoFilter by project ID
projectRequiredNoFilter entries that require project
startNoStart date filter (ISO 8601)
tagsNoFilter by tag IDs (comma-separated)
taskNoFilter by task ID
taskRequiredNoFilter entries that require task
userIdNoUser ID (optional, defaults to current user)
workspaceIdYesWorkspace ID

Implementation Reference

  • The core handler function implementing the get_time_entries tool logic. It constructs the Clockify API endpoint based on whether userId is provided, appends filter parameters as query string, fetches time entries, and returns a formatted text list of entries.
    private async getTimeEntries(args: any) { const { workspaceId, userId, ...params } = args; // Build query parameters const queryParams = new URLSearchParams(); Object.entries(params).forEach(([key, value]) => { if (value !== undefined && value !== null) { queryParams.append(key, String(value)); } }); const endpoint = userId ? `/workspaces/${workspaceId}/user/${userId}/time-entries` : `/workspaces/${workspaceId}/time-entries`; const fullEndpoint = queryParams.toString() ? `${endpoint}?${queryParams.toString()}` : endpoint; const timeEntries = await this.makeRequest(fullEndpoint); return { content: [ { type: "text", text: `Found ${timeEntries.length} time entries:\n${timeEntries .map((entry: any) => `- ${entry.description || "No description"} | ${entry.timeInterval.start} - ${entry.timeInterval.end || "Ongoing"} | ${entry.timeInterval.duration || "Running"}` ) .join("\n")}`, }, ], isError: false, }; }
  • JSON Schema defining the input parameters for the get_time_entries tool, specifying types, descriptions, and required fields like workspaceId.
    inputSchema: { type: "object", properties: { workspaceId: { type: "string", description: "Workspace ID" }, userId: { type: "string", description: "User ID (optional, defaults to current user)" }, description: { type: "string", description: "Filter by description" }, start: { type: "string", description: "Start date filter (ISO 8601)" }, end: { type: "string", description: "End date filter (ISO 8601)" }, project: { type: "string", description: "Filter by project ID" }, task: { type: "string", description: "Filter by task ID" }, tags: { type: "string", description: "Filter by tag IDs (comma-separated)" }, projectRequired: { type: "boolean", description: "Filter entries that require project" }, taskRequired: { type: "boolean", description: "Filter entries that require task" }, consideredRunning: { type: "boolean", description: "Include running time entries" }, hydrated: { type: "boolean", description: "Include additional data" }, inProgress: { type: "boolean", description: "Filter by running status" }, page: { type: "number", description: "Page number (default: 1)" }, pageSize: { type: "number", description: "Page size (default: 50, max: 5000)" }, }, required: ["workspaceId"],
  • src/index.ts:301-323 (registration)
    Registration of the get_time_entries tool in the ListTools response, including name, description, and full input schema.
    name: "get_time_entries", description: "Get time entries for a user", inputSchema: { type: "object", properties: { workspaceId: { type: "string", description: "Workspace ID" }, userId: { type: "string", description: "User ID (optional, defaults to current user)" }, description: { type: "string", description: "Filter by description" }, start: { type: "string", description: "Start date filter (ISO 8601)" }, end: { type: "string", description: "End date filter (ISO 8601)" }, project: { type: "string", description: "Filter by project ID" }, task: { type: "string", description: "Filter by task ID" }, tags: { type: "string", description: "Filter by tag IDs (comma-separated)" }, projectRequired: { type: "boolean", description: "Filter entries that require project" }, taskRequired: { type: "boolean", description: "Filter entries that require task" }, consideredRunning: { type: "boolean", description: "Include running time entries" }, hydrated: { type: "boolean", description: "Include additional data" }, inProgress: { type: "boolean", description: "Filter by running status" }, page: { type: "number", description: "Page number (default: 1)" }, pageSize: { type: "number", description: "Page size (default: 50, max: 5000)" }, }, required: ["workspaceId"], },
  • src/index.ts:734-736 (registration)
    Dispatch logic in the CallToolRequestSchema handler that validates input and invokes the getTimeEntries handler method.
    case "get_time_entries": if (!args?.workspaceId) throw new McpError(ErrorCode.InvalidParams, 'workspaceId is required'); return await this.getTimeEntries(args as any);

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