Skip to main content
Glama
add-comment.ts2.44 kB
/** * Developed by eBrook Group. * Copyright © 2026 eBrook Group (https://www.ebrook.com.tw) */ /** * Add comment tool handler * Adds a comment to a ClickUp task */ import { ClickUpService } from "../services/clickup.js"; import { debug, error } from "../utils/logger.js"; import { sanitizeErrorResponse } from "../utils/error-sanitizer.js"; import type { AppConfig } from "../config/env.js"; /** * Add comment tool handler * @param task_id - ClickUp task ID * @param comment_text - Comment text to add * @param _config - Application configuration (unused) * @param click_up_service - ClickUp service instance * @returns Tool execution result */ export async function handleAddComment( task_id: string, comment_text: string, _config: AppConfig, click_up_service: ClickUpService ): Promise<{ content: Array<{ type: "text"; text: string }>; isError?: boolean }> { debug(`Adding comment to task: ${task_id}`); debug(`Comment text length: ${comment_text.length}`); // Add comment to task const comment_res = await click_up_service.addComment(task_id, comment_text); debug(`ClickUp API response status: ${comment_res.status}`); if (comment_res.status !== 200) { // Sanitized error message for client const error_msg = `Failed to add comment to task ${task_id}. ${sanitizeErrorResponse(comment_res.status, comment_res.body)}`; // Full error details only in logs debug(`Full API error response: ${JSON.stringify(comment_res.body)}`); error(error_msg); return { content: [ { type: "text", text: error_msg, }, ], isError: true, }; } debug(`Successfully added comment to task`); // Build formatted output const output_lines: string[] = []; output_lines.push("=".repeat(80)); output_lines.push(`✅ COMMENT ADDED TO TASK`); output_lines.push("=".repeat(80)); output_lines.push(""); output_lines.push(`🆔 Task ID: ${task_id}`); output_lines.push(`💬 Comment: ${comment_text.substring(0, 100)}${comment_text.length > 100 ? "..." : ""}`); output_lines.push(""); output_lines.push("=".repeat(80)); // Return formatted result return { content: [ { type: "text", text: output_lines.join("\n"), }, { type: "text", text: `\n📊 Raw Response (JSON):\n${JSON.stringify(comment_res.body, null, 2)}`, }, ], isError: false, }; }

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/tangbodie/clickup-mcp'

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