ninja_reboot_device
Reboot a device with a graceful restart (NORMAL) or immediate forced restart (FORCED), recording the reason in the activity log.
Instructions
Reboot a device. NORMAL performs a graceful restart; FORCED immediately reboots without waiting for running processes.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Device ID | |
| mode | Yes | Reboot mode: NORMAL (graceful) or FORCED (immediate) | |
| reason | No | Reason for the reboot (recorded in activity log) |
Implementation Reference
- src/tools/devices.ts:395-396 (handler)The handler function that executes the device reboot. It sends a POST request to `/device/{id}/reboot/{mode}`, optionally including a reason body. The `mode` parameter is passed directly as a URL path segment (NORMAL or FORCED).
handler: async ({ id, mode, reason }, client: NinjaOneClient) => client.post(`/device/${id}/reboot/${mode}`, reason ? { reason } : undefined), - src/tools/devices.ts:381-393 (schema)Input schema for the ninja_reboot_device tool. Requires `id` (number, device ID) and `mode` (enum: NORMAL or FORCED). Optional `reason` (string) for the activity log.
inputSchema: { type: 'object', required: ['id', 'mode'], properties: { id: { type: 'number', description: 'Device ID' }, mode: { type: 'string', enum: ['NORMAL', 'FORCED'], description: 'Reboot mode: NORMAL (graceful) or FORCED (immediate)', }, reason: { type: 'string', description: 'Reason for the reboot (recorded in activity log)' }, }, }, - src/tools/index.ts:13-24 (registration)The tool is registered by being part of the `deviceTools` array (defined in devices.ts), which is spread into `ALL_TOOLS` in src/tools/index.ts. This array is the complete set of MCP tools for the application.
export const ALL_TOOLS = [ ...deviceTools, ...organizationTools, ...alertTools, ...activityTools, ...ticketingTools, ...queryTools, ...policyTools, ...userTools, ...backupTools, ...systemTools, ]; - src/tools/devices.ts:5-5 (registration)The `deviceTools` array (of type `ToolDef[]`) contains all device-related tool definitions including `ninja_reboot_device` at index/position 377-397.
export const deviceTools: ToolDef[] = [ - src/tools/types.ts:4-8 (helper)The `ToolDef` interface defines the structure: a `tool` property containing metadata (name, description, inputSchema) and a `handler` function that receives args and a `NinjaOneClient` instance.
export interface ToolDef { tool: Tool; // eslint-disable-next-line @typescript-eslint/no-explicit-any handler: (args: any, client: NinjaOneClient) => Promise<unknown>; }