Skip to main content
Glama
ratheesh-aot

Clockify MCP Server

by ratheesh-aot

get_tasks

Retrieve all tasks within a Clockify project to manage work items, filter by active status or name, and organize project activities.

Instructions

Get all tasks in a project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workspaceIdYesWorkspace ID
projectIdYesProject ID
isActiveNoFilter by active status
nameNoFilter by task name
pageNoPage number (default: 1)
pageSizeNoPage size (default: 50, max: 5000)

Implementation Reference

  • The handler function for the 'get_tasks' tool. It extracts workspaceId and projectId from arguments, builds query parameters for optional filters, calls the Clockify API endpoint `/workspaces/{workspaceId}/projects/{projectId}/tasks`, retrieves the tasks, and returns a formatted text response listing the tasks with their names, IDs, status, and estimates.
    private async getTasks(args: any) {
      const { workspaceId, projectId, ...params } = args;
    
      const queryParams = new URLSearchParams();
      Object.entries(params).forEach(([key, value]) => {
        if (value !== undefined && value !== null) {
          queryParams.append(key, String(value));
        }
      });
    
      const endpoint = queryParams.toString()
        ? `/workspaces/${workspaceId}/projects/${projectId}/tasks?${queryParams.toString()}`
        : `/workspaces/${workspaceId}/projects/${projectId}/tasks`;
    
      const tasks = await this.makeRequest(endpoint);
    
      return {
        content: [
          {
            type: "text",
            text: `Found ${tasks.length} task(s):\n${tasks
              .map((t: any) => `- ${t.name} (${t.id}) | Status: ${t.status} | Estimate: ${t.estimate || "None"}`)
              .join("\n")}`,
          },
        ],
        isError: false,
      };
    }
  • src/index.ts:490-505 (registration)
    The tool registration in the list of tools returned by ListToolsRequestSchema, including the name 'get_tasks', description, and input schema defining required workspaceId and projectId, with optional filters.
    {
      name: "get_tasks",
      description: "Get all tasks in a project",
      inputSchema: {
        type: "object",
        properties: {
          workspaceId: { type: "string", description: "Workspace ID" },
          projectId: { type: "string", description: "Project ID" },
          isActive: { type: "boolean", description: "Filter by active status" },
          name: { type: "string", description: "Filter by task name" },
          page: { type: "number", description: "Page number (default: 1)" },
          pageSize: { type: "number", description: "Page size (default: 50, max: 5000)" },
        },
        required: ["workspaceId", "projectId"],
      },
    },
  • src/index.ts:771-773 (registration)
    The dispatch case in the CallToolRequestSchema handler that validates required parameters and calls the getTasks method for the 'get_tasks' tool.
    case "get_tasks":
      if (!args?.workspaceId || !args?.projectId) throw new McpError(ErrorCode.InvalidParams, 'workspaceId and projectId are required');
      return await this.getTasks(args as any);
  • TypeScript interface defining the structure of a Task object used in the codebase, matching the expected API response.
    interface Task {
      id?: string;
      name: string;
      projectId: string;
      assigneeIds?: string[];
      estimate?: string;
      status?: "ACTIVE" | "DONE";
    }

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