punchline-mcp 1.2.0 → 1.4.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/README.md +1 -1
- package/dist/tools/tickets.js +29 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -74,7 +74,7 @@ the server twice under two names with two different keys, e.g. `punchline` (proj
|
|
|
74
74
|
| `create_ticket` | project key | Create a ticket. `reporter_email` is required. Supports idempotent retries via `idempotency_key`, sent to the API as the `idempotencyKey` body field. Optional `custom_fields` (sent as `customFields`) is an array of `{ name, value }` pairs; `name` must match a custom-field definition configured on the project or the request is rejected with 400. |
|
|
75
75
|
| `list_tickets` | project key | List tickets visible to the key (own tickets, or the whole project with `read:all`). Paginated. |
|
|
76
76
|
| `get_ticket` | project key | Fetch one ticket by display id (e.g. `ACM-7`). |
|
|
77
|
-
| `update_ticket` | project key | Change a ticket's workflow status, its priority, and/or customer-facing public summary. Setting `priority` records a **triage ruling** — confirming the current value counts as one — which a project enforcing triage requires before a ticket can close. Priority is applied before status, so one call can triage and close. A ticket created through this API arrives untriaged: the priority sent at creation is the reporter's proposal, not a ruling. *(1.2.0+)* |
|
|
77
|
+
| `update_ticket` | project key | Change a ticket's workflow status, its priority, its labels, and/or customer-facing public summary. Setting `priority` records a **triage ruling** — confirming the current value counts as one — which a project enforcing triage requires before a ticket can close. Priority is applied before status, so one call can triage and close. A ticket created through this API arrives untriaged: the priority sent at creation is the reporter's proposal, not a ruling. *(1.2.0+)* `labels` is a **replace-set** applied before everything else: omit it to leave the labels alone, send the full list to change them, send `[]` to clear them — unknown names are created, exactly as at `create_ticket`; a blank name is refused by both tools rather than silently dropped, and surrounding whitespace is stripped server-side. *(1.3.0+)* `title` and `description` may also be patched: `title` is trimmed and rejected if blank, `description` **replaces only the reporter-authored body**, preserving the `**Reported by** … via …` provenance header the ticket was created with — send `""` to clear the body and keep just the header. Both are applied before `labels`, `priority` and `status`. *(1.4.0+)* |
|
|
78
78
|
| `add_communication` | project key | Post a customer-facing communication (external comment) on a ticket. |
|
|
79
79
|
| `link_tickets` | project key | Link two tickets. `relation` is one of `BLOCKS`, `BLOCKED_BY`, `DUPLICATES`, `DUPLICATE_OF`, `RELATES_TO`, read from the perspective of the ticket in `display_id` — the same vocabulary `get_ticket` returns in `linkedTickets`, so a relation round-trips. ⚠️ `close_as_duplicate: true` also **closes the `display_id` ticket and emails its reporter**; it requires `relation=DUPLICATES` and is not undone by `unlink_tickets`. |
|
|
80
80
|
| `unlink_tickets` | project key | Remove a link. `relation` must match how the link reads from the ticket in `display_id`. |
|
package/dist/tools/tickets.js
CHANGED
|
@@ -10,6 +10,13 @@ export const TICKET_TOOL_NAMES = ['create_ticket', 'list_tickets', 'get_ticket',
|
|
|
10
10
|
*/
|
|
11
11
|
export const CROSS_PROJECT_LINK_NOTE = ' Links to tickets in other projects are omitted from the response — a ticket may carry links'
|
|
12
12
|
+ ' that are not shown here.';
|
|
13
|
+
/**
|
|
14
|
+
* A label name, on create and on update alike. Blank is refused rather than dropped: the API
|
|
15
|
+
* refuses it too, and a name the client silently discarded would leave the caller believing it
|
|
16
|
+
* had labelled the ticket. Declared once so the two tools cannot drift apart.
|
|
17
|
+
*/
|
|
18
|
+
const LABEL_NAME = z.string().max(100)
|
|
19
|
+
.refine((n) => n.trim().length > 0, { message: 'Label names must not be blank' });
|
|
13
20
|
export const TICKETS_PATH = '/api/v1/external/tickets';
|
|
14
21
|
export function ticketPath(displayId) {
|
|
15
22
|
return `${TICKETS_PATH}/${encodeURIComponent(displayId)}`;
|
|
@@ -27,7 +34,7 @@ export function registerTicketTools(server, client) {
|
|
|
27
34
|
description: z.string().max(50000).optional(),
|
|
28
35
|
type: z.enum(TICKET_TYPES).optional().describe('Defaults to BUG'),
|
|
29
36
|
priority: z.enum(TICKET_PRIORITIES).optional().describe('Defaults to MEDIUM'),
|
|
30
|
-
labels: z.array(
|
|
37
|
+
labels: z.array(LABEL_NAME).max(100).optional().describe('Label names; unknown labels are created'),
|
|
31
38
|
reporter_name: z.string().max(500).optional(),
|
|
32
39
|
page_url: z.string().max(2048).optional(),
|
|
33
40
|
user_agent: z.string().max(512).optional(),
|
|
@@ -87,7 +94,7 @@ export function registerTicketTools(server, client) {
|
|
|
87
94
|
},
|
|
88
95
|
}, tool(async (a) => client.request('GET', ticketPath(a.display_id))));
|
|
89
96
|
server.registerTool('update_ticket', {
|
|
90
|
-
description: 'Update a ticket: change its workflow status, its priority, and/or the customer-facing public summary. At least one field is required; an empty public_summary clears it. Setting priority records a triage ruling — confirming the existing value counts — which is what a project requiring triage before close demands. Priority is applied before status, so one call can triage and close.'
|
|
97
|
+
description: 'Update a ticket: change its workflow status, its priority, its labels, and/or the customer-facing public summary. At least one field is required; an empty public_summary clears it. Setting priority records a triage ruling — confirming the existing value counts — which is what a project requiring triage before close demands. Priority is applied before status, so one call can triage and close. Labels are applied first, and are a replace-set: omit the field to leave them alone, pass the full list to change them, pass [] to clear them. Title and description may also be patched; a description patch replaces only the reporter-authored body and keeps the "Reported by" header the ticket was created with.'
|
|
91
98
|
+ CROSS_PROJECT_LINK_NOTE,
|
|
92
99
|
inputSchema: {
|
|
93
100
|
display_id: z.string().min(1),
|
|
@@ -95,13 +102,30 @@ export function registerTicketTools(server, client) {
|
|
|
95
102
|
public_summary: z.string().max(10000).optional(),
|
|
96
103
|
priority: z.enum(TICKET_PRIORITIES).optional()
|
|
97
104
|
.describe('Records a triage ruling. Required before closing in a project that enforces triage.'),
|
|
105
|
+
labels: z.array(LABEL_NAME).max(100).optional()
|
|
106
|
+
.describe('Replaces the ticket\'s labels with exactly these names; unknown labels are created.'
|
|
107
|
+
+ ' Omit to leave them untouched, [] to clear them.'),
|
|
108
|
+
title: z.string().min(1).max(500).optional()
|
|
109
|
+
.describe('Replaces the ticket title. Must not be blank.'),
|
|
110
|
+
description: z.string().max(50000).optional()
|
|
111
|
+
.describe('Replaces the reporter-authored body of the description. The'
|
|
112
|
+
+ ' "Reported by … via …" header a ticket was created with is preserved;'
|
|
113
|
+
+ ' pass "" to clear the body and keep only that header.'),
|
|
98
114
|
},
|
|
99
115
|
}, tool(async (a) => {
|
|
100
|
-
if (a.status === undefined && a.public_summary === undefined
|
|
101
|
-
|
|
116
|
+
if (a.status === undefined && a.public_summary === undefined
|
|
117
|
+
&& a.priority === undefined && a.labels === undefined
|
|
118
|
+
&& a.title === undefined && a.description === undefined) {
|
|
119
|
+
throw new Error('Provide status, priority, labels, title, description and/or public_summary');
|
|
102
120
|
}
|
|
121
|
+
// JSON.stringify drops undefined keys, which is what keeps "omitted" distinct from "[]" on
|
|
122
|
+
// the wire — the API reads an absent labels key as "leave them alone" (RUBE-46).
|
|
103
123
|
return client.request('PATCH', ticketPath(a.display_id), {
|
|
104
|
-
body: {
|
|
124
|
+
body: {
|
|
125
|
+
status: a.status, publicSummary: a.public_summary,
|
|
126
|
+
priority: a.priority, labels: a.labels,
|
|
127
|
+
title: a.title, description: a.description,
|
|
128
|
+
},
|
|
105
129
|
});
|
|
106
130
|
}));
|
|
107
131
|
}
|