diff --git a/src/index.ts b/src/index.ts index 9edb6e6..3e1bc51 100644 --- a/src/index.ts +++ b/src/index.ts @@ -128,6 +128,11 @@ const tools: Tool[] = [ }, description: 'Array of component names', }, + customFields: { + type: 'object', + description: 'Map of additional Jira field IDs/keys (e.g., customfield_10211) to include in the fields payload', + additionalProperties: true, + }, }, required: ['projectKey', 'summary', 'issueType'], }, @@ -169,6 +174,11 @@ const tools: Tool[] = [ type: 'string', description: 'New status/workflow state (e.g., "In Progress", "Done")', }, + customFields: { + type: 'object', + description: 'Map of additional Jira field IDs/keys (e.g., customfield_10211) to include in the fields payload', + additionalProperties: true, + }, }, required: ['issueKey'], }, @@ -346,6 +356,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => { assignee: args.assignee as string, labels: args.labels as string[], components: args.components as string[], + customFields: args.customFields as Record, }; const issue = await getJiraClient().createIssue(input); return { @@ -365,6 +376,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => { assignee: args.assignee as string, priority: args.priority as string, labels: args.labels as string[], + customFields: args.customFields as Record, status: args.status as string, }; const issue = await getJiraClient().updateIssue(args.issueKey as string, input); diff --git a/src/jira-client.ts b/src/jira-client.ts index 6fc0a47..3a71d0f 100644 --- a/src/jira-client.ts +++ b/src/jira-client.ts @@ -52,6 +52,8 @@ export interface CreateIssueInput { assignee?: string; labels?: string[]; components?: string[]; + // Pass-through map for Jira custom fields (e.g., { customfield_10211: 10015 }) + customFields?: Record; } export interface UpdateIssueInput { @@ -61,6 +63,8 @@ export interface UpdateIssueInput { priority?: string; labels?: string[]; status?: string; + // Pass-through map for Jira custom fields to update + customFields?: Record; } export interface JiraComment { @@ -138,6 +142,11 @@ export class JiraClient { issueData.fields.components = input.components.map(c => ({ name: c })); } + // Merge any provided custom fields directly into the fields payload + if (input.customFields && typeof input.customFields === 'object') { + Object.assign(issueData.fields, input.customFields); + } + const response = await this.client.post('/issue', issueData); return await this.getIssue(response.data.key); } @@ -167,6 +176,11 @@ export class JiraClient { updateData.fields.labels = input.labels; } + // Merge any provided custom fields directly into the fields payload + if (input.customFields && typeof input.customFields === 'object') { + Object.assign(updateData.fields, input.customFields); + } + await this.client.put(`/issue/${issueKey}`, updateData); // Handle status transition separately if provided