Skip to main content
Glama

get_device_software

Retrieve installed software inventory for a NinjaOne device to monitor applications and manage device configurations.

Instructions

Get the list of installed software on a specific device.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
device_idYesNinjaOne device ID

Implementation Reference

  • Handler function that executes the get_device_software tool logic. It calls the NinjaOne API endpoint /device/{device_id}/software and returns the installed software list as JSON.
    async ({ device_id }) => {
      try {
        const result = await client.get(`/device/${device_id}/software`);
        return toolResult(JSON.stringify(result, null, 2));
      } catch (error) {
        return toolResult(
          `Error fetching device software: ${error}`,
          true,
        );
      }
    },
  • Input schema definition using Zod. Defines a required device_id parameter (number) to identify which device's software to retrieve.
    {
      device_id: z.number().describe("NinjaOne device ID"),
    },
  • Tool registration using server.tool() which registers the 'get_device_software' tool with its name, description, schema, and handler function.
    server.tool(
      "get_device_software",
      "Get the list of installed software on a specific device.",
      {
        device_id: z.number().describe("NinjaOne device ID"),
      },
      async ({ device_id }) => {
        try {
          const result = await client.get(`/device/${device_id}/software`);
          return toolResult(JSON.stringify(result, null, 2));
        } catch (error) {
          return toolResult(
            `Error fetching device software: ${error}`,
            true,
          );
        }
      },
    );
  • Helper function toolResult() that formats the response content for MCP tools, creating a standardized text response with optional error flag.
    function toolResult(text: string, isError = false) {
      return { content: [{ type: "text" as const, text }], isError };
    }
  • NinjaOneClient.get() method used by the handler to make authenticated API calls to the NinjaOne REST API endpoints.
    async get(
      path: string,
      params?: Record<string, string>,
    ): Promise<unknown> {
      return this.request("GET", path, undefined, params);
    }

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