@assetlab/mcp-server 1.14.0 → 1.14.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -32,12 +32,12 @@ export function registerWriteTools(server, client) {
32
32
  // ============================================================
33
33
  // 1. Work Orders (scope: work_orders)
34
34
  // ============================================================
35
- server.tool('create_work_order', 'Create a new work order. Requires work_orders:write scope. IMPORTANT — Location hierarchy: always resolve top-down by calling list_sites first, then list_buildings filtered by site_id, then list_locations filtered by building_id. Provide all three IDs (site_id, building_id, location_id) explicitly.', {
35
+ server.tool('create_work_order', 'Create a new work order. Requires work_orders:write scope. REQUIRED fields: title, site_id, building_id, AND at least one association (asset_id OR location_id). A work order with no asset/location association is not valid ask the user which one applies before calling. RECOMMENDED: work_category_id (look up via list_work_categories; omit only if no reasonable match exists). Location hierarchy: always resolve top-down by calling list_sites first, then list_buildings filtered by site_id, then list_locations filtered by building_id.', {
36
36
  title: z.string().min(1).max(500).describe('Work order title (required)'),
37
37
  description: z.string().optional().describe('Detailed description'),
38
38
  priority: z.enum(['LOW', 'MEDIUM', 'HIGH', 'URGENT']).optional().describe('Priority level'),
39
39
  status: z.enum(['NEW', 'IN_PROGRESS', 'ON_HOLD', 'REJECTED', 'COMPLETED', 'CANCELLED']).optional().describe('Status'),
40
- type: z.enum(['PM', 'DEMAND']).optional().describe('Work order type'),
40
+ type: z.enum(['PM', 'REACTIVE']).optional().describe('Work order type'),
41
41
  site_id: z.string().uuid().optional().describe('Site ID — resolve first via list_sites'),
42
42
  building_id: z.string().uuid().optional().describe('Building ID — resolve second via list_buildings filtered by site_id'),
43
43
  location_id: z.string().uuid().optional().describe('Location ID — resolve last via list_locations filtered by building_id'),
@@ -47,8 +47,11 @@ export function registerWriteTools(server, client) {
47
47
  estimated_time: z.number().min(0).optional().describe('Estimated time in hours'),
48
48
  estimated_cost: z.number().min(0).optional().describe('Estimated cost'),
49
49
  work_category_id: z.string().uuid().optional().describe('Work category ID'),
50
- assigned_to: z.string().optional().describe('Assigned user ID'),
50
+ assigned_to: z.string().optional().describe('Assigned user ID (mapped to assignees array)'),
51
+ assignees: z.array(z.string()).optional().describe('Array of assigned user IDs (alternative to assigned_to for multiple assignees)'),
51
52
  image_url: z.string().max(2000).optional().describe('Image URL (upload via create_upload_url with bucket "attachments", then set this to the public_url)'),
53
+ meter_reading: z.number().min(0).optional().describe('Meter/odometer reading at time of service'),
54
+ meter_unit: z.string().max(50).optional().describe('Meter unit (km, miles, hours, cycles)'),
52
55
  }, async (params) => {
53
56
  try {
54
57
  const result = await client.create('work-orders', buildBody(params));
@@ -64,7 +67,7 @@ export function registerWriteTools(server, client) {
64
67
  description: z.string().optional().describe('Detailed description'),
65
68
  priority: z.enum(['LOW', 'MEDIUM', 'HIGH', 'URGENT']).optional().describe('Priority level'),
66
69
  status: z.enum(['NEW', 'IN_PROGRESS', 'ON_HOLD', 'REJECTED', 'COMPLETED', 'CANCELLED']).optional().describe('Status'),
67
- type: z.enum(['PM', 'DEMAND']).optional().describe('Work order type'),
70
+ type: z.enum(['PM', 'REACTIVE']).optional().describe('Work order type'),
68
71
  site_id: z.string().uuid().optional().describe('Site ID — resolve first via list_sites'),
69
72
  building_id: z.string().uuid().optional().describe('Building ID — resolve second via list_buildings filtered by site_id'),
70
73
  location_id: z.string().uuid().optional().describe('Location ID — resolve last via list_locations filtered by building_id'),
@@ -74,8 +77,11 @@ export function registerWriteTools(server, client) {
74
77
  estimated_time: z.number().min(0).optional().describe('Estimated time in hours'),
75
78
  estimated_cost: z.number().min(0).optional().describe('Estimated cost'),
76
79
  work_category_id: z.string().uuid().optional().describe('Work category ID'),
77
- assigned_to: z.string().optional().describe('Assigned user ID'),
80
+ assigned_to: z.string().optional().describe('Assigned user ID (mapped to assignees array)'),
81
+ assignees: z.array(z.string()).optional().describe('Array of assigned user IDs (alternative to assigned_to for multiple assignees)'),
78
82
  image_url: z.string().max(2000).optional().describe('Image URL (upload via create_upload_url with bucket "attachments", then set this to the public_url)'),
83
+ meter_reading: z.number().min(0).optional().describe('Meter/odometer reading at time of service'),
84
+ meter_unit: z.string().max(50).optional().describe('Meter unit (km, miles, hours, cycles)'),
79
85
  }, async ({ id, ...rest }) => {
80
86
  try {
81
87
  const result = await client.update('work-orders', id, buildBody(rest));
@@ -132,6 +138,8 @@ export function registerWriteTools(server, client) {
132
138
  environmental_impact: z.enum(['LOW', 'MEDIUM', 'HIGH', 'CRITICAL']).optional().describe('Environmental impact level (LOW, MEDIUM, HIGH, CRITICAL)'),
133
139
  regulatory_impact: z.enum(['LOW', 'MEDIUM', 'HIGH', 'CRITICAL']).optional().describe('Regulatory impact level (LOW, MEDIUM, HIGH, CRITICAL)'),
134
140
  reputation_impact: z.enum(['LOW', 'MEDIUM', 'HIGH', 'CRITICAL']).optional().describe('Reputation impact level (LOW, MEDIUM, HIGH, CRITICAL)'),
141
+ current_meter_reading: z.number().min(0).optional().describe('Current meter/odometer reading'),
142
+ meter_unit: z.string().max(50).optional().describe('Meter unit (km, miles, hours, cycles)'),
135
143
  }, async (params) => {
136
144
  try {
137
145
  const result = await client.create('assets', buildBody(params));
@@ -164,6 +172,8 @@ export function registerWriteTools(server, client) {
164
172
  system_id: z.string().uuid().optional().describe('System ID — resolve last via list_systems filtered by system_group_id'),
165
173
  image_url: z.string().max(2000).optional().describe('Image URL'),
166
174
  last_maintenance_date: z.string().optional().describe('Last maintenance date (ISO 8601)'),
175
+ current_meter_reading: z.number().min(0).optional().describe('Current meter/odometer reading'),
176
+ meter_unit: z.string().max(50).optional().describe('Meter unit (km, miles, hours, cycles)'),
167
177
  quantity: z.number().min(0).optional().describe('Quantity'),
168
178
  unit_of_measure: z.string().max(100).optional().describe('Unit of measure'),
169
179
  unit_replacement_value: z.number().min(0).optional().describe('Unit replacement value'),
@@ -483,6 +493,9 @@ export function registerWriteTools(server, client) {
483
493
  status: z.enum(['active', 'inactive']).optional().describe('Schedule status'),
484
494
  auto_generate_wo: z.boolean().optional().describe('Auto-generate work orders'),
485
495
  floating: z.boolean().optional().describe('Floating schedule (due date based on completion)'),
496
+ meter_based: z.boolean().optional().describe('Whether this PM triggers at meter intervals (e.g. every 5000 km)'),
497
+ meter_interval: z.number().min(0).optional().describe('Meter interval — trigger every N units'),
498
+ meter_unit: z.string().max(50).optional().describe('Meter unit (km, miles, hours, cycles)'),
486
499
  start_date: z.string().optional().describe('Start date (ISO 8601)'),
487
500
  asset_ids: z.array(z.string().uuid()).optional().describe('Array of asset IDs'),
488
501
  system_ids: z.array(z.string().uuid()).optional().describe('Array of system IDs'),
@@ -522,6 +535,9 @@ export function registerWriteTools(server, client) {
522
535
  status: z.enum(['active', 'inactive']).optional().describe('Schedule status'),
523
536
  auto_generate_wo: z.boolean().optional().describe('Auto-generate work orders'),
524
537
  floating: z.boolean().optional().describe('Floating schedule (due date based on completion)'),
538
+ meter_based: z.boolean().optional().describe('Whether this PM triggers at meter intervals'),
539
+ meter_interval: z.number().min(0).optional().describe('Meter interval — trigger every N units'),
540
+ meter_unit: z.string().max(50).optional().describe('Meter unit (km, miles, hours, cycles)'),
525
541
  start_date: z.string().optional().describe('Start date (ISO 8601)'),
526
542
  asset_ids: z.array(z.string().uuid()).optional().describe('Array of asset IDs'),
527
543
  system_ids: z.array(z.string().uuid()).optional().describe('Array of system IDs'),