update_device_meta
Assign or unassign devices to people, update their status (defaults to 'active' when assigned), location, and assignment dates. Unassigned devices require 'in_stock' or 'decommissioned' status.
Instructions
Update device's meta information including assignment info (peopleId, status, dates) and location. Use this to assign/unassign devices to people. When unassigned, status should be 'in_stock' or 'decommissioned'. When assigned without status, defaults to 'active'.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| deviceId | Yes | The ID of the device to update | |
| status | No | Device status. If 'in_stock' or 'decommissioned', device will be unassigned and assignment dates cleared | |
| peopleId | No | People ID to assign device to. Set to null to unassign. Cannot assign if status is 'in_stock' or 'decommissioned' | |
| assignmentStartDate | No | Assignment start date (YYYY-MM-DD). Cannot set if status is 'in_stock' or 'decommissioned' | |
| assignmentEndDate | No | Assignment end date (YYYY-MM-DD). Cannot set if status is 'in_stock' or 'decommissioned' | |
| location1 | No | Primary location information | |
| location2 | No | Secondary location information |
Implementation Reference
- src/tools/updateDeviceMeta.ts:35-48 (handler)The main handler function for the update_device_meta tool. It builds a request body from the provided fields and calls the PATCH API endpoint /devices/{deviceId}/meta.
export async function updateDeviceMeta(params: UpdateDeviceMetaParams) { const client = getClient(); const body: Record<string, unknown> = {}; if (params.status !== undefined) body.status = params.status; if (params.peopleId !== undefined) body.peopleId = params.peopleId; if (params.assignmentStartDate !== undefined) body.assignmentStartDate = params.assignmentStartDate; if (params.assignmentEndDate !== undefined) body.assignmentEndDate = params.assignmentEndDate; if (params.location1 !== undefined) body.location1 = params.location1; if (params.location2 !== undefined) body.location2 = params.location2; return client.makePatchApiCall(`/devices/${params.deviceId}/meta`, body); } - src/tools/updateDeviceMeta.ts:4-31 (schema)Zod validation schema defining the input parameters for update_device_meta: deviceId (required), status, peopleId, assignmentStartDate, assignmentEndDate, location1, location2.
export const UpdateDeviceMetaSchema = z.object({ deviceId: z.number().describe("The ID of the device to update"), status: z .enum(["in_stock", "pre_use", "active", "missing", "malfunction", "decommissioned", "on_order"]) .optional() .describe( "Device status. If 'in_stock' or 'decommissioned', device will be unassigned and assignment dates cleared", ), peopleId: z .number() .nullable() .optional() .describe( "People ID to assign device to. Set to null to unassign. Cannot assign if status is 'in_stock' or 'decommissioned'", ), assignmentStartDate: z .string() .nullable() .optional() .describe("Assignment start date (YYYY-MM-DD). Cannot set if status is 'in_stock' or 'decommissioned'"), assignmentEndDate: z .string() .nullable() .optional() .describe("Assignment end date (YYYY-MM-DD). Cannot set if status is 'in_stock' or 'decommissioned'"), location1: z.string().optional().describe("Primary location information"), location2: z.string().optional().describe("Secondary location information"), }); - src/index.ts:130-134 (registration)Tool registration in the ListToolsRequestSchema handler: defines the tool name 'update_device_meta' with its description and JSON schema.
{ name: "update_device_meta", description: "Update device's meta information including assignment info (peopleId, status, dates) and location. Use this to assign/unassign devices to people. When unassigned, status should be 'in_stock' or 'decommissioned'. When assigned without status, defaults to 'active'.", inputSchema: zodToJsonSchema(UpdateDeviceMetaSchema), - src/index.ts:302-302 (registration)Tool handler map entry: links the tool name 'update_device_meta' to its handler function updateDeviceMeta with schema validation via parse.
update_device_meta: async (input) => updateDeviceMeta(UpdateDeviceMetaSchema.parse(input)),