punchline-mcp 1.1.0 → 1.3.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 CHANGED
@@ -71,10 +71,10 @@ the server twice under two names with two different keys, e.g. `punchline` (proj
71
71
 
72
72
  | Tool | Available with | Description |
73
73
  |---|---|---|
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. |
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 and/or customer-facing public summary. |
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+)* |
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/index.js CHANGED
File without changes
@@ -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)}`;
@@ -17,6 +24,9 @@ export function ticketPath(displayId) {
17
24
  export function registerTicketTools(server, client) {
18
25
  server.registerTool('create_ticket', {
19
26
  description: 'Create a ticket in the project bound to the API key. Supports idempotent retries via idempotency_key.'
27
+ + ' custom_fields lets you stamp name-keyed values that other project tooling (e.g. outbound webhooks) reads back'
28
+ + ' later; each name must match a custom-field definition already configured on the project — an unknown name is'
29
+ + ' rejected with a 400 error rather than silently ignored.'
20
30
  + CROSS_PROJECT_LINK_NOTE,
21
31
  inputSchema: {
22
32
  title: z.string().min(1).max(500).describe('Ticket title'),
@@ -24,13 +34,18 @@ export function registerTicketTools(server, client) {
24
34
  description: z.string().max(50000).optional(),
25
35
  type: z.enum(TICKET_TYPES).optional().describe('Defaults to BUG'),
26
36
  priority: z.enum(TICKET_PRIORITIES).optional().describe('Defaults to MEDIUM'),
27
- labels: z.array(z.string().max(100)).max(100).optional().describe('Label names; unknown labels are created'),
37
+ labels: z.array(LABEL_NAME).max(100).optional().describe('Label names; unknown labels are created'),
28
38
  reporter_name: z.string().max(500).optional(),
29
39
  page_url: z.string().max(2048).optional(),
30
40
  user_agent: z.string().max(512).optional(),
31
41
  app_version: z.string().max(100).optional(),
32
42
  idempotency_key: z.string().max(255).optional()
33
43
  .describe('Same key on the same API key returns the original ticket instead of creating a duplicate'),
44
+ custom_fields: z.array(z.object({
45
+ name: z.string().min(1).max(255).describe('Must match a custom-field name configured on the project'),
46
+ value: z.string().max(4096),
47
+ })).max(50).optional()
48
+ .describe('Name-keyed custom field values, e.g. [{ name: "rubedyne_user_id", value: "3172" }]. An unknown name is rejected with 400.'),
34
49
  },
35
50
  }, tool(async (a) => client.request('POST', TICKETS_PATH, {
36
51
  body: {
@@ -45,6 +60,7 @@ export function registerTicketTools(server, client) {
45
60
  userAgent: a.user_agent,
46
61
  appVersion: a.app_version,
47
62
  idempotencyKey: a.idempotency_key,
63
+ customFields: a.custom_fields,
48
64
  },
49
65
  })));
50
66
  server.registerTool('list_tickets', {
@@ -78,19 +94,30 @@ export function registerTicketTools(server, client) {
78
94
  },
79
95
  }, tool(async (a) => client.request('GET', ticketPath(a.display_id))));
80
96
  server.registerTool('update_ticket', {
81
- description: 'Update a ticket: change its workflow status and/or the customer-facing public summary. At least one field is required; an empty public_summary clears it.'
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.'
82
98
  + CROSS_PROJECT_LINK_NOTE,
83
99
  inputSchema: {
84
100
  display_id: z.string().min(1),
85
101
  status: z.string().max(100).optional(),
86
102
  public_summary: z.string().max(10000).optional(),
103
+ priority: z.enum(TICKET_PRIORITIES).optional()
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.'),
87
108
  },
88
109
  }, tool(async (a) => {
89
- if (a.status === undefined && a.public_summary === undefined) {
90
- throw new Error('Provide status and/or public_summary');
110
+ if (a.status === undefined && a.public_summary === undefined
111
+ && a.priority === undefined && a.labels === undefined) {
112
+ throw new Error('Provide status, priority, labels and/or public_summary');
91
113
  }
114
+ // JSON.stringify drops undefined keys, which is what keeps "omitted" distinct from "[]" on
115
+ // the wire — the API reads an absent labels key as "leave them alone" (RUBE-46).
92
116
  return client.request('PATCH', ticketPath(a.display_id), {
93
- body: { status: a.status, publicSummary: a.public_summary },
117
+ body: {
118
+ status: a.status, publicSummary: a.public_summary,
119
+ priority: a.priority, labels: a.labels,
120
+ },
94
121
  });
95
122
  }));
96
123
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "punchline-mcp",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "description": "MCP stdio server exposing the Punchline external API as tools",
5
5
  "type": "module",
6
6
  "license": "MIT",