@aot-tech/clockify-mcp-server
Version:
MCP Server for Clockify time tracking integration with AI tools
49 lines (48 loc) • 1.72 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.findTasksTool = void 0;
const zod_1 = require("zod");
const tasks_1 = require("../clockify-sdk/tasks");
const api_1 = require("../config/api");
exports.findTasksTool = {
name: api_1.TOOLS_CONFIG.tasks.find.name,
description: api_1.TOOLS_CONFIG.tasks.find.description,
parameters: {
workspaceId: zod_1.z
.string()
.describe('The id of the workspace where the task is located'),
projectId: zod_1.z
.string()
.describe('The id of the project where the task is located'),
taskName: zod_1.z
.string()
.optional()
.describe('The name of the task to search for'),
},
handler: async (params) => {
const result = await tasks_1.tasksService.find(params.workspaceId, params.projectId, params.taskName || '');
if (result.length === 0) {
return {
content: [
{
type: 'text',
text: `No tasks found with the name "${params.taskName}" in project "${params.projectId}" of workspace "${params.workspaceId}"`,
},
],
};
}
const formattedResults = result.map((task) => ({
id: task.id,
name: task.name,
projectId: task.projectId,
}));
return {
content: [
{
type: 'text',
text: `Clockify Tasks for workspace and project and name: ${JSON.stringify(formattedResults, null, 2)}`,
},
],
};
},
};