ninja_get_device
Retrieve full device details by ID. Access comprehensive device information for monitoring and management.
Instructions
Get full details for a single device by ID.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Device ID |
Implementation Reference
- src/tools/devices.ts:22-34 (handler)The handler function for 'ninja_get_device'. It receives { id } from arguments and calls client.get(`/device/${id}`) to fetch full device details from the NinjaOne API.
{ tool: { name: 'ninja_get_device', description: 'Get full details for a single device by ID.', inputSchema: { type: 'object', required: ['id'], properties: { id: { type: 'number', description: 'Device ID' }, }, }, }, handler: async ({ id }, client: NinjaOneClient) => client.get(`/device/${id}`), - src/tools/devices.ts:26-32 (schema)Input schema for 'ninja_get_device'. Defines a required 'id' parameter (number) for specifying which device to retrieve.
inputSchema: { type: 'object', required: ['id'], properties: { id: { type: 'number', description: 'Device ID' }, }, }, - src/index.ts:23-24 (registration)The tool is registered at server startup: ALL_TOOLS (which includes deviceTools) are mapped by name to handlers in a toolMap, then exposed via ListToolsRequestSchema and dispatched via CallToolRequestSchema.
const ninjaClient = new NinjaOneClient(NINJA_BASE_URL, NINJA_CLIENT_ID, NINJA_CLIENT_SECRET); const toolMap = new Map(ALL_TOOLS.map((def) => [def.tool.name, def.handler])); - src/tools/index.ts:13-24 (registration)deviceTools is exported from devices.ts and included in the ALL_TOOLS array, which is consumed by index.ts for registration with the MCP server.
export const ALL_TOOLS = [ ...deviceTools, ...organizationTools, ...alertTools, ...activityTools, ...ticketingTools, ...queryTools, ...policyTools, ...userTools, ...backupTools, ...systemTools, ]; - src/utils.ts:2-6 (helper)The 'clean' utility function used by some other tool handlers, but not used by 'ninja_get_device' handler (which directly passes { id } to client.get). Included for completeness of tool infrastructure.
export function clean(args: Record<string, any>): Record<string, unknown> { return Object.fromEntries( Object.entries(args).filter(([, v]) => v != null && v !== ''), ); }