Skip to main content
Glama

addTimeEntry

Log work hours to a Clockify project by specifying start time, end time, and task description for accurate time tracking.

Instructions

Add a time entry to a project.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesClockify project ID
descriptionYesDescription of the time entry
startYesStart time (ISO8601)
endYesEnd time (ISO8601)

Implementation Reference

  • The switch case implementing the 'addTimeEntry' tool handler. Validates input parameters (projectId, description, start, end), constructs the time entry body, and POSTs it to the Clockify API endpoint for the user's workspace.
    case "addTimeEntry": {
      const { projectId, description, start, end } =
        request.params.arguments || {};
      if (!projectId || !description || !start || !end) {
        throw new Error("projectId, description, start, and end are required");
      }
      const body = {
        start,
        end,
        description,
        projectId,
      };
      const entry = await clockifyFetch(
        `/workspaces/${workspaceId}/time-entries`,
        {
          method: "POST",
          body: JSON.stringify(body),
        },
      );
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(entry, null, 2),
          },
        ],
      };
    }
  • The tool definition in listToolsHandler, including name, description, and inputSchema for 'addTimeEntry'.
    {
      name: "addTimeEntry",
      description: "Add a time entry to a project.",
      inputSchema: {
        type: "object",
        properties: {
          projectId: { type: "string", description: "Clockify project ID" },
          description: {
            type: "string",
            description: "Description of the time entry",
          },
          start: { type: "string", description: "Start time (ISO8601)" },
          end: { type: "string", description: "End time (ISO8601)" },
        },
        required: ["projectId", "description", "start", "end"],
      },
    },
  • src/index.ts:43-49 (registration)
    Registers the request handlers for listing tools (listToolsHandler, which includes addTimeEntry) and calling tools (callToolHandler, which dispatches to addTimeEntry implementation).
    server.setRequestHandler(ListToolsRequestSchema, listToolsHandler);
    
    /**
     * Handler for the create_note tool.
     * Creates a new note with the provided title and content, and returns success message.
     */
    server.setRequestHandler(CallToolRequestSchema, callToolHandler);
  • Helper function clockifyFetch used by the addTimeEntry handler to make authenticated POST request to Clockify API.
    async function clockifyFetch(endpoint: string, options: RequestInit = {}) {
      const apiKey = getApiKey();
      const baseUrl = "https://api.clockify.me/api/v1";
      const url = endpoint.startsWith("http") ? endpoint : `${baseUrl}${endpoint}`;
      const headers = {
        "X-Api-Key": apiKey,
        "Content-Type": "application/json",
        ...(options.headers || {}),
      };
      const response = await fetch(url, { ...options, headers });
    
      if (!response.ok) {
        const text = await response.text();
        console.error(
          `[Error] Clockify API ${url} failed: ${response.status} ${text}`,
        );
        throw new Error(`Clockify API error: ${response.status} ${text}`);
      }
      return response.json();
    }
  • Helper function to retrieve the Clockify API key from environment, used by clockifyFetch.
    function getApiKey(): string {
      const apiKey = process.env.CLOCKIFY_API_KEY;
      if (!apiKey) {
        throw new Error("CLOCKIFY_API_KEY is not set in MCP config.");
      }
      return apiKey;
    }
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. While 'Add' implies a write operation, the description doesn't disclose whether this requires authentication, what permissions are needed, whether the operation is idempotent, what happens on failure, or what the response contains. For a mutation tool with zero annotation coverage, this represents significant gaps in behavioral transparency.

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 extremely concise at just one sentence with no wasted words. It's front-loaded with the core action and resource, making it immediately scannable. Every word earns its place, and there's no redundancy or unnecessary elaboration. This represents optimal conciseness for a basic tool description.

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 this is a mutation tool with no annotations and no output schema, the description is insufficiently complete. It doesn't address what happens after the time entry is added, what the return value might be, error conditions, authentication requirements, or how this tool relates to the sibling retrieval tools. For a tool that presumably modifies data in a time tracking system, more contextual information would be expected.

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?

With 100% schema description coverage, the input schema already documents all four parameters thoroughly. The description adds no additional semantic context about the parameters beyond what's in the schema. It doesn't explain relationships between parameters (e.g., that 'end' should be after 'start'), format expectations beyond ISO8601, or constraints on values. The baseline score of 3 reflects adequate but minimal value addition.

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 action ('Add') and resource ('time entry to a project'), making the purpose immediately understandable. It distinguishes from sibling tools like getTimeEntries or listProjects by focusing on creation rather than retrieval. However, it doesn't specify what constitutes a 'time entry' in this context, leaving some ambiguity about the resource being manipulated.

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. With sibling tools like getTimeEntries and getUserTimeEntries that retrieve time entries, there's no indication whether this tool should be used for creating new entries versus updating existing ones, or what prerequisites might be needed. The description offers no context about appropriate use cases or limitations.

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

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