Skip to main content
Glama

jira_create_issue

Create a new JIRA issue in the specified project with details like summary, issue type, priority, assignee, labels, and custom fields. Streamline task management directly within your workflow.

Instructions

Creates a new JIRA issue with specified parameters

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
assigneeNo
componentsNo
customFieldsNo
descriptionNo
environmentNo
fixVersionsNo
issueTypeYes
labelsNo
parentIssueKeyNo
priorityNo
projectKeyYes
storyPointsNo
summaryYes
timeEstimateNo

Implementation Reference

  • CreateIssueHandler class: core handler executing tool logic with input validation, use case execution, error handling, and response formatting.
    export class CreateIssueHandler extends BaseToolHandler< CreateIssueParams, string > { private readonly formatter: IssueCreationFormatter; /** * Create a new CreateIssueHandler with necessary dependencies * * @param createIssueUseCase - Use case for creating issues with validation * @param projectValidator - Validator for project-related validation * @param permissionChecker - Checker for permission-related validation */ constructor(private readonly createIssueUseCase: CreateIssueUseCase) { super("JIRA", "Create Issue"); this.formatter = new IssueCreationFormatter(); } /** * Execute the handler logic * Creates a new JIRA issue with comprehensive validation and formatting * Delegates business logic to the use case * * @param params - Parameters for issue creation */ protected async execute(params: CreateIssueParams): Promise<string> { try { // Step 1: Validate parameters const validatedParams = this.validateParameters(params); this.logger.info( `Creating JIRA issue in project: ${validatedParams.projectKey}`, ); // Step 2: Map parameters to use case request const useCaseRequest: CreateIssueUseCaseRequest = { projectKey: validatedParams.projectKey, summary: validatedParams.summary, issueType: validatedParams.issueType, description: validatedParams.description, customFields: validatedParams.customFields, }; // Step 3: Execute the use case this.logger.debug("Delegating to CreateIssueUseCase", { projectKey: validatedParams.projectKey, issueType: validatedParams.issueType, summary: validatedParams.summary, }); const createdIssue = await this.createIssueUseCase.execute(useCaseRequest); // Step 4: Format and return success response this.logger.info(`Successfully created issue: ${createdIssue.key}`); return this.formatter.format(createdIssue); } catch (error) { this.logger.error(`Failed to create JIRA issue: ${error}`); throw this.enhanceError(error, params.projectKey, params.issueType); } } /** * Validate parameters using Zod schema */ private validateParameters(params: CreateIssueParams): CreateIssueParams { const result = createIssueParamsSchema.safeParse(params); if (!result.success) { const errorMessage = `Invalid issue creation parameters: ${formatZodError( result.error, )}`; throw new IssueCreateParamsValidationError(errorMessage); } return result.data; } /** * Enhance error messages for better user guidance */ private enhanceError( error: unknown, projectKey?: string, issueType?: string, ): Error { if (error instanceof JiraNotFoundError) { return new Error( `❌ **Project Not Found**\n\nProject '${projectKey}' not found or you don't have permission to create issues.\n\n**Solutions:**\n- Verify the project key is correct\n- Check your JIRA permissions\n- Use \`jira_get_projects\` to see available projects\n\n**Example:** \`jira_create_issue projectKey=MYPROJ summary="Fix bug" issueType=Bug\``, ); } if (error instanceof JiraPermissionError) { return new Error( `❌ **Permission Denied**\n\nYou don't have permission to create issues in project '${projectKey}'.\n\n**Solutions:**\n- Check your JIRA permissions for this project\n- Contact your JIRA administrator\n- Verify you have CREATE_ISSUES permission\n\n**Required Permissions:** Create Issues`, ); } if (error instanceof IssueCreateParamsValidationError) { return new Error( `❌ **Validation Error**\n\n${error.message}\n\n**Solutions:**\n- Check the format of all parameters\n- Ensure required fields are provided\n- Verify field values match expected formats\n\n**Example:** \`jira_create_issue projectKey=PROJ summary="My issue" issueType=Task\``, ); } if (error instanceof JiraApiError) { return new Error( `❌ **JIRA API Error**\n\n${error.message}\n\n**Solutions:**\n- Check all required fields are provided\n- Verify field values match JIRA requirements\n- Ensure issue type '${issueType}' exists in project '${projectKey}'\n\n**Example:** \`jira_create_issue projectKey=PROJ summary="My issue" issueType=Task\``, ); } if (error instanceof Error) { return new Error( `❌ **Creation Failed**\n\n${error.message}\n\n**Solutions:**\n- Check your parameters are valid\n- Verify the project and issue type exist\n- Try with minimal required fields first\n\n**Example:** \`jira_create_issue projectKey=PROJ summary="Test issue" issueType=Task\``, ); } return new Error( "❌ **Unknown Error**\n\nAn unknown error occurred during issue creation.\n\nPlease check your parameters and try again.", ); } }
  • Zod schema defining the input parameters and validation rules for the jira_create_issue tool.
    export const createIssueParamsSchema = z.object({ // Required fields projectKey: z .string() .min(1, "Project key is required") .max(50, "Project key too long") .regex( /^[A-Z0-9_]+$/, "Project key must contain only uppercase letters, numbers, and underscores", ), summary: z .string() .min(1, "Summary is required") .max(255, "Summary must be 255 characters or less"), issueType: z .string() .min(1, "Issue type is required") .max(50, "Issue type name too long"), // Optional core fields description: z .string() .max(32767, "Description too long (max 32,767 characters)") .optional(), priority: z.enum(["Highest", "High", "Medium", "Low", "Lowest"]).optional(), assignee: z .string() .min(1, "Assignee cannot be empty") .max(255, "Assignee identifier too long") .optional(), // Array fields with limits labels: z .array(z.string().min(1).max(255)) .max(10, "Maximum 10 labels allowed") .optional(), components: z .array(z.string().min(1).max(255)) .max(5, "Maximum 5 components allowed") .optional(), fixVersions: z .array(z.string().min(1).max(255)) .max(3, "Maximum 3 fix versions allowed") .optional(), // Parent issue for subtasks parentIssueKey: issueKeySchema.optional(), // Time tracking timeEstimate: z .string() .regex( /^\d+[wdhm]$/, "Time estimate must be in format like '2w', '3d', '4h', '30m'", ) .optional(), // Environment field environment: z .string() .max(32767, "Environment description too long") .optional(), // Story points for agile storyPoints: z .number() .int() .min(0) .max(100, "Story points must be between 0 and 100") .optional(), // Custom fields (flexible object) customFields: z.record(z.string(), z.unknown()).optional(), });
  • Tool registration configuration defining name, description, input schema, and handler binding.
    { name: "jira_create_issue", description: "Creates a new JIRA issue with specified parameters", params: createIssueParamsSchema.shape, handler: tools.jira_create_issue.handle.bind(tools.jira_create_issue), },
  • Factory creating the jira_create_issue tool handler wrapper and instantiating CreateIssueHandler.
    const createIssueHandler = new CreateIssueHandler( dependencies.createIssueUseCase, ); const updateIssueHandler = new UpdateIssueHandler( dependencies.updateIssueUseCase, ); const searchIssuesHandler = new SearchIssuesHandler( dependencies.searchIssuesUseCase, ); return { jira_get_issue: { handle: async (args: unknown) => getIssueHandler.handle(args), }, jira_get_issue_comments: { handle: async (args: unknown) => getIssueCommentsHandler.handle(args), }, jira_get_assigned_issues: { handle: async (args: unknown) => getAssignedIssuesHandler.handle(args), }, jira_create_issue: { handle: async (args: unknown) => createIssueHandler.handle(args), }, jira_update_issue: { handle: async (args: unknown) => updateIssueHandler.handle(args), }, jira_search_issues: { handle: async (args: unknown) => searchIssuesHandler.handle(args), }, };
  • Tool registry passing jira_create_issue to issue tools config for MCP server registration.
    configs: createIssueToolsConfig({ jira_get_issue: tools.jira_get_issue, jira_get_issue_comments: tools.jira_get_issue_comments, jira_get_assigned_issues: tools.jira_get_assigned_issues, jira_create_issue: tools.jira_create_issue, jira_update_issue: tools.jira_update_issue,

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Dsazz/mcp-jira'

If you have feedback or need assistance with the MCP directory API, please join our Discord server