Skip to main content
Glama

getUserTimeEntriesByName

Find and list time entries for a specific user by name with partial matching. Filter results by date range using optional start and end parameters.

Instructions

List time entries for a user by name (case-insensitive, partial match allowed). Optional: start, end (ISO8601).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
userNameYesUser name (partial/case-insensitive)
startNoStart date (ISO8601, optional)
endNoEnd date (ISO8601, optional)

Implementation Reference

  • Handler function for the 'getUserTimeEntriesByName' tool. It finds a user by partial, case-insensitive name match from the workspace users, then fetches their time entries for the optional start/end date range using the Clockify API.
    case "getUserTimeEntriesByName": {
      const { userName, start, end } = request.params.arguments || {};
      if (!userName || typeof userName !== "string") {
        throw new Error("userName is required");
      }
      // Fetch users
      const users = await clockifyFetch(`/workspaces/${workspaceId}/users`);
      // Define a type for user
      type User = { id: string; name: string };
      // Find user by name (case-insensitive, partial match)
      const userMatch = (users as User[]).find(
        (u) => u.name && u.name.toLowerCase().includes(userName.toLowerCase()),
      );
      if (!userMatch) {
        throw new Error(`No user found matching name: ${userName}`);
      }
      let url = `/workspaces/${workspaceId}/user/${userMatch.id}/time-entries`;
      const params = [];
      if (typeof start === "string" && start)
        params.push(`start=${encodeURIComponent(start)}`);
      if (typeof end === "string" && end)
        params.push(`end=${encodeURIComponent(end)}`);
      if (params.length) url += `?${params.join("&")}`;
      const entries = await clockifyFetch(url);
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(entries, null, 2),
          },
        ],
      };
    }
  • Input schema definition for the 'getUserTimeEntriesByName' tool, including parameters userName (required), start, end (optional).
    {
      name: "getUserTimeEntriesByName",
      description:
        "List time entries for a user by name (case-insensitive, partial match allowed). Optional: start, end (ISO8601).",
      inputSchema: {
        type: "object",
        properties: {
          userName: {
            type: "string",
            description: "User name (partial/case-insensitive)",
          },
          start: {
            type: "string",
            description: "Start date (ISO8601, optional)",
          },
          end: {
            type: "string",
            description: "End date (ISO8601, optional)",
          },
        },
        required: ["userName"],
      },
    },
  • src/index.ts:43-49 (registration)
    Registers the tool listing and calling handlers with the MCP server, which exposes and implements the 'getUserTimeEntriesByName' tool among others.
    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 to make authenticated API calls to Clockify, used by the tool handler to fetch users and time entries.
    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();
    }
Behavior3/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. It adds useful context about the matching behavior ('case-insensitive, partial match allowed') and date format ('ISO8601'), which aren't in the schema. However, it doesn't describe critical behaviors like pagination, rate limits, authentication needs, error conditions, or what the return format looks like (especially problematic since there's no output schema).

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 and front-loaded: the first clause states the core purpose, followed by key behavioral details and parameter notes. Every sentence earns its place with no wasted words. The structure efficiently communicates essential information in minimal space.

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 moderate complexity (filtered listing with partial matching), lack of annotations, and absence of an output schema, the description is incomplete. It doesn't explain what the return values look like (structure, fields, pagination), error conditions, or authentication requirements. While it covers the basic operation and parameters, critical context for proper tool invocation is missing.

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?

Schema description coverage is 100%, so the schema already documents all three parameters thoroughly. The description adds marginal value by reiterating that 'start' and 'end' are optional and specifying the ISO8601 format (which is already in the schema descriptions). It doesn't provide additional semantic context beyond what's in the schema, meeting the baseline for high schema coverage.

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 tool's purpose: 'List time entries for a user by name' - a specific verb ('List') and resource ('time entries') with a key constraint ('by name'). It distinguishes from sibling tools like 'getTimeEntries' (which likely lacks user filtering) and 'getUserTimeEntries' (which might use user ID instead of name), though this differentiation isn't explicitly stated.

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

Usage Guidelines3/5

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

The description implies usage context through the 'by name' specification and optional date parameters, suggesting this tool is for filtering time entries by user name rather than ID. However, it doesn't explicitly state when to use this vs. alternatives like 'getUserTimeEntries' (which might use user ID) or 'getTimeEntries' (which might list all entries). No explicit when-not-to-use guidance or prerequisites are provided.

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