ninja_approve_devices
Approve or reject pending devices in bulk using device IDs to manage device approval workflows.
Instructions
Approve or reject devices that are pending approval.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | Yes | Approval action to take | |
| deviceIds | Yes | Device IDs to approve or reject |
Implementation Reference
- src/tools/devices.ts:513-514 (handler)The handler function that executes the tool logic. It accepts mode ('APPROVE' or 'REJECT') and deviceIds, then makes a POST request to /devices/approval/{mode} with the device IDs.
handler: async ({ mode, deviceIds }, client: NinjaOneClient) => client.post(`/devices/approval/${mode}`, { devices: deviceIds }), - src/tools/devices.ts:496-511 (schema)Input schema for the tool, requiring 'mode' (string enum APPROVE/REJECT) and 'deviceIds' (array of numbers).
inputSchema: { type: 'object', required: ['mode', 'deviceIds'], properties: { mode: { type: 'string', enum: ['APPROVE', 'REJECT'], description: 'Approval action to take', }, deviceIds: { type: 'array', items: { type: 'number' }, description: 'Device IDs to approve or reject', }, }, }, - src/tools/devices.ts:492-515 (registration)Tool is registered as part of the deviceTools array in src/tools/devices.ts, which is re-exported via src/tools/index.ts and used in src/index.ts to build the tool map and list available tools.
{ tool: { name: 'ninja_approve_devices', description: 'Approve or reject devices that are pending approval.', inputSchema: { type: 'object', required: ['mode', 'deviceIds'], properties: { mode: { type: 'string', enum: ['APPROVE', 'REJECT'], description: 'Approval action to take', }, deviceIds: { type: 'array', items: { type: 'number' }, description: 'Device IDs to approve or reject', }, }, }, }, handler: async ({ mode, deviceIds }, client: NinjaOneClient) => client.post(`/devices/approval/${mode}`, { devices: deviceIds }), }, - src/index.ts:24-24 (registration)The tool handler is dynamically registered into a Map at server startup by mapping ALL_TOOLS by name.
const toolMap = new Map(ALL_TOOLS.map((def) => [def.tool.name, def.handler]));