jira_create_subtask
Create subtasks under existing Jira issues to break down work into manageable components. Set priority, assignee, labels, and components while automatically detecting project context.
Instructions
Creates a subtask under an existing parent issue. Automatically determines the correct project and subtask issue type. Supports setting priority, assignee, labels, and components.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| assignee | No | Assignee account ID (optional) | |
| components | No | Component names (optional) | |
| description | No | Detailed subtask description (optional) | |
| labels | No | Subtask labels (optional) | |
| parentIssueKey | Yes | Parent issue key (e.g., PROJECT-123) | |
| priority | No | Subtask priority name (e.g., High, Medium, Low) - optional | |
| summary | Yes | Subtask summary/title |
Implementation Reference
- src/tools/create-subtask.ts:66-92 (handler)The handler function for the 'jira_create_subtask' tool. Validates input, prepares subtask parameters, calls the createSubtask API helper, logs progress, formats the issue response, and handles errors.export async function handleCreateSubtask(input: unknown): Promise<McpToolResponse> { try { const validated = validateInput(CreateSubtaskInputSchema, input); log.info(`Creating subtask under parent issue ${validated.parentIssueKey}...`); const subtaskParams: any = { summary: validated.summary, }; if (validated.description !== undefined) subtaskParams.description = validated.description; if (validated.priority !== undefined) subtaskParams.priority = validated.priority; if (validated.assignee !== undefined) subtaskParams.assignee = validated.assignee; if (validated.labels !== undefined) subtaskParams.labels = validated.labels; if (validated.components !== undefined) subtaskParams.components = validated.components; if (validated.format !== undefined) subtaskParams.format = validated.format; const subtask = await createSubtask(validated.parentIssueKey, subtaskParams); log.info(`Created subtask ${subtask.key}`); return formatIssueResponse(subtask); } catch (error) { log.error('Error in handleCreateSubtask:', error); return handleError(error); } }
- src/tools/create-subtask.ts:13-64 (schema)Tool definition including name ('jira_create_subtask'), description, and input schema for MCP tool listing.export const createSubtaskTool: Tool = { name: TOOL_NAMES.CREATE_SUBTASK, description: 'Creates a subtask under an existing parent issue. Automatically determines the correct project and subtask issue type. Supports setting priority, assignee, labels, and components. Description format is controlled by the "format" parameter (default: markdown).', inputSchema: { type: 'object', properties: { parentIssueKey: { type: 'string', description: 'Parent issue key (e.g., PROJECT-123)', }, summary: { type: 'string', description: 'Subtask summary/title', minLength: 1, }, description: { type: 'string', description: 'Detailed subtask description (optional). Format depends on the "format" parameter.', }, priority: { type: 'string', description: 'Subtask priority name (e.g., High, Medium, Low) - optional', }, assignee: { type: 'string', description: 'Assignee account ID (optional)', }, labels: { type: 'array', items: { type: 'string' }, description: 'Subtask labels (optional)', default: [], }, components: { type: 'array', items: { type: 'string' }, description: 'Component names (optional)', default: [], }, format: { type: 'string', enum: ['markdown', 'adf', 'plain'], description: 'Description format: "markdown" (converts Markdown to ADF, default), "adf" (use as-is ADF object), "plain" (converts plain text to ADF with basic formatting)', default: 'markdown', }, }, required: ['parentIssueKey', 'summary'], }, };
- src/types/tools.ts:210-228 (schema)Zod schema used for runtime input validation in the handler.export const CreateSubtaskInputSchema = z.object({ parentIssueKey: z.string().describe('Parent issue key'), summary: z.string().min(1).describe('Subtask summary/title'), description: z .union([z.string(), z.any()]) .optional() .describe('Subtask description. Accepts plain text or ADF object.'), priority: z.string().optional().describe('Subtask priority'), assignee: z.string().optional().describe('Assignee account ID'), labels: z.array(z.string()).optional().describe('Subtask labels'), components: z.array(z.string()).optional().describe('Component names'), format: z .enum(['markdown', 'adf', 'plain']) .optional() .default('markdown') .describe( 'Description format: "markdown" (converts Markdown to ADF), "adf" (use as-is ADF object), "plain" (converts plain text to ADF with basic formatting). Default: "markdown"' ), });
- src/index.ts:32-49 (registration)Registration of all tool handlers in a Map, including 'jira_create_subtask' mapped to handleCreateSubtask.const toolHandlers = new Map<string, (input: unknown) => Promise<any>>([ [TOOL_NAMES.GET_VISIBLE_PROJECTS, tools.handleGetVisibleProjects], [TOOL_NAMES.GET_ISSUE, tools.handleGetIssue], [TOOL_NAMES.SEARCH_ISSUES, tools.handleSearchIssues], [TOOL_NAMES.GET_MY_ISSUES, tools.handleGetMyIssues], [TOOL_NAMES.GET_ISSUE_TYPES, tools.handleGetIssueTypes], [TOOL_NAMES.GET_USERS, tools.handleGetUsers], [TOOL_NAMES.GET_PRIORITIES, tools.handleGetPriorities], [TOOL_NAMES.GET_STATUSES, tools.handleGetStatuses], [TOOL_NAMES.CREATE_ISSUE, tools.handleCreateIssue], [TOOL_NAMES.UPDATE_ISSUE, tools.handleUpdateIssue], [TOOL_NAMES.ADD_COMMENT, tools.handleAddComment], [TOOL_NAMES.GET_PROJECT_INFO, tools.handleGetProjectInfo], [TOOL_NAMES.CREATE_SUBTASK, tools.handleCreateSubtask], [TOOL_NAMES.GET_CREATE_META, tools.handleGetCreateMeta], [TOOL_NAMES.GET_CUSTOM_FIELDS, tools.handleGetCustomFields], [TOOL_NAMES.CREATE_ISSUE_LINK, tools.handleCreateIssueLink], ]);
- src/index.ts:52-69 (registration)Array of all tool definitions (with schemas) for MCP listTools request, including createSubtaskTool.const allTools = [ tools.getVisibleProjectsTool, tools.getIssueTool, tools.searchIssuesTool, tools.getMyIssuesTool, tools.getIssueTypesTool, tools.getUsersTool, tools.getPrioritiesTool, tools.getStatusesTool, tools.createIssueTool, tools.updateIssueTool, tools.addCommentTool, tools.getProjectInfoTool, tools.createSubtaskTool, tools.getCreateMetaTool, tools.getCustomFieldsTool, tools.createIssueLinkTool, ];