create_work_item
Create a work item in Alibaba Cloud DevOps to track tasks, assign team members, and manage project progress with custom fields and labels.
Instructions
[Project Management] Create a work item
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| organizationId | Yes | Organization ID | |
| spaceId | Yes | Space ID, project unique identifier | |
| subject | Yes | Work item title | |
| workitemTypeId | Yes | Work item type ID | |
| assignedTo | Yes | Assignee user ID | |
| customFieldValues | No | Custom field values | |
| description | No | Work item description | |
| labels | No | Associated label IDs | |
| parentId | No | Parent work item ID | |
| participants | No | Participant user IDs | |
| sprint | No | Associated sprint ID | |
| trackers | No | CC user IDs | |
| verifier | No | Verifier user ID | |
| versions | No | Associated version IDs |
Implementation Reference
- MCP tool handler implementation that parses input arguments using CreateWorkItemSchema and delegates to the createWorkItemFunc helper function.case "create_work_item": { const args = types.CreateWorkItemSchema.parse(request.params.arguments); const workItemInfo = await workitem.createWorkItemFunc(args.organizationId, args.assignedTo, args.spaceId, args.subject, args.workitemTypeId, args.customFieldValues, args.description, args.labels, args.parentId, args.participants, args.sprint, args.trackers, args.verifier, args.versions); return { content: [{ type: "text", text: JSON.stringify(workItemInfo, null, 2) }], }; }
- tool-registry/project-management.ts:46-50 (registration)Tool registration entry defining the name, description, and input schema for the create_work_item tool.{ name: "create_work_item", description: "[Project Management] Create a work item", inputSchema: zodToJsonSchema(types.CreateWorkItemSchema), },
- operations/projex/types.ts:271-286 (schema)Zod schema defining the input parameters and validation for creating a work item.export const CreateWorkItemSchema = z.object({ organizationId: z.string().describe("Organization ID"), spaceId: z.string().describe("Space ID, project unique identifier"), subject: z.string().describe("Work item title"), workitemTypeId: z.string().describe("Work item type ID"), assignedTo: z.string().describe("Assignee user ID"), customFieldValues: z.record(z.string()).optional().describe("Custom field values"), description: z.string().optional().describe("Work item description"), labels: z.array(z.string()).optional().describe("Associated label IDs"), parentId: z.string().optional().describe("Parent work item ID"), participants: z.array(z.string()).optional().describe("Participant user IDs"), sprint: z.string().optional().describe("Associated sprint ID"), trackers: z.array(z.string()).optional().describe("CC user IDs"), verifier: z.string().optional().describe("Verifier user ID"), versions: z.array(z.string()).optional().describe("Associated version IDs") });
- Core helper function that constructs the API payload and makes a POST request to the Yunxiao API endpoint to create the work item.export async function createWorkItemFunc( organizationId: string, assignedTo: string, spaceId: string, subject: string, workitemTypeId: string, customFieldValues?: RecordType<string, string> | undefined, description?: string | undefined, labels?: string[], parentId?: string | undefined, participants?: string[] | undefined, sprint?: string | undefined, trackers?: string[] | undefined, verifier?: string | undefined, versions?: string[] | undefined ): Promise<z.infer<typeof WorkItemSchema>> { const url = `/oapi/v1/projex/organizations/${organizationId}/workitems`; const payload: Record<string, any> = { assignedTo, spaceId, subject, workitemTypeId }; if (customFieldValues) { payload.customFieldValues = customFieldValues; } if (description !== undefined) { payload.description = description; } if (labels && labels.length > 0) { payload.labels = labels; } if (parentId !== undefined) { payload.parentId = parentId; } if (participants && participants.length > 0) { payload.participants = participants; } if (sprint !== undefined) { payload.sprint = sprint; } if (trackers && trackers.length > 0) { payload.trackers = trackers; } if (verifier !== undefined) { payload.verifier = verifier; } if (versions && versions.length > 0) { payload.versions = versions; } const response = await yunxiaoRequest(url, { method: "POST", body: payload, }); return WorkItemSchema.parse(response); }