ninja_submit_software_patch_apply
Apply software patches to a device by specifying patch IDs or apply all approved pending patches.
Instructions
Apply software patches on a device. Omit patchIds to apply all approved pending patches.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Device ID | |
| patchIds | No | Specific patch IDs to apply (omit to apply all approved pending patches) |
Implementation Reference
- src/tools/devices.ts:473-490 (handler)The handler function for 'ninja_submit_software_patch_apply' which calls client.post(`/device/${id}/patch/software/apply`, patchIds ? { patchIds } : undefined) to apply software patches on a device.
tool: { name: 'ninja_submit_software_patch_apply', description: 'Apply software patches on a device. Omit patchIds to apply all approved pending patches.', inputSchema: { type: 'object', required: ['id'], properties: { id: { type: 'number', description: 'Device ID' }, patchIds: { type: 'array', items: { type: 'number' }, description: 'Specific patch IDs to apply (omit to apply all approved pending patches)', }, }, }, }, handler: async ({ id, patchIds }, client: NinjaOneClient) => client.post(`/device/${id}/patch/software/apply`, patchIds ? { patchIds } : undefined), - src/tools/devices.ts:472-488 (schema)The input schema for 'ninja_submit_software_patch_apply' tool, defining 'id' (required number) and 'patchIds' (optional array of numbers).
{ tool: { name: 'ninja_submit_software_patch_apply', description: 'Apply software patches on a device. Omit patchIds to apply all approved pending patches.', inputSchema: { type: 'object', required: ['id'], properties: { id: { type: 'number', description: 'Device ID' }, patchIds: { type: 'array', items: { type: 'number' }, description: 'Specific patch IDs to apply (omit to apply all approved pending patches)', }, }, }, }, - src/tools/index.ts:13-24 (registration)The ALL_TOOLS array where deviceTools (containing the tool definition) is spread into the global tool list and exported.
export const ALL_TOOLS = [ ...deviceTools, ...organizationTools, ...alertTools, ...activityTools, ...ticketingTools, ...queryTools, ...policyTools, ...userTools, ...backupTools, ...systemTools, ]; - src/index.ts:24-24 (registration)The toolMap created from ALL_TOOLS, mapping each tool name to its handler for runtime dispatch.
const toolMap = new Map(ALL_TOOLS.map((def) => [def.tool.name, def.handler])); - src/tools/types.ts:1-8 (helper)The ToolDef interface and type that all tool definitions (including ninja_submit_software_patch_apply) conform to.
import { Tool } from '@modelcontextprotocol/sdk/types.js'; import { NinjaOneClient } from '../client.js'; export interface ToolDef { tool: Tool; // eslint-disable-next-line @typescript-eslint/no-explicit-any handler: (args: any, client: NinjaOneClient) => Promise<unknown>; }