jira_search_issues
Search Jira issues by project and assignee to streamline project tracking. Input project key, assignee name, and authentication details to retrieve relevant tickets efficiently.
Instructions
Searches for Jira issues by project and assignee
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| apiToken | No | API token for Jira authentication | |
| assigneeName | No | The display name of the assignee to filter by (e.g., 'John Doe') | |
| No | Email address associated with the Jira account | ||
| jiraHost | No | The Jira host URL (e.g., 'your-domain.atlassian.net') | |
| projectKey | Yes | The Jira project key (e.g., 'PROJECT') |
Implementation Reference
- src/tools/searchIssues.ts:59-124 (handler)Core handler function that validates input, constructs JQL query for project and optional assignee, calls Jira REST API /search endpoint, formats issues into a markdown table, and returns structured response.export async function searchIssues(args: any) { const validatedArgs = await JiraSearchIssuesRequestSchema.validate(args); const jiraHost = validatedArgs.jiraHost || process.env.JIRA_HOST; const email = validatedArgs.email || process.env.JIRA_EMAIL; const apiToken = validatedArgs.apiToken || process.env.JIRA_API_TOKEN; const projectKey = validatedArgs.projectKey; const assigneeName = validatedArgs.assigneeName; if (!jiraHost || !email || !apiToken) { throw new Error('Missing required authentication credentials. Please provide jiraHost, email, and apiToken.'); } validateCredentials(jiraHost, email, apiToken); let jql = `project = "${projectKey}"`; if (assigneeName) { jql += ` AND assignee ~ "${assigneeName}"`; } jql += ` ORDER BY created DESC`; const authHeader = createAuthHeader(email, apiToken); const response = await axios.get(`https://${jiraHost}/rest/api/3/search`, { params: { jql, maxResults: 50, fields: "summary,status,assignee,created,issuetype,priority", }, headers: { 'Authorization': authHeader, 'Accept': 'application/json', }, }); const searchResults = response.data; const issues = searchResults.issues || []; let formattedResponse = `# Issues for Project: ${projectKey}`; if (assigneeName) { formattedResponse += ` assigned to ${assigneeName}`; } formattedResponse += "\n\n"; if (issues.length > 0) { formattedResponse += "| Issue Key | Summary | Status | Type | Assignee | Created |\n"; formattedResponse += "|-----------|---------|--------|------|----------|--------|\n"; issues.forEach((issue: any) => { const key = issue.key; const summary = issue.fields.summary || 'No summary'; const status = issue.fields.status?.name || 'Unknown'; const type = issue.fields.issuetype?.name || 'Unknown'; const assignee = issue.fields.assignee?.displayName || 'Unassigned'; const created = new Date(issue.fields.created).toLocaleDateString(); formattedResponse += `| ${key} | ${summary} | ${status} | ${type} | ${assignee} | ${created} |\n`; }); } else { formattedResponse += "No issues found matching the specified criteria."; } return { content: [{ type: "text", text: formattedResponse }], isError: false, }; }
- src/validators/index.ts:52-59 (schema)Yup validation schema for jira_search_issues tool inputs, extending base JiraApiRequestSchema with required projectKey and optional assigneeName.export const JiraSearchIssuesRequestSchema = JiraApiRequestSchema.shape({ projectKey: yup.string() .required("Project key is required") .matches(/^[A-Z][A-Z0-9_]+$/, "Invalid project key format. Only uppercase letters, numbers, and underscores are allowed"), assigneeName: yup.string() .optional() .min(2, "Assignee name must be at least 2 characters long"), });
- src/handlers/handlerTools.ts:36-39 (registration)Registration of the jira_search_issues tool in the toolConfigs map used by handleCallTool, mapping name to schema and handler function.jira_search_issues: { schema: JiraSearchIssuesRequestSchema, handler: searchIssues },
- src/handlers/handlerListTools.ts:63-80 (registration)Tool description registration in handleListTools for MCP tool listing, including name, description, and input schema.name: "jira_search_issues", description: "Searches for Jira issues by project and assignee", inputSchema: { type: "object", properties: { ...getCommonJiraProperties(), projectKey: { type: "string", description: "The Jira project key (e.g., 'PROJECT')", }, assigneeName: { type: "string", description: "The display name of the assignee to filter by (e.g., 'John Doe')", }, }, required: ["projectKey"], }, },
- src/tools/searchIssues.ts:12-44 (schema)JSON schema description for the jira_search_issues tool inputs, exported but possibly not directly used (similar to the one in handlerListTools).export const searchIssuesToolDescription = { name: "jira_search_issues", description: "Searches for Jira issues by project and assignee", inputSchema: { type: "object", properties: { jiraHost: { type: "string", description: "The Jira host URL (e.g., 'your-domain.atlassian.net')", default: process.env.JIRA_HOST || "", }, email: { type: "string", description: "Email address associated with the Jira account", default: process.env.JIRA_EMAIL || "", }, apiToken: { type: "string", description: "API token for Jira authentication", default: process.env.JIRA_API_TOKEN || "", }, projectKey: { type: "string", description: "The Jira project key (e.g., 'PROJECT')", }, assigneeName: { type: "string", description: "The display name of the assignee to filter by (e.g., 'John Doe')", }, }, required: ["projectKey"], }, };