get_device_disks
Retrieve disk and storage details for a NinjaOne device, including capacity and free space, to monitor storage usage and manage device resources.
Instructions
Get disk/storage information for a specific device, including capacity and free space.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| device_id | Yes | NinjaOne device ID |
Implementation Reference
- src/tools/devices.ts:175-186 (handler)Handler function for get_device_disks tool. Takes device_id as input, makes a GET request to /device/${device_id}/disks endpoint via the NinjaOne client, and returns the disk information as JSON or an error message.
async ({ device_id }) => { try { const result = await client.get(`/device/${device_id}/disks`); return toolResult(JSON.stringify(result, null, 2)); } catch (error) { return toolResult( `Error fetching disk info: ${error}`, true, ); } }, ); - src/tools/devices.ts:172-174 (schema)Input schema definition for get_device_disks tool using Zod. Validates that device_id is a required number parameter with a description.
{ device_id: z.number().describe("NinjaOne device ID"), }, - src/tools/devices.ts:169-186 (registration)Complete registration of get_device_disks tool with MCP server. Includes tool name, description, input schema, and handler function.
server.tool( "get_device_disks", "Get disk/storage information for a specific device, including capacity and free space.", { device_id: z.number().describe("NinjaOne device ID"), }, async ({ device_id }) => { try { const result = await client.get(`/device/${device_id}/disks`); return toolResult(JSON.stringify(result, null, 2)); } catch (error) { return toolResult( `Error fetching disk info: ${error}`, true, ); } }, ); - src/tools/devices.ts:5-7 (helper)Helper utility function that creates a properly formatted MCP tool result object with text content and optional error flag.
function toolResult(text: string, isError = false) { return { content: [{ type: "text" as const, text }], isError }; }