Skip to main content
Glama

get_time_entries

Retrieve time entries from Clockify with filters for workspace, date range, projects, tasks, tags, and status to track work hours and analyze time usage.

Instructions

Get time entries for a user

Input Schema

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

Implementation Reference

  • The main handler function for the 'get_time_entries' tool. It constructs the API endpoint for fetching time entries from Clockify, handles query parameters for filtering, calls the makeRequest method, and formats the response as MCP content.
    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, }; }
  • Input schema definition for the 'get_time_entries' tool, specifying parameters like workspaceId (required), userId, date filters, project/task/tag filters, pagination, etc.
    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)
    Registration of the 'get_time_entries' handler in the CallToolRequestSchema switch statement, validating workspaceId and delegating to the getTimeEntries method.
    case "get_time_entries": if (!args?.workspaceId) throw new McpError(ErrorCode.InvalidParams, 'workspaceId is required'); return await this.getTimeEntries(args as any);
  • TypeScript interface defining the structure of a TimeEntry object, used in the context of time entry tools.
    interface TimeEntry { id?: string; description?: string; start: string; end?: string; projectId?: string; taskId?: string; tagIds?: string[]; billable?: boolean; }
  • src/index.ts:281-323 (registration)
    Tool registration in the ListToolsRequestSchema response, including name, description, and inputSchema for 'get_time_entries'.
    // Time Entry Management { 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"], }, }, { 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"], },

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