Skip to main content
Glama
ratheesh-aot

Clockify MCP Server

by ratheesh-aot

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"],
      },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure but only states the basic action. It doesn't cover critical aspects like pagination behavior (implied by 'page' and 'pageSize' parameters), authentication needs, rate limits, or what 'hydrated' data includes, making it insufficient for a mutation-free tool with many parameters.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste. It's appropriately sized and front-loaded, directly stating the tool's purpose without unnecessary elaboration, earning full marks for conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (15 parameters, no output schema, and no annotations), the description is incomplete. It lacks details on return format, error handling, or behavioral traits like pagination, which are crucial for an agent to use this tool effectively in a real-world context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, providing detailed parameter documentation. The description adds no additional parameter semantics beyond the schema, such as explaining filter interactions or default behaviors. This meets the baseline of 3 since the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Get') and resource ('time entries for a user'), making the purpose understandable. However, it doesn't differentiate from sibling tools like 'get_detailed_report' or 'get_summary_report' that also retrieve time-related data, which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention siblings like 'get_detailed_report' for aggregated data or 'get_summary_report' for summaries, nor does it specify prerequisites or exclusions, leaving the agent without usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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

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