Skip to main content
Glama

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
NameRequiredDescriptionDefault
device_idYesNinjaOne device ID

Implementation Reference

  • 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,
          );
        }
      },
    );
  • 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"),
    },
  • 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,
          );
        }
      },
    );
  • 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 };
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/fredriksknese/mcp-ninjaone'

If you have feedback or need assistance with the MCP directory API, please join our Discord server