get_device
Retrieve comprehensive device details including hardware specifications, operating system, agent version, and network information by providing a NinjaOne device ID.
Instructions
Get detailed information about a specific device by its ID, including hardware, OS, agent version, and network details.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| device_id | Yes | NinjaOne device ID |
Implementation Reference
- src/tools/devices.ts:56-63 (handler)The handler function that executes the get_device tool logic. It takes a device_id parameter, calls the NinjaOne API client to fetch device details at `/device/${device_id}`, and returns the result as JSON or an error message.
async ({ device_id }) => { try { const result = await client.get(`/device/${device_id}`); return toolResult(JSON.stringify(result, null, 2)); } catch (error) { return toolResult(`Error fetching device: ${error}`, true); } }, - src/tools/devices.ts:54-54 (schema)The Zod schema definition for the get_device tool input, requiring a device_id number parameter with description 'NinjaOne device ID'.
device_id: z.number().describe("NinjaOne device ID"), - src/tools/devices.ts:50-64 (registration)The server.tool() call that registers the 'get_device' tool with the MCP server, including the tool name, description, input schema, and handler function.
server.tool( "get_device", "Get detailed information about a specific device by its ID, including hardware, OS, agent version, and network details.", { device_id: z.number().describe("NinjaOne device ID"), }, async ({ device_id }) => { try { const result = await client.get(`/device/${device_id}`); return toolResult(JSON.stringify(result, null, 2)); } catch (error) { return toolResult(`Error fetching device: ${error}`, true); } }, ); - src/index.ts:36-36 (registration)Entry point where registerDeviceTools is called to register all device tools (including get_device) with the MCP server instance.
registerDeviceTools(server, client);