greenline-works-mcp-server 0.3.0 → 0.3.2
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/PROMPTS.md +89 -0
- package/README.md +7 -0
- package/package.json +5 -3
- package/src/constants.js +1 -1
- package/src/format.js +5 -8
- package/src/index.js +2 -0
- package/src/markdown-delta.js +94 -0
- package/src/prompts.js +118 -0
- package/src/tools/boards.js +36 -12
- package/src/tools/cards.js +11 -3
- package/src/tools/comments.js +2 -1
- package/src/tools/tasks.js +7 -1
package/PROMPTS.md
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Prompts
|
|
2
|
+
|
|
3
|
+
<!-- Generated by scripts/generate-prompts-md.js — run `npm run generate:prompts-md`, never edit by hand. -->
|
|
4
|
+
|
|
5
|
+
The server ships three user-invocable prompts. In **Claude Code** they appear as slash commands
|
|
6
|
+
(`/mcp__greenline__board_review` and friends); in **Claude Desktop** they are items in the prompt
|
|
7
|
+
picker (the + menu). Clients without MCP prompt support (ChatGPT, Perplexity, and others vary):
|
|
8
|
+
copy the block you need below, replace the `<PLACEHOLDERS>`, and paste it into the chat — the
|
|
9
|
+
text is identical to what the native prompts send.
|
|
10
|
+
|
|
11
|
+
## Board Review
|
|
12
|
+
|
|
13
|
+
Review a board for WIP violations and aging cards, with recommended actions.
|
|
14
|
+
|
|
15
|
+
Arguments: `board`, `aging_days`
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
Review GreenLine board <BOARD_PUBLIC_ID> for WIP violations and aging cards. Flag what needs attention now.
|
|
19
|
+
|
|
20
|
+
Steps:
|
|
21
|
+
1. Call greenline_get_board with board "<BOARD_PUBLIC_ID>" (response_format: "json") to confirm the board exists.
|
|
22
|
+
2. Call greenline_list_board_columns for the board (response_format: "json"). Each column is wrapped as
|
|
23
|
+
{ ColumnItem: ... }; the WIP limit is ColumnItem.maxWIP and the lower bound is ColumnItem.minWIP.
|
|
24
|
+
Collect the columnId of every column whose maxWIP is set (not null or 0) - only those need cards.
|
|
25
|
+
3. Call greenline_list_cards for the board with columns set to those columnIds (comma-separated),
|
|
26
|
+
count: 100, response_format: "json". Fetch further pages until a page comes back short or empty;
|
|
27
|
+
do not rely on has_more alone. Group cards by columnId, never by column title - boards can have
|
|
28
|
+
identically named columns under different parents.
|
|
29
|
+
4. Compare each limited column's card count against its maxWIP and note violations.
|
|
30
|
+
5. A card is aging when it has sat in its current column for more than 7 days. Check the
|
|
31
|
+
oldest few candidates per work column (by lastActionAt) with greenline_get_card_metrics. In the
|
|
32
|
+
metrics, the current column is the segment with endAt null - its totalTime reads 0, so compute the
|
|
33
|
+
days from its startAt.
|
|
34
|
+
|
|
35
|
+
Output format:
|
|
36
|
+
- WIP violations: column name - limit N, actual M.
|
|
37
|
+
- Aging cards: card title - column, days in column.
|
|
38
|
+
- Recommended action: one line per issue. Direct, no hedging.
|
|
39
|
+
- If there are no violations and no aging cards, say so in one line.
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Checklist Generator
|
|
43
|
+
|
|
44
|
+
Turn a card's description into UX and GIVEN/WHEN/THEN AC checklists, confirmed before writing.
|
|
45
|
+
|
|
46
|
+
Arguments: `card`
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
Turn the description of GreenLine card <CARD_ID> into a UX Checklist and an AC Checklist, matching
|
|
50
|
+
GreenLine's standard card structure.
|
|
51
|
+
|
|
52
|
+
Steps:
|
|
53
|
+
1. Call greenline_get_card with id "<CARD_ID>" and read the description.
|
|
54
|
+
2. Draft a "UX Checklist": concrete, testable UI/UX items only.
|
|
55
|
+
3. Draft an "AC Checklist": acceptance criteria only, each written as GIVEN/WHEN/THEN.
|
|
56
|
+
4. Present both drafts and wait for confirmation. Do not write to the card before confirmation.
|
|
57
|
+
5. On confirmation, create each checklist with a single greenline_create_checklist call, passing all of
|
|
58
|
+
its items in the tasks array (task order follows the array).
|
|
59
|
+
|
|
60
|
+
Rules:
|
|
61
|
+
- Every line must be testable. No vague items.
|
|
62
|
+
- Base items only on what the description supports; ask about gaps instead of inventing.
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Standup Summary
|
|
66
|
+
|
|
67
|
+
Draft a yesterday / today / blockers update from recent card movement on a board.
|
|
68
|
+
|
|
69
|
+
Arguments: `board`, `hours`
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
Draft a standup update (yesterday / today / blockers) from recent movement on GreenLine board <BOARD_PUBLIC_ID>.
|
|
73
|
+
|
|
74
|
+
Steps:
|
|
75
|
+
1. Call greenline_list_cards for the board with count: 100 (response_format: "json"). Fetch further
|
|
76
|
+
pages until a page comes back short or empty (do not rely on has_more alone), and stop after five
|
|
77
|
+
pages - on a larger board, ask for a narrower scope instead.
|
|
78
|
+
2. Preselect from the list itself: cards whose doneAt falls in the last 48 hours (yesterday), cards
|
|
79
|
+
in work columns with recent lastActionAt (today), and cards with blocked: true (blockers - the
|
|
80
|
+
blockedReason is already on the card, no extra calls needed).
|
|
81
|
+
3. Only when a card's story is unclear, call greenline_get_card_history with start set to 48 hours
|
|
82
|
+
ago as an ISO date.
|
|
83
|
+
|
|
84
|
+
Output format:
|
|
85
|
+
- Yesterday: short bullets, card titles only, no id numbers.
|
|
86
|
+
- Today: short bullets.
|
|
87
|
+
- Blockers: card title plus one line on what is blocking it.
|
|
88
|
+
- Keep the whole update short enough to read aloud in a minute.
|
|
89
|
+
```
|
package/README.md
CHANGED
|
@@ -75,6 +75,13 @@ The server validates the key on startup. A missing or malformed value (no `:` se
|
|
|
75
75
|
User-facing docs with example prompts: <https://docs.greenline.works/mcp>.
|
|
76
76
|
Full input/output schemas: <https://docs.greenline.works/api>.
|
|
77
77
|
|
|
78
|
+
## Prompts
|
|
79
|
+
|
|
80
|
+
Three user-invocable prompts ship alongside the tools: **Board Review**, **Checklist Generator**,
|
|
81
|
+
and **Standup Summary**. In Claude Code they register as slash commands; in Claude Desktop they
|
|
82
|
+
appear in the prompt picker. For clients without native MCP prompt support, [PROMPTS.md](PROMPTS.md)
|
|
83
|
+
carries the same texts as copy-paste blocks.
|
|
84
|
+
|
|
78
85
|
## Running from source
|
|
79
86
|
|
|
80
87
|
If you'd rather run from a local clone (development, contributions, custom modifications):
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "greenline-works-mcp-server",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Model Context Protocol server for the GreenLine public API",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://docs.greenline.works/mcp",
|
|
@@ -25,11 +25,13 @@
|
|
|
25
25
|
"files": [
|
|
26
26
|
"src",
|
|
27
27
|
"README.md",
|
|
28
|
-
"LICENSE"
|
|
28
|
+
"LICENSE",
|
|
29
|
+
"PROMPTS.md"
|
|
29
30
|
],
|
|
30
31
|
"scripts": {
|
|
31
32
|
"start": "node src/index.js",
|
|
32
|
-
"test": "node --test"
|
|
33
|
+
"test": "node --test",
|
|
34
|
+
"generate:prompts-md": "node scripts/generate-prompts-md.js"
|
|
33
35
|
},
|
|
34
36
|
"engines": {
|
|
35
37
|
"node": ">=18"
|
package/src/constants.js
CHANGED
package/src/format.js
CHANGED
|
@@ -11,15 +11,12 @@ const responseFormatField = z
|
|
|
11
11
|
.default(ResponseFormat.MARKDOWN)
|
|
12
12
|
.describe("Output format. 'markdown' (default) is human-readable; 'json' is the raw structured payload.");
|
|
13
13
|
|
|
14
|
-
// Card descriptions, comments and task text are stored as
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
// against it; <code> and <pre> are excluded because it strips them today.
|
|
14
|
+
// Card descriptions, comments and task text are stored as Quill deltas. Markdown is converted to
|
|
15
|
+
// a delta client-side before sending; strings containing HTML tags are passed through unchanged
|
|
16
|
+
// for the server to convert.
|
|
18
17
|
const RICH_TEXT_HELP =
|
|
19
|
-
'
|
|
20
|
-
'
|
|
21
|
-
'<a href>, <ul>/<ol> with <li> (nesting allowed), <h1>-<h3>, <blockquote>. Do not use <code> or ' +
|
|
22
|
-
'<pre> — the server strips them. Example: <p>Intro</p><ul><li>One</li><li>Two</li></ul>';
|
|
18
|
+
'Markdown (preferred) or HTML. Markdown is converted to the stored rich-text format; strings ' +
|
|
19
|
+
'containing HTML tags are passed through unchanged.';
|
|
23
20
|
|
|
24
21
|
const toJsonString = value => JSON.stringify(value, null, 2);
|
|
25
22
|
|
package/src/index.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
const { initApiClient } = require('./client');
|
|
7
7
|
const { registerAllTools } = require('./tools');
|
|
8
|
+
const { registerAllPrompts } = require('./prompts');
|
|
8
9
|
const { SERVER_NAME, SERVER_VERSION } = require('./constants');
|
|
9
10
|
|
|
10
11
|
const main = async () => {
|
|
@@ -22,6 +23,7 @@ const main = async () => {
|
|
|
22
23
|
|
|
23
24
|
const server = new McpServer({ name: SERVER_NAME, version: SERVER_VERSION });
|
|
24
25
|
registerAllTools(server);
|
|
26
|
+
registerAllPrompts(server);
|
|
25
27
|
|
|
26
28
|
const transport = new StdioServerTransport();
|
|
27
29
|
await server.connect(transport);
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// Converts the markdown LLM clients naturally produce into a Quill Delta, so the API receives the
|
|
2
|
+
// stored format directly. Inline: `code`, **bold**, __bold__, *em*, _em_, ~~strike~~, [text](url).
|
|
3
|
+
// Blocks: #-### headings, -/*/+ and 1. lists (2-space nesting -> indent), > quotes, ``` fences ->
|
|
4
|
+
// code-block lines, blank-line paragraph breaks. Input that already contains HTML is passed through
|
|
5
|
+
// in the plain field for the server to convert (richTextBody).
|
|
6
|
+
|
|
7
|
+
const SUPPORTED_TAG = /<(?:p|br|strong|em|u|s|a|ul|ol|li|h[1-3]|blockquote|pre|code)\b[^>]*>/i;
|
|
8
|
+
const containsHtml = text => SUPPORTED_TAG.test(text);
|
|
9
|
+
|
|
10
|
+
const INLINE_TOKEN =
|
|
11
|
+
/(`[^`]+`)|(\*\*[^*]+?\*\*)|(__[^_]+?__)|(~~[^~]+?~~)|(\[([^\]]+)\]\((https?:\/\/[^)\s]+)\))|((?<![\w*])\*[^*\s][^*]*?\*(?![\w*]))|((?<![\w_])_[^_\s][^_]*?_(?![\w_]))/;
|
|
12
|
+
|
|
13
|
+
const runsFromText = text => {
|
|
14
|
+
const runs = [];
|
|
15
|
+
let rest = text;
|
|
16
|
+
while (rest) {
|
|
17
|
+
const match = rest.match(INLINE_TOKEN);
|
|
18
|
+
if (!match) {
|
|
19
|
+
runs.push({ insert: rest });
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
if (match.index > 0) runs.push({ insert: rest.slice(0, match.index) });
|
|
23
|
+
const token = match[0];
|
|
24
|
+
if (match[1]) runs.push({ insert: token.slice(1, -1), attributes: { code: true } });
|
|
25
|
+
else if (match[2] || match[3]) runs.push({ insert: token.slice(2, -2), attributes: { bold: true } });
|
|
26
|
+
else if (match[4]) runs.push({ insert: token.slice(2, -2), attributes: { strike: true } });
|
|
27
|
+
else if (match[5]) runs.push({ insert: match[6], attributes: { link: match[7] } });
|
|
28
|
+
else runs.push({ insert: token.slice(1, -1), attributes: { italic: true } });
|
|
29
|
+
rest = rest.slice(match.index + token.length);
|
|
30
|
+
}
|
|
31
|
+
return runs;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const markdownToDelta = markdown => {
|
|
35
|
+
const ops = [];
|
|
36
|
+
const lines = String(markdown).replace(/\r\n/g, '\n').split('\n');
|
|
37
|
+
let paragraph = [];
|
|
38
|
+
let fenced = false;
|
|
39
|
+
|
|
40
|
+
const flushParagraph = () => {
|
|
41
|
+
if (!paragraph.length) return;
|
|
42
|
+
ops.push(...runsFromText(paragraph.join(' ')), { insert: '\n' });
|
|
43
|
+
paragraph = [];
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
for (const line of lines) {
|
|
47
|
+
if (/^\s*```/.test(line)) {
|
|
48
|
+
flushParagraph();
|
|
49
|
+
fenced = !fenced;
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
if (fenced) {
|
|
53
|
+
if (line) ops.push({ insert: line });
|
|
54
|
+
ops.push({ insert: '\n', attributes: { 'code-block': true } });
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
if (!line.trim()) {
|
|
58
|
+
flushParagraph();
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
const heading = line.match(/^(#{1,3})\s+(.*)$/);
|
|
62
|
+
if (heading) {
|
|
63
|
+
flushParagraph();
|
|
64
|
+
ops.push(...runsFromText(heading[2]), { insert: '\n', attributes: { header: heading[1].length } });
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
const quote = line.match(/^>\s?(.*)$/);
|
|
68
|
+
if (quote) {
|
|
69
|
+
flushParagraph();
|
|
70
|
+
ops.push(...runsFromText(quote[1]), { insert: '\n', attributes: { blockquote: true } });
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
const unordered = line.match(/^(\s*)[-*+]\s+(.*)$/);
|
|
74
|
+
const ordered = unordered ? null : line.match(/^(\s*)\d+[.)]\s+(.*)$/);
|
|
75
|
+
if (unordered || ordered) {
|
|
76
|
+
flushParagraph();
|
|
77
|
+
const [, lead, text] = unordered || ordered;
|
|
78
|
+
const attributes = { list: unordered ? 'bullet' : 'ordered' };
|
|
79
|
+
const indent = Math.min(Math.floor(lead.length / 2), 8);
|
|
80
|
+
if (indent) attributes.indent = indent;
|
|
81
|
+
ops.push(...runsFromText(text), { insert: '\n', attributes });
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
paragraph.push(line.trim());
|
|
85
|
+
}
|
|
86
|
+
flushParagraph();
|
|
87
|
+
return ops.length ? { ops } : { ops: [{ insert: '\n' }] };
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
// HTML goes through unchanged for the server to convert; anything else is markdown.
|
|
91
|
+
const richTextBody = (field, value) =>
|
|
92
|
+
containsHtml(value) ? { [field]: value } : { [`${field}Delta`]: markdownToDelta(value) };
|
|
93
|
+
|
|
94
|
+
module.exports = { markdownToDelta, richTextBody, containsHtml };
|
package/src/prompts.js
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
// User-invocable MCP prompts — the methodology layer over the tools. In Claude Code they
|
|
2
|
+
// surface as slash commands, in Claude Desktop as picker items; clients without the prompts
|
|
3
|
+
// primitive get the same texts as copy-paste blocks (see PROMPTS.md). Keep each prompt a
|
|
4
|
+
// thin orchestration of the tools: the client model brings the intelligence, the tools bring
|
|
5
|
+
// the data, these bring the GreenLine opinion.
|
|
6
|
+
|
|
7
|
+
const { z } = require('zod');
|
|
8
|
+
|
|
9
|
+
const boardArg = z.string().describe('Board publicId, e.g. "OeMrbG8g".');
|
|
10
|
+
|
|
11
|
+
const userMessage = text => ({ messages: [{ role: 'user', content: { type: 'text', text } }] });
|
|
12
|
+
|
|
13
|
+
const boardReviewText = (board, agingDays) =>
|
|
14
|
+
[
|
|
15
|
+
`Review GreenLine board ${board} for WIP violations and aging cards. Flag what needs attention now.`,
|
|
16
|
+
'',
|
|
17
|
+
'Steps:',
|
|
18
|
+
`1. Call greenline_get_board with board "${board}" (response_format: "json") to confirm the board exists.`,
|
|
19
|
+
'2. Call greenline_list_board_columns for the board (response_format: "json"). Each column is wrapped as',
|
|
20
|
+
' { ColumnItem: ... }; the WIP limit is ColumnItem.maxWIP and the lower bound is ColumnItem.minWIP.',
|
|
21
|
+
' Collect the columnId of every column whose maxWIP is set (not null or 0) - only those need cards.',
|
|
22
|
+
'3. Call greenline_list_cards for the board with columns set to those columnIds (comma-separated),',
|
|
23
|
+
' count: 100, response_format: "json". Fetch further pages until a page comes back short or empty;',
|
|
24
|
+
' do not rely on has_more alone. Group cards by columnId, never by column title - boards can have',
|
|
25
|
+
' identically named columns under different parents.',
|
|
26
|
+
"4. Compare each limited column's card count against its maxWIP and note violations.",
|
|
27
|
+
`5. A card is aging when it has sat in its current column for more than ${agingDays} days. Check the`,
|
|
28
|
+
' oldest few candidates per work column (by lastActionAt) with greenline_get_card_metrics. In the',
|
|
29
|
+
' metrics, the current column is the segment with endAt null - its totalTime reads 0, so compute the',
|
|
30
|
+
' days from its startAt.',
|
|
31
|
+
'',
|
|
32
|
+
'Output format:',
|
|
33
|
+
'- WIP violations: column name - limit N, actual M.',
|
|
34
|
+
'- Aging cards: card title - column, days in column.',
|
|
35
|
+
'- Recommended action: one line per issue. Direct, no hedging.',
|
|
36
|
+
'- If there are no violations and no aging cards, say so in one line.',
|
|
37
|
+
].join('\n');
|
|
38
|
+
|
|
39
|
+
const checklistGeneratorText = card =>
|
|
40
|
+
[
|
|
41
|
+
`Turn the description of GreenLine card ${card} into a UX Checklist and an AC Checklist, matching`,
|
|
42
|
+
"GreenLine's standard card structure.",
|
|
43
|
+
'',
|
|
44
|
+
'Steps:',
|
|
45
|
+
`1. Call greenline_get_card with id "${card}" and read the description.`,
|
|
46
|
+
'2. Draft a "UX Checklist": concrete, testable UI/UX items only.',
|
|
47
|
+
'3. Draft an "AC Checklist": acceptance criteria only, each written as GIVEN/WHEN/THEN.',
|
|
48
|
+
'4. Present both drafts and wait for confirmation. Do not write to the card before confirmation.',
|
|
49
|
+
'5. On confirmation, create each checklist with a single greenline_create_checklist call, passing all of',
|
|
50
|
+
' its items in the tasks array (task order follows the array).',
|
|
51
|
+
'',
|
|
52
|
+
'Rules:',
|
|
53
|
+
'- Every line must be testable. No vague items.',
|
|
54
|
+
'- Base items only on what the description supports; ask about gaps instead of inventing.',
|
|
55
|
+
].join('\n');
|
|
56
|
+
|
|
57
|
+
const standupSummaryText = (board, hours) =>
|
|
58
|
+
[
|
|
59
|
+
`Draft a standup update (yesterday / today / blockers) from recent movement on GreenLine board ${board}.`,
|
|
60
|
+
'',
|
|
61
|
+
'Steps:',
|
|
62
|
+
`1. Call greenline_list_cards for the board with count: 100 (response_format: "json"). Fetch further`,
|
|
63
|
+
' pages until a page comes back short or empty (do not rely on has_more alone), and stop after five',
|
|
64
|
+
' pages - on a larger board, ask for a narrower scope instead.',
|
|
65
|
+
`2. Preselect from the list itself: cards whose doneAt falls in the last ${hours} hours (yesterday), cards`,
|
|
66
|
+
' in work columns with recent lastActionAt (today), and cards with blocked: true (blockers - the',
|
|
67
|
+
' blockedReason is already on the card, no extra calls needed).',
|
|
68
|
+
`3. Only when a card's story is unclear, call greenline_get_card_history with start set to ${hours} hours`,
|
|
69
|
+
' ago as an ISO date.',
|
|
70
|
+
'',
|
|
71
|
+
'Output format:',
|
|
72
|
+
'- Yesterday: short bullets, card titles only, no id numbers.',
|
|
73
|
+
'- Today: short bullets.',
|
|
74
|
+
'- Blockers: card title plus one line on what is blocking it.',
|
|
75
|
+
'- Keep the whole update short enough to read aloud in a minute.',
|
|
76
|
+
].join('\n');
|
|
77
|
+
|
|
78
|
+
const registerAllPrompts = server => {
|
|
79
|
+
server.registerPrompt(
|
|
80
|
+
'board_review',
|
|
81
|
+
{
|
|
82
|
+
title: 'Board Review',
|
|
83
|
+
description: 'Review a board for WIP violations and aging cards, with recommended actions.',
|
|
84
|
+
argsSchema: {
|
|
85
|
+
board: boardArg,
|
|
86
|
+
aging_days: z.string().optional().describe('Days in a column before a card counts as aging (default 7).'),
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
({ board, aging_days }) => userMessage(boardReviewText(board, aging_days || '7'))
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
server.registerPrompt(
|
|
93
|
+
'checklist_generator',
|
|
94
|
+
{
|
|
95
|
+
title: 'Checklist Generator',
|
|
96
|
+
description: "Turn a card's description into UX and GIVEN/WHEN/THEN AC checklists, confirmed before writing.",
|
|
97
|
+
argsSchema: {
|
|
98
|
+
card: z.string().describe('Card ObjectId (24 hex characters).'),
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
({ card }) => userMessage(checklistGeneratorText(card))
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
server.registerPrompt(
|
|
105
|
+
'standup_summary',
|
|
106
|
+
{
|
|
107
|
+
title: 'Standup Summary',
|
|
108
|
+
description: 'Draft a yesterday / today / blockers update from recent card movement on a board.',
|
|
109
|
+
argsSchema: {
|
|
110
|
+
board: boardArg,
|
|
111
|
+
hours: z.string().optional().describe('Lookback window in hours (default 48).'),
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
({ board, hours }) => userMessage(standupSummaryText(board, hours || '48'))
|
|
115
|
+
);
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
module.exports = { registerAllPrompts };
|
package/src/tools/boards.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const { z } = require('zod');
|
|
2
2
|
const { makeApiRequest, safeRun } = require('../client');
|
|
3
3
|
const { responseFormatField, ResponseFormat, toJsonString, truncateIfNeeded } = require('../format');
|
|
4
|
-
const { boardPublicIdField } = require('../schemas');
|
|
4
|
+
const { boardPublicIdField, pageField, countField } = require('../schemas');
|
|
5
5
|
|
|
6
6
|
const READ_ANNOTATIONS = {
|
|
7
7
|
readOnlyHint: true,
|
|
@@ -10,7 +10,13 @@ const READ_ANNOTATIONS = {
|
|
|
10
10
|
openWorldHint: true,
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
// The API wraps each board as { BoardItem: { name, publicId, ... } }.
|
|
14
|
+
const unwrapBoard = entry => entry.BoardItem || entry;
|
|
15
|
+
|
|
16
|
+
const renderBoardLine = entry => {
|
|
17
|
+
const board = unwrapBoard(entry);
|
|
18
|
+
return `- **${board.name || board.title}** (${board.publicId})`;
|
|
19
|
+
};
|
|
14
20
|
|
|
15
21
|
const registerBoardsTools = server => {
|
|
16
22
|
server.registerTool(
|
|
@@ -26,6 +32,8 @@ const registerBoardsTools = server => {
|
|
|
26
32
|
' - include_labels (boolean): include labels for each board.',
|
|
27
33
|
' - include_members (boolean): include member lists for each board.',
|
|
28
34
|
' - include_custom_fields (boolean): include custom fields per board.',
|
|
35
|
+
' - page (number, optional, default 1).',
|
|
36
|
+
' - count (number, optional, default 20, max 100).',
|
|
29
37
|
' - response_format ("markdown" | "json"): output format. Defaults to markdown.',
|
|
30
38
|
'',
|
|
31
39
|
'Examples:',
|
|
@@ -38,6 +46,8 @@ const registerBoardsTools = server => {
|
|
|
38
46
|
include_labels: z.boolean().optional(),
|
|
39
47
|
include_members: z.boolean().optional(),
|
|
40
48
|
include_custom_fields: z.boolean().optional(),
|
|
49
|
+
page: pageField,
|
|
50
|
+
count: countField,
|
|
41
51
|
response_format: responseFormatField,
|
|
42
52
|
},
|
|
43
53
|
annotations: READ_ANNOTATIONS,
|
|
@@ -48,6 +58,8 @@ const registerBoardsTools = server => {
|
|
|
48
58
|
include_labels,
|
|
49
59
|
include_members,
|
|
50
60
|
include_custom_fields,
|
|
61
|
+
page,
|
|
62
|
+
count,
|
|
51
63
|
response_format,
|
|
52
64
|
}) =>
|
|
53
65
|
safeRun(async () => {
|
|
@@ -61,17 +73,23 @@ const registerBoardsTools = server => {
|
|
|
61
73
|
},
|
|
62
74
|
});
|
|
63
75
|
|
|
64
|
-
const
|
|
76
|
+
const all = Array.isArray(data) ? data : data.boards || [];
|
|
77
|
+
// /boards has no server-side pagination, so window the list here — an org with
|
|
78
|
+
// hundreds of boards would otherwise fill the caller's context in one response.
|
|
79
|
+
const total = all.length;
|
|
80
|
+
const boards = all.slice((page - 1) * count, page * count);
|
|
81
|
+
const hasMore = total > page * count;
|
|
65
82
|
|
|
66
83
|
if (response_format === ResponseFormat.JSON) {
|
|
84
|
+
const payload = { total, count: boards.length, page, boards, has_more: hasMore };
|
|
67
85
|
return {
|
|
68
|
-
content: [{ type: 'text', text: toJsonString(
|
|
69
|
-
structuredContent:
|
|
86
|
+
content: [{ type: 'text', text: toJsonString(payload) }],
|
|
87
|
+
structuredContent: payload,
|
|
70
88
|
};
|
|
71
89
|
}
|
|
72
90
|
|
|
73
|
-
const
|
|
74
|
-
|
|
91
|
+
const heading = `# Boards (${boards.length} of ${total}, page ${page})`;
|
|
92
|
+
const rerender = items => [heading, '', ...items.map(renderBoardLine)].join('\n');
|
|
75
93
|
const { text } = truncateIfNeeded({
|
|
76
94
|
items: boards,
|
|
77
95
|
rendered: rerender(boards),
|
|
@@ -80,7 +98,7 @@ const registerBoardsTools = server => {
|
|
|
80
98
|
|
|
81
99
|
return {
|
|
82
100
|
content: [{ type: 'text', text }],
|
|
83
|
-
structuredContent: { boards },
|
|
101
|
+
structuredContent: { total, count: boards.length, page, boards, has_more: hasMore },
|
|
84
102
|
};
|
|
85
103
|
})
|
|
86
104
|
);
|
|
@@ -124,10 +142,11 @@ const registerBoardsTools = server => {
|
|
|
124
142
|
},
|
|
125
143
|
});
|
|
126
144
|
|
|
145
|
+
const item = unwrapBoard(data.boards?.[0] || data);
|
|
127
146
|
const text =
|
|
128
147
|
response_format === ResponseFormat.JSON
|
|
129
148
|
? toJsonString(data)
|
|
130
|
-
: `# ${
|
|
149
|
+
: `# ${item.name || item.title}\n- **publicId**: ${item.publicId}${item.description ? `\n- **description**: ${item.description}` : ''}`;
|
|
131
150
|
|
|
132
151
|
return {
|
|
133
152
|
content: [{ type: 'text', text }],
|
|
@@ -158,7 +177,12 @@ const registerBoardsTools = server => {
|
|
|
158
177
|
query,
|
|
159
178
|
includeDefault: include_default ? 'true' : undefined,
|
|
160
179
|
}),
|
|
161
|
-
|
|
180
|
+
// The API wraps each column as { ColumnItem: { columnId, title, columnState, maxWIP, minWIP } }.
|
|
181
|
+
renderItem: entry => {
|
|
182
|
+
const column = entry.ColumnItem || entry;
|
|
183
|
+
const wip = column.maxWIP ? ` — WIP ${column.minWIP || 0}-${column.maxWIP}` : '';
|
|
184
|
+
return `- **${column.title}** (\`${column.columnId || column._id}\`)${column.columnState ? ` — ${column.columnState}` : ''}${wip}`;
|
|
185
|
+
},
|
|
162
186
|
example: '"List columns on the OeMrbG8g board"',
|
|
163
187
|
},
|
|
164
188
|
{
|
|
@@ -168,7 +192,7 @@ const registerBoardsTools = server => {
|
|
|
168
192
|
label: 'Labels',
|
|
169
193
|
extraSchema: {},
|
|
170
194
|
buildQuery: () => ({}),
|
|
171
|
-
renderItem: label => `- **${label.description || '(no description)'}** (\`${label._id}\`)${label.color ? ` color ${label.color}` : ''}`,
|
|
195
|
+
renderItem: label => `- **${label.description || '(no description)'}** (\`${label.id || label._id}\`)${label.color ? ` color ${label.color}` : ''}`,
|
|
172
196
|
example: '"What labels are available on this board?"',
|
|
173
197
|
},
|
|
174
198
|
{
|
|
@@ -179,7 +203,7 @@ const registerBoardsTools = server => {
|
|
|
179
203
|
extraSchema: {},
|
|
180
204
|
buildQuery: () => ({}),
|
|
181
205
|
renderItem: member => {
|
|
182
|
-
const name = [member.firstName, member.lastName].filter(Boolean).join(' ') || member.email;
|
|
206
|
+
const name = member.name || [member.firstName, member.lastName].filter(Boolean).join(' ') || member.email;
|
|
183
207
|
return `- **${name}** (${member.email}) — \`${member._id}\``;
|
|
184
208
|
},
|
|
185
209
|
example: '"Who can I assign cards to on this board?"',
|
package/src/tools/cards.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const { z } = require('zod');
|
|
2
2
|
const { makeApiRequest, safeRun } = require('../client');
|
|
3
3
|
const { responseFormatField, ResponseFormat, toJsonString, truncateIfNeeded, RICH_TEXT_HELP } = require('../format');
|
|
4
|
+
const { richTextBody } = require('../markdown-delta');
|
|
4
5
|
const { objectIdField, boardPublicIdField, pageField, countField, isoDateField } = require('../schemas');
|
|
5
6
|
|
|
6
7
|
const READ = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true };
|
|
@@ -68,7 +69,7 @@ const registerCardsTools = server => {
|
|
|
68
69
|
async ({ board, title, description, column, owner, label, addToTop }) =>
|
|
69
70
|
safeRun(async () => {
|
|
70
71
|
const card = { title };
|
|
71
|
-
if (description !== undefined) card
|
|
72
|
+
if (description !== undefined) Object.assign(card, richTextBody('description', description));
|
|
72
73
|
if (column !== undefined) card.columnId = column;
|
|
73
74
|
if (owner !== undefined) card.owner = owner;
|
|
74
75
|
if (label !== undefined) card.label = label;
|
|
@@ -77,13 +78,15 @@ const registerCardsTools = server => {
|
|
|
77
78
|
if (addToTop !== undefined) body.addToTop = addToTop;
|
|
78
79
|
|
|
79
80
|
const data = await makeApiRequest('/cards', { method: 'POST', body });
|
|
80
|
-
|
|
81
|
+
// The API returns { cards: [{ _id, CardItem, meta }], cardsAdded, errors }.
|
|
82
|
+
const created = data.cards?.[0] || (Array.isArray(data) ? data[0] : data);
|
|
83
|
+
const item = created.CardItem || created;
|
|
81
84
|
|
|
82
85
|
return {
|
|
83
86
|
content: [
|
|
84
87
|
{
|
|
85
88
|
type: 'text',
|
|
86
|
-
text: `Created card **${
|
|
89
|
+
text: `Created card **${item.title}** (\`${created._id}\`) on board ${board}.`,
|
|
87
90
|
},
|
|
88
91
|
],
|
|
89
92
|
structuredContent: created,
|
|
@@ -259,6 +262,11 @@ const registerCardsTools = server => {
|
|
|
259
262
|
},
|
|
260
263
|
async ({ id, ...updates }) =>
|
|
261
264
|
safeRun(async () => {
|
|
265
|
+
if (updates.description !== undefined) {
|
|
266
|
+
const body = richTextBody('description', updates.description);
|
|
267
|
+
delete updates.description;
|
|
268
|
+
Object.assign(updates, body);
|
|
269
|
+
}
|
|
262
270
|
const data = await makeApiRequest(`/cards/${id}`, { method: 'PATCH', body: updates });
|
|
263
271
|
return {
|
|
264
272
|
content: [{ type: 'text', text: `Updated card **${data.title || id}**.` }],
|
package/src/tools/comments.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const { z } = require('zod');
|
|
2
2
|
const { makeApiRequest, safeRun } = require('../client');
|
|
3
3
|
const { responseFormatField, ResponseFormat, toJsonString, truncateIfNeeded, RICH_TEXT_HELP } = require('../format');
|
|
4
|
+
const { richTextBody } = require('../markdown-delta');
|
|
4
5
|
const { objectIdField } = require('../schemas');
|
|
5
6
|
|
|
6
7
|
const READ = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true };
|
|
@@ -36,7 +37,7 @@ const registerCommentsTools = server => {
|
|
|
36
37
|
},
|
|
37
38
|
async ({ card, text }) =>
|
|
38
39
|
safeRun(async () => {
|
|
39
|
-
const data = await makeApiRequest('/comments', { method: 'POST', body: { card, text } });
|
|
40
|
+
const data = await makeApiRequest('/comments', { method: 'POST', body: { card, ...richTextBody('text', text) } });
|
|
40
41
|
return {
|
|
41
42
|
content: [{ type: 'text', text: `Comment added to card ${card}.` }],
|
|
42
43
|
structuredContent: data,
|
package/src/tools/tasks.js
CHANGED
|
@@ -2,6 +2,7 @@ const { z } = require('zod');
|
|
|
2
2
|
const { makeApiRequest, safeRun } = require('../client');
|
|
3
3
|
const { isoDateField, objectIdField } = require('../schemas');
|
|
4
4
|
const { RICH_TEXT_HELP } = require('../format');
|
|
5
|
+
const { richTextBody } = require('../markdown-delta');
|
|
5
6
|
|
|
6
7
|
const WRITE = { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true };
|
|
7
8
|
const IDEMPOTENT_WRITE = { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true };
|
|
@@ -35,7 +36,7 @@ const registerTasksTools = server => {
|
|
|
35
36
|
},
|
|
36
37
|
async ({ checklist, description, position, dueAt, owner }) =>
|
|
37
38
|
safeRun(async () => {
|
|
38
|
-
const body = { checklist, description };
|
|
39
|
+
const body = { checklist, ...richTextBody('description', description) };
|
|
39
40
|
if (position !== undefined) body.position = position;
|
|
40
41
|
if (dueAt !== undefined) body.dueAt = dueAt;
|
|
41
42
|
if (owner !== undefined) body.owner = owner;
|
|
@@ -80,6 +81,11 @@ const registerTasksTools = server => {
|
|
|
80
81
|
},
|
|
81
82
|
async ({ id, ...updates }) =>
|
|
82
83
|
safeRun(async () => {
|
|
84
|
+
if (updates.description !== undefined) {
|
|
85
|
+
const body = richTextBody('description', updates.description);
|
|
86
|
+
delete updates.description;
|
|
87
|
+
Object.assign(updates, body);
|
|
88
|
+
}
|
|
83
89
|
const data = await makeApiRequest(`/tasks/${id}`, { method: 'PATCH', body: updates });
|
|
84
90
|
return {
|
|
85
91
|
content: [{ type: 'text', text: `Updated task ${id}.` }],
|