kanban-zone-mcp-server 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/client.js +6 -0
- package/src/tools/cards.js +12 -10
- package/src/tools/checklists.js +8 -3
package/package.json
CHANGED
package/src/client.js
CHANGED
|
@@ -90,6 +90,8 @@ const makeApiRequest = async (endpoint, { method = 'GET', body, query } = {}) =>
|
|
|
90
90
|
return response.data;
|
|
91
91
|
};
|
|
92
92
|
|
|
93
|
+
const secondsText = seconds => (String(seconds) === '1' ? '1 second' : `${seconds} seconds`);
|
|
94
|
+
|
|
93
95
|
const handleApiError = error => {
|
|
94
96
|
if (axios.isAxiosError(error)) {
|
|
95
97
|
const status = error.response && error.response.status;
|
|
@@ -113,6 +115,10 @@ const handleApiError = error => {
|
|
|
113
115
|
: 'Not found. Double-check the ID — and for mirror cards, pass the `board` (publicId) parameter.';
|
|
114
116
|
}
|
|
115
117
|
if (status === 429) {
|
|
118
|
+
const retryAfterSeconds = error.response.headers && error.response.headers['retry-after'];
|
|
119
|
+
if (/^\d+$/.test(retryAfterSeconds)) {
|
|
120
|
+
return `Rate limit reached. Try again in ${secondsText(retryAfterSeconds)}.`;
|
|
121
|
+
}
|
|
116
122
|
return 'Rate limit exceeded. Wait a moment before retrying.';
|
|
117
123
|
}
|
|
118
124
|
if (status && status >= 500) {
|
package/src/tools/cards.js
CHANGED
|
@@ -251,7 +251,7 @@ const registerCardsTools = server => {
|
|
|
251
251
|
'',
|
|
252
252
|
'Args:',
|
|
253
253
|
' - id (string, required): card ObjectId.',
|
|
254
|
-
|
|
254
|
+
" - board (string, optional): for a mirrored card, the board publicId of the copy whose owner, watchers and label change. Without it, the copy on the board the card was made on changes, or else the card's oldest copy.",
|
|
255
255
|
' - title (string, optional)',
|
|
256
256
|
` - description (string, optional): ${RICH_TEXT_HELP}`,
|
|
257
257
|
' - owner (string, optional): account email or ObjectId.',
|
|
@@ -310,30 +310,32 @@ const registerCardsTools = server => {
|
|
|
310
310
|
title: 'Move a card',
|
|
311
311
|
description: [
|
|
312
312
|
'Move a card to a different column (and optionally a different board).',
|
|
313
|
+
'The card goes to the board that owns the column.',
|
|
313
314
|
'',
|
|
314
315
|
'Args:',
|
|
315
316
|
' - id (string, required): card ObjectId.',
|
|
316
|
-
' - board (string, required): destination board publicId.',
|
|
317
317
|
' - column (string, required): destination column ObjectId.',
|
|
318
|
-
|
|
318
|
+
" - from_board (string, optional): for a mirrored card, the board publicId of the copy to move. Without it, the copy already on the column's board moves, or, to another board, the card's newest copy.",
|
|
319
|
+
' - add_to_top (boolean, optional): false puts the card last in the column; by default it goes on top. A column that sorts itself places the card by its sort.',
|
|
319
320
|
'',
|
|
320
321
|
'Examples:',
|
|
321
322
|
' - "Move card 670... to the In Progress column"',
|
|
323
|
+
' - "Move the copy of card 670... that is on board Hds5Zuks to the Done column of board OeMrbG8g"',
|
|
322
324
|
].join('\n'),
|
|
323
325
|
inputSchema: {
|
|
324
326
|
id: objectIdField,
|
|
325
|
-
board: boardPublicIdField,
|
|
326
327
|
column: objectIdField,
|
|
327
|
-
|
|
328
|
+
from_board: boardPublicIdField.optional(),
|
|
329
|
+
add_to_top: z.boolean().optional(),
|
|
328
330
|
},
|
|
329
331
|
annotations: IDEMPOTENT_WRITE,
|
|
330
332
|
},
|
|
331
|
-
async ({ id,
|
|
333
|
+
async ({ id, column, from_board: fromBoard, add_to_top: addToTop }) =>
|
|
332
334
|
safeRun(async () => {
|
|
333
|
-
const
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
});
|
|
335
|
+
const body = { columnId: column };
|
|
336
|
+
if (fromBoard) body.board = fromBoard;
|
|
337
|
+
if (addToTop !== undefined) body.addToTop = addToTop;
|
|
338
|
+
const data = await makeApiRequest(`/cards/${id}/move`, { method: 'POST', body });
|
|
337
339
|
return {
|
|
338
340
|
content: [{ type: 'text', text: `Moved card to column ${column}.` }],
|
|
339
341
|
structuredContent: data,
|
package/src/tools/checklists.js
CHANGED
|
@@ -74,29 +74,33 @@ const registerChecklistsTools = server => {
|
|
|
74
74
|
{
|
|
75
75
|
title: 'Update a checklist',
|
|
76
76
|
description: [
|
|
77
|
-
'Update title or position of a checklist on a card.',
|
|
77
|
+
'Update the title or position of a checklist on a card, or hide or show it.',
|
|
78
78
|
'',
|
|
79
79
|
'Args:',
|
|
80
80
|
' - id (string, required): checklist ObjectId.',
|
|
81
81
|
' - title (string, optional)',
|
|
82
82
|
' - position (number, optional, ≥0)',
|
|
83
|
+
" - is_hidden (boolean, optional): true leaves the checklist off the card in the web and mobile apps, its tasks still counted in the card's totals; false shows it again.",
|
|
83
84
|
'',
|
|
84
85
|
'Examples:',
|
|
85
86
|
' - "Rename checklist 670... to \'QA tasks\'"',
|
|
86
87
|
' - "Move checklist 670... to position 0"',
|
|
88
|
+
' - "Hide checklist 670... on its card"',
|
|
87
89
|
].join('\n'),
|
|
88
90
|
inputSchema: {
|
|
89
91
|
id: objectIdField,
|
|
90
92
|
title: z.string().max(200).optional(),
|
|
91
93
|
position: z.number().int().min(0).optional(),
|
|
94
|
+
is_hidden: z.boolean().optional(),
|
|
92
95
|
},
|
|
93
96
|
annotations: IDEMPOTENT_WRITE,
|
|
94
97
|
},
|
|
95
|
-
async ({ id, title, position }) =>
|
|
98
|
+
async ({ id, title, position, is_hidden }) =>
|
|
96
99
|
safeRun(async () => {
|
|
97
100
|
const updates = {};
|
|
98
101
|
if (title !== undefined) updates.title = title;
|
|
99
102
|
if (position !== undefined) updates.position = position;
|
|
103
|
+
if (is_hidden !== undefined) updates.isHidden = is_hidden;
|
|
100
104
|
const data = await makeApiRequest(`/checklists/${id}`, { method: 'PATCH', body: updates });
|
|
101
105
|
return {
|
|
102
106
|
content: [{ type: 'text', text: `Updated checklist ${id}.` }],
|
|
@@ -139,7 +143,8 @@ const registerChecklistsTools = server => {
|
|
|
139
143
|
|
|
140
144
|
const renderChecklist = checklist => {
|
|
141
145
|
const tasks = Array.isArray(checklist.tasks) ? checklist.tasks : [];
|
|
142
|
-
const
|
|
146
|
+
const hidden = checklist.isHidden ? ' (hidden)' : '';
|
|
147
|
+
const lines = [`## ${checklist.title || '(untitled)'} (\`${checklist._id}\`)${hidden}`];
|
|
143
148
|
for (const task of tasks) {
|
|
144
149
|
const box = task.completed ? '[x]' : '[ ]';
|
|
145
150
|
lines.push(`- ${box} ${task.description} (\`${task._id}\`)`);
|