mcp_kanban_comment_manager
Perform operations on card comments, including retrieving, creating, updating, and deleting, for effective task management on Planka Kanban boards.
Instructions
Manage card comments with various operations
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | The action to perform | |
| cardId | No | The ID of the card | |
| id | No | The ID of the comment | |
| text | No | The text content of the comment |
Implementation Reference
- index.ts:658-713 (handler)The primary handler, schema definition, and registration for the mcp_kanban_comment_manager tool. Dispatches to specific comment operations based on the 'action' parameter.
"mcp_kanban_comment_manager", "Manage card comments with various operations", { action: z .enum(["get_all", "create", "get_one", "update", "delete"]) .describe("The action to perform"), id: z.string().optional().describe("The ID of the comment"), cardId: z.string().optional().describe("The ID of the card"), text: z.string().optional().describe("The text content of the comment"), }, async (args) => { let result; switch (args.action) { case "get_all": if (!args.cardId) throw new Error("cardId is required for get_all action"); result = await comments.getComments(args.cardId); break; case "create": if (!args.cardId || !args.text) throw new Error("cardId and text are required for create action"); result = await comments.createComment({ cardId: args.cardId, text: args.text, }); break; case "get_one": if (!args.id) throw new Error("id is required for get_one action"); result = await comments.getComment(args.id); break; case "update": if (!args.id || !args.text) throw new Error("id and text are required for update action"); result = await comments.updateComment(args.id, { text: args.text, }); break; case "delete": if (!args.id) throw new Error("id is required for delete action"); result = await comments.deleteComment(args.id); break; default: throw new Error(`Unknown action: ${args.action}`); } return { content: [{ type: "text", text: JSON.stringify(result) }], }; } ); - operations/comments.ts:101-121 (helper)Helper function to create a new comment on a card using the Planka API.
export async function createComment(options: CreateCommentOptions) { try { const response = await plankaRequest( `/api/cards/${options.cardId}/comment-actions`, { method: "POST", body: { text: options.text, }, }, ); const parsedResponse = CommentActionResponseSchema.parse(response); return parsedResponse.item; } catch (error) { throw new Error( `Failed to create comment: ${ error instanceof Error ? error.message : String(error) }`, ); } } - operations/comments.ts:130-163 (helper)Helper function to retrieve all comments for a specific card.
export async function getComments(cardId: string) { try { const response = await plankaRequest(`/api/cards/${cardId}/actions`); try { // Try to parse as a CommentsResponseSchema first const parsedResponse = CommentActionsResponseSchema.parse(response); // Filter only comment actions if (parsedResponse.items && Array.isArray(parsedResponse.items)) { return parsedResponse.items.filter((item) => item.type === "commentCard" ); } return parsedResponse.items; } catch (parseError) { // If that fails, try to parse as an array directly if (Array.isArray(response)) { const items = z.array(CommentActionSchema).parse(response); // Filter only comment actions return items.filter((item) => item.type === "commentCard"); } // If we get here, we couldn't parse the response in any expected format throw new Error( `Could not parse comments response: ${ JSON.stringify(response) }`, ); } } catch (error) { // If all else fails, return an empty array return []; } } - operations/comments.ts:294-314 (helper)Helper function to update a comment's text content.
export async function updateComment( id: string, options: Partial<Omit<CreateCommentOptions, "cardId">>, ) { try { const response = await plankaRequest(`/api/comment-actions/${id}`, { method: "PATCH", body: { text: options.text, }, }); const parsedResponse = CommentActionResponseSchema.parse(response); return parsedResponse.item; } catch (error) { throw new Error( `Failed to update comment: ${ error instanceof Error ? error.message : String(error) }`, ); } } - operations/comments.ts:323-336 (helper)Helper function to delete a comment by ID.
export async function deleteComment(id: string) { try { await plankaRequest(`/api/comment-actions/${id}`, { method: "DELETE", }); return { success: true }; } catch (error) { throw new Error( `Failed to delete comment: ${ error instanceof Error ? error.message : String(error) }`, ); } }