create_maintenance_task
Create new maintenance tasks for assets in a CMMS system, specifying type, priority, schedule, assignment, and details to manage preventive, corrective, inspection, or calibration work.
Instructions
Create a new maintenance task in CMMS system.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| assetId | Yes | Asset ID for the maintenance task | |
| taskType | Yes | Type of maintenance task | |
| priority | Yes | Priority of the task | |
| scheduledDate | Yes | Scheduled date (ISO format) | |
| dueDate | Yes | Due date (ISO format) | |
| assignedTo | Yes | Technician ID assigned to the task | |
| description | Yes | Description of the maintenance task | |
| estimatedDuration | No | Estimated duration in minutes |
Implementation Reference
- src/index.ts:708-745 (handler)The handler method `handleCreateMaintenanceTask` executes the tool logic by creating and pushing a new maintenance task to the mock data.
private handleCreateMaintenanceTask(args: { assetId: string; taskType: string; priority: string; scheduledDate: string; dueDate: string; assignedTo: string; description: string; estimatedDuration?: number; }) { const asset = mockAssets.find((a) => a.id === args.assetId); if (!asset) { throw new Error(`Asset not found: ${args.assetId}`); } const newTask: MaintenanceTask = { id: `mt-${String(mockMaintenanceTasks.length + 1).padStart(3, "0")}`, taskNumber: `MT-2024-${String(mockMaintenanceTasks.length + 1).padStart( 3, "0" )}`, assetId: args.assetId, assetName: asset.name, taskType: args.taskType as any, priority: args.priority as any, status: "scheduled", scheduledDate: args.scheduledDate, dueDate: args.dueDate, assignedTo: args.assignedTo, description: args.description, estimatedDuration: args.estimatedDuration || 240, }; mockMaintenanceTasks.push(newTask); return { content: [ { - src/index.ts:204-235 (registration)Registration of the "create_maintenance_task" tool including its input schema definition.
{ name: "create_maintenance_task", description: "Create a new maintenance task in CMMS system.", inputSchema: { type: "object", properties: { assetId: { type: "string", description: "Asset ID for the maintenance task", }, taskType: { type: "string", enum: ["preventive", "corrective", "inspection", "calibration"], description: "Type of maintenance task", }, priority: { type: "string", enum: ["low", "medium", "high", "critical"], description: "Priority of the task", }, scheduledDate: { type: "string", description: "Scheduled date (ISO format)", }, dueDate: { type: "string", description: "Due date (ISO format)", }, assignedTo: { type: "string", description: "Technician ID assigned to the task", },