UNPKG

@aot-tech/clockify-mcp-server

Version:

MCP Server for Clockify time tracking integration with AI tools

36 lines (35 loc) 1.46 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.listProjectsTool = void 0; const api_1 = require("../config/api"); const zod_1 = require("zod"); const projects_1 = require("../clockify-sdk/projects"); exports.listProjectsTool = { name: api_1.TOOLS_CONFIG.projects.list.name, description: api_1.TOOLS_CONFIG.projects.list.description, parameters: { workspaceId: zod_1.z .string() .describe("The ID of the workspace that you need to get the projects from"), name: zod_1.z.string().describe("The project name to search for. This parameter is required and cannot be empty"), }, handler: async ({ workspaceId, name, }) => { if (!workspaceId && typeof workspaceId === "string") throw new Error("Workspace ID required to fetch projects"); const response = await projects_1.projectsService.fetchAll(workspaceId, name); const projects = response.data.map((project) => ({ name: project.name, clientName: project.clientName, userIds: project.memberships.map((membership) => membership.userId), projectId: project.id, })); return { content: [ { type: "text", text: `Clockify userIds with respective to projectId: ${JSON.stringify(projects, null, 2)}`, }, ], }; }, };