@atlassian-dc-mcp/jira 0.34.0 → 0.36.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/src/index.ts CHANGED
@@ -157,6 +157,26 @@ server.tool(
157
157
  }
158
158
  );
159
159
 
160
+ server.tool(
161
+ "jira_watchIssue",
162
+ `Add yourself (the authenticated user) as a watcher on a JIRA issue in the ${jiraInstanceType}. Only the calling user can be added; there is no way to watch on behalf of someone else.`,
163
+ jiraToolSchemas.watchIssue,
164
+ async ({ issueKey }) => {
165
+ const result = await jiraService.watchIssue(issueKey);
166
+ return formatToolResponse(result);
167
+ }
168
+ );
169
+
170
+ server.tool(
171
+ "jira_unwatchIssue",
172
+ `Remove yourself (the authenticated user) as a watcher from a JIRA issue in the ${jiraInstanceType}. Only the calling user can be removed; there is no way to unwatch on behalf of someone else.`,
173
+ jiraToolSchemas.unwatchIssue,
174
+ async ({ issueKey }) => {
175
+ const result = await jiraService.unwatchIssue(issueKey);
176
+ return formatToolResponse(result);
177
+ }
178
+ );
179
+
160
180
  const attachmentGateway = resolveAttachmentGateway(JIRA_PRODUCT);
161
181
 
162
182
  // Filesystem-reading upload is only registered when the operator explicitly enables it.
@@ -326,6 +326,22 @@ export class JiraService {
326
326
  );
327
327
  }
328
328
 
329
+ // Only the calling user can be (un)watched — the API supports an arbitrary userName,
330
+ // but exposing that would let the tool subscribe/unsubscribe other users.
331
+ async watchIssue(issueKey: string) {
332
+ return handleApiOperation(() => IssueService.addWatcher1(issueKey), 'Error watching issue');
333
+ }
334
+
335
+ async unwatchIssue(issueKey: string) {
336
+ return handleApiOperation(async () => {
337
+ const { name } = await MyselfService.getUser();
338
+ if (!name) {
339
+ throw new Error('Could not resolve current user name');
340
+ }
341
+ return IssueService.removeWatcher1(issueKey, name);
342
+ }, 'Error unwatching issue');
343
+ }
344
+
329
345
  async validateSetup(): Promise<void> {
330
346
  await MyselfService.getUser();
331
347
  }
@@ -416,5 +432,11 @@ export const jiraToolSchemas = {
416
432
  },
417
433
  unlinkIssues: {
418
434
  linkId: z.string().describe("The id of the issue link to delete. Link ids can be found in the 'issuelinks' field of an issue (retrieve it via jira_getIssue with the 'issuelinks' field).")
435
+ },
436
+ watchIssue: {
437
+ issueKey: z.string().describe("JIRA issue key (e.g., PROJ-123)")
438
+ },
439
+ unwatchIssue: {
440
+ issueKey: z.string().describe("JIRA issue key (e.g., PROJ-123)")
419
441
  }
420
442
  };