get_team_activity
Track recent team activity in Jira by retrieving issue updates, status changes, comments, and assignments within a specified timeframe.
Instructions
Get recent issue updates (status changes, comments, assignments) from TEAM_MEMBERS
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| timeframeDays | No | Number of days to look back (default: 7) |
Implementation Reference
- src/jira-client.ts:586-627 (handler)Core handler function that executes the tool logic: queries Jira API using JQL to find recent updates on issues assigned to or reported by team members within the given timeframe, maps results to activity items.export async function getTeamActivity( teamMembers: string[], timeframeDays: number = 7 ): Promise<JiraActivityItem[]> { const startDate = new Date(); startDate.setDate(startDate.getDate() - timeframeDays); const startDateStr = startDate.toISOString().split('T')[0]; // Build JQL for team member activity const membersList = teamMembers.map((m) => `"${m}"`).join(', '); const jql = `(assignee IN (${membersList}) OR reporter IN (${membersList})) AND updated >= "${startDateStr}" ORDER BY updated DESC`; const params = new URLSearchParams({ jql, maxResults: '50', }); // Add fields as separate params for the new API ['summary', 'status', 'assignee', 'updated'].forEach(f => params.append('fields', f)); const response = await jiraFetch<{ issues: Array<{ key: string; id: string; fields: { summary: string; status: { name: string }; assignee?: { displayName: string; accountId: string }; updated: string; }; }>; isLast?: boolean; nextPageToken?: string; }>(`/search/jql?${params.toString()}`); return response.issues.map((issue) => ({ issueKey: issue.key, teamMember: issue.fields.assignee?.displayName || 'Unassigned', activityType: 'issue_updated', timestamp: issue.fields.updated, summary: issue.fields.summary, })); }
- src/index.ts:226-275 (registration)MCP tool registration including input/output schemas, description, and wrapper handler that calls the core getTeamActivity function.server.registerTool( 'get_team_activity', { title: 'Get Team Activity', description: 'Get recent issue updates (status changes, comments, assignments) from TEAM_MEMBERS', inputSchema: { timeframeDays: z.number().optional().describe('Number of days to look back (default: 7)'), }, outputSchema: { activities: z.array(z.object({ issueKey: z.string(), teamMember: z.string(), activityType: z.string(), timestamp: z.string(), summary: z.string().optional(), })).optional(), error: z.object({ message: z.string(), statusCode: z.number().optional(), details: z.unknown().optional(), }).optional(), }, }, async ({ timeframeDays }) => { try { if (TEAM_MEMBERS.length === 0) { throw new Error('TEAM_MEMBERS is not configured. Please add team member usernames or accountIds.'); } const days = timeframeDays ?? 7; if (days < 1 || days > 365) { throw new Error('timeframeDays must be between 1 and 365'); } const activities = await getTeamActivity(TEAM_MEMBERS, days); const output = { activities }; return { content: [{ type: 'text', text: JSON.stringify(output, null, 2) }], structuredContent: output, }; } catch (error) { const output = formatError(error); return { content: [{ type: 'text', text: JSON.stringify(output, null, 2) }], structuredContent: output, isError: true, }; } } );
- src/jira-client.ts:51-57 (schema)TypeScript interface defining the structure of activity items returned by the tool.export interface JiraActivityItem { issueKey: string; teamMember: string; activityType: string; timestamp: string; summary?: string; }
- src/index.ts:32-35 (helper)Configuration constant for team members used by the get_team_activity tool.const TEAM_MEMBERS: string[] = process.env.JIRA_TEAM_MEMBERS ? process.env.JIRA_TEAM_MEMBERS.split(',').map(m => m.trim()) : [];