ninja_get_device_installed_os_patches
Retrieve OS patch installation history for a specified device, filtering by status or date range.
Instructions
Get OS patch install history for a device.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Device ID | |
| status | No | Filter by install status | |
| installedBefore | No | Filter patches installed before this date | |
| installedAfter | No | Filter patches installed after this date |
Implementation Reference
- src/tools/devices.ts:166-167 (handler)The handler function for 'ninja_get_device_installed_os_patches' makes a GET request to /device/{id}/os-patch-installs with optional query parameters (status, installedBefore, installedAfter) filtered via the clean() utility.
handler: async ({ id, ...params }, client: NinjaOneClient) => client.get(`/device/${id}/os-patch-installs`, clean(params)), - src/tools/devices.ts:155-164 (schema)Input schema for 'ninja_get_device_installed_os_patches'. Requires device ID (number); optional filters: status, installedBefore, installedAfter (all strings).
inputSchema: { type: 'object', required: ['id'], properties: { id: { type: 'number', description: 'Device ID' }, status: { type: 'string', description: 'Filter by install status' }, installedBefore: { type: 'string', description: 'Filter patches installed before this date' }, installedAfter: { type: 'string', description: 'Filter patches installed after this date' }, }, }, - src/tools/devices.ts:151-168 (registration)Tool registration within the deviceTools array: defines name, description, input schema, and handler. Exported via deviceTools, aggregated in ALL_TOOLS, and registered via ListToolsRequestSchema/CallToolRequestSchema handlers in src/index.ts.
{ tool: { name: 'ninja_get_device_installed_os_patches', description: 'Get OS patch install history for a device.', inputSchema: { type: 'object', required: ['id'], properties: { id: { type: 'number', description: 'Device ID' }, status: { type: 'string', description: 'Filter by install status' }, installedBefore: { type: 'string', description: 'Filter patches installed before this date' }, installedAfter: { type: 'string', description: 'Filter patches installed after this date' }, }, }, }, handler: async ({ id, ...params }, client: NinjaOneClient) => client.get(`/device/${id}/os-patch-installs`, clean(params)), }, - src/utils.ts:2-6 (helper)The clean() helper filters out null/undefined/empty-string values from the query parameters object before passing to the API request.
export function clean(args: Record<string, any>): Record<string, unknown> { return Object.fromEntries( Object.entries(args).filter(([, v]) => v != null && v !== ''), ); }