@vizioz/teamwork-mcp
Version:
MCP server to connect to the Teamwork.com API
21 lines (20 loc) • 821 B
JavaScript
import logger from '../../utils/logger.js';
import { ensureApiClient } from '../core/apiClient.js';
/**
* Fetches comments for a specific task from the Teamwork API
* @param taskId The ID of the task to retrieve comments for
* @param options Optional query parameters for filtering and pagination
* @returns The API response with task comments data
*/
export const getTaskComments = async (taskId, options = {}) => {
try {
const api = ensureApiClient();
const response = await api.get(`/tasks/${taskId}/comments.json`, { params: options });
return response.data;
}
catch (error) {
logger.error(`Error fetching comments for task ${taskId}: ${error.message}`);
throw new Error(`Failed to fetch comments for task ${taskId}`);
}
};
export default getTaskComments;