Skip to main content
Glama

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

Implementation Reference

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

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