Skip to main content
Glama

ninja_get_organization_devices

Retrieve all devices for an organization by ID. Supports device filtering and pagination for targeted results.

Instructions

Get all devices belonging to a specific organization.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesOrganization ID
dfNoDevice filter expression
pageSizeNoMax devices to return
afterNoLast device ID for pagination

Implementation Reference

  • This is the complete tool definition for 'ninja_get_organization_devices'. It is defined as a ToolDef object inside the organizationTools array. The handler extracts the 'id' from args and sends a GET request to /organization/{id}/devices with the remaining parameters cleaned via the 'clean' utility function.
    {
      tool: {
        name: 'ninja_get_organization_devices',
        description: 'Get all devices belonging to a specific organization.',
        inputSchema: {
          type: 'object',
          required: ['id'],
          properties: {
            id: { type: 'number', description: 'Organization ID' },
            df: { type: 'string', description: 'Device filter expression' },
            pageSize: { type: 'number', description: 'Max devices to return' },
            after: { type: 'number', description: 'Last device ID for pagination' },
          },
        },
      },
      handler: async ({ id, ...params }, client: NinjaOneClient) =>
        client.get(`/organization/${id}/devices`, clean(params)),
    },
  • Input schema for ninja_get_organization_devices. Requires 'id' (organization ID) and accepts optional 'df' (device filter expression), 'pageSize' (max devices), and 'after' (last device ID for pagination).
    tool: {
      name: 'ninja_get_organization_devices',
      description: 'Get all devices belonging to a specific organization.',
      inputSchema: {
        type: 'object',
        required: ['id'],
        properties: {
          id: { type: 'number', description: 'Organization ID' },
          df: { type: 'string', description: 'Device filter expression' },
          pageSize: { type: 'number', description: 'Max devices to return' },
          after: { type: 'number', description: 'Last device ID for pagination' },
        },
      },
  • The organizationTools array containing 'ninja_get_organization_devices' is exported from this file. It is then spread into the ALL_TOOLS array in src/tools/index.ts (line 15), which is the central registration point for all MCP tools.
    export const organizationTools: ToolDef[] = [
      {
        tool: {
          name: 'ninja_list_organizations',
          description: 'List all organizations (clients/customers) in NinjaOne. Supports filtering and pagination.',
          inputSchema: {
            type: 'object',
            properties: {
              pageSize: { type: 'number', description: 'Max organizations to return' },
              after: { type: 'number', description: 'Last org ID from previous page for pagination' },
              of: { type: 'string', description: 'Organization filter expression' },
            },
          },
        },
        handler: async (args, client: NinjaOneClient) => client.get('/organizations', clean(args)),
      },
      {
        tool: {
          name: 'ninja_get_organizations_detailed',
          description: 'List organizations with detailed settings, policy assignments, and node role mappings.',
          inputSchema: {
            type: 'object',
            properties: {
              pageSize: { type: 'number', description: 'Max organizations to return' },
              after: { type: 'number', description: 'Last org ID for pagination' },
              of: { type: 'string', description: 'Organization filter expression' },
            },
          },
        },
        handler: async (args, client: NinjaOneClient) =>
          client.get('/organizations-detailed', clean(args)),
      },
      {
        tool: {
          name: 'ninja_get_organization',
          description: 'Get detailed information about a specific organization.',
          inputSchema: {
            type: 'object',
            required: ['id'],
            properties: {
              id: { type: 'number', description: 'Organization ID' },
            },
          },
        },
        handler: async ({ id }, client: NinjaOneClient) => client.get(`/organization/${id}`),
      },
      {
        tool: {
          name: 'ninja_create_organization',
          description: 'Create a new organization (client) in NinjaOne.',
          inputSchema: {
            type: 'object',
            required: ['name'],
            properties: {
              name: { type: 'string', description: 'Organization name' },
              description: { type: 'string', description: 'Organization description' },
              nodeApprovalMode: {
                type: 'string',
                enum: ['AUTOMATIC', 'MANUAL', 'REJECT'],
                description: 'How new devices are approved',
              },
              tags: { type: 'array', items: { type: 'string' }, description: 'Organization tags' },
              fields: {
                type: 'object',
                description: 'Custom field values',
                additionalProperties: true,
              },
            },
          },
        },
        handler: async (args, client: NinjaOneClient) => client.post('/organizations', args),
      },
      {
        tool: {
          name: 'ninja_update_organization',
          description: 'Update an existing organization.',
          inputSchema: {
            type: 'object',
            required: ['id'],
            properties: {
              id: { type: 'number', description: 'Organization ID' },
              name: { type: 'string', description: 'Organization name' },
              description: { type: 'string', description: 'Organization description' },
              nodeApprovalMode: {
                type: 'string',
                enum: ['AUTOMATIC', 'MANUAL', 'REJECT'],
                description: 'How new devices are approved',
              },
            },
          },
        },
        handler: async ({ id, ...body }, client: NinjaOneClient) =>
          client.patch(`/organization/${id}`, body),
      },
      {
        tool: {
          name: 'ninja_get_organization_devices',
          description: 'Get all devices belonging to a specific organization.',
          inputSchema: {
            type: 'object',
            required: ['id'],
            properties: {
              id: { type: 'number', description: 'Organization ID' },
              df: { type: 'string', description: 'Device filter expression' },
              pageSize: { type: 'number', description: 'Max devices to return' },
              after: { type: 'number', description: 'Last device ID for pagination' },
            },
          },
        },
        handler: async ({ id, ...params }, client: NinjaOneClient) =>
          client.get(`/organization/${id}/devices`, clean(params)),
      },
      {
        tool: {
          name: 'ninja_get_organization_locations',
          description: 'Get all locations for an organization.',
          inputSchema: {
            type: 'object',
            required: ['id'],
            properties: {
              id: { type: 'number', description: 'Organization ID' },
            },
          },
        },
        handler: async ({ id }, client: NinjaOneClient) =>
          client.get(`/organization/${id}/locations`),
      },
      {
        tool: {
          name: 'ninja_create_organization_location',
          description: 'Create a new location for an organization.',
          inputSchema: {
            type: 'object',
            required: ['id', 'name'],
            properties: {
              id: { type: 'number', description: 'Organization ID' },
              name: { type: 'string', description: 'Location name' },
              description: { type: 'string', description: 'Location description' },
              address: { type: 'string', description: 'Street address' },
              city: { type: 'string', description: 'City' },
              state: { type: 'string', description: 'State or province' },
              country: { type: 'string', description: 'Country code (e.g. US)' },
              zipCode: { type: 'string', description: 'Postal/ZIP code' },
            },
          },
        },
        handler: async ({ id, ...body }, client: NinjaOneClient) =>
          client.post(`/organization/${id}/locations`, body),
      },
      {
        tool: {
          name: 'ninja_get_organization_custom_fields',
          description: 'Get custom field values for an organization.',
          inputSchema: {
            type: 'object',
            required: ['id'],
            properties: {
              id: { type: 'number', description: 'Organization ID' },
              withInheritance: {
                type: 'boolean',
                description: 'Include inherited custom field values',
              },
            },
          },
        },
        handler: async ({ id, ...params }, client: NinjaOneClient) =>
          client.get(`/organization/${id}/custom-fields`, clean(params)),
      },
      {
        tool: {
          name: 'ninja_get_organization_end_users',
          description: 'Get end users associated with an organization.',
          inputSchema: {
            type: 'object',
            required: ['id'],
            properties: {
              id: { type: 'number', description: 'Organization ID' },
            },
          },
        },
        handler: async ({ id }, client: NinjaOneClient) =>
          client.get(`/organization/${id}/end-users`),
      },
    ];
  • ALL_TOOLS aggregates all tool definitions including organizationTools (which contains ninja_get_organization_devices) for registration with the MCP server.
    export const ALL_TOOLS = [
      ...deviceTools,
      ...organizationTools,
      ...alertTools,
      ...activityTools,
      ...ticketingTools,
      ...queryTools,
      ...policyTools,
      ...userTools,
      ...backupTools,
      ...systemTools,
    ];
  • The ToolDef interface used to type the tool definition objects, consisting of a 'tool' (Tool from MCP SDK) and a 'handler' function that takes args and a NinjaOneClient.
    export interface ToolDef {
      tool: Tool;
      // eslint-disable-next-line @typescript-eslint/no-explicit-any
      handler: (args: any, client: NinjaOneClient) => Promise<unknown>;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations exist, and the description does not disclose behavioral traits beyond the basic operation. It says 'Get all devices' but the schema includes pagination parameters, implying a single call may not return all devices. It also omits details about authentication requirements, rate limits, or return structure.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, focused sentence with no unnecessary words. It could be improved by including a brief note about key parameters (e.g., 'id') or pagination, but it's efficiently short.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, no output schema, and 4 parameters, the description is incomplete. It fails to explain that 'all devices' may require multiple requests via pagination, how to use the filter expression, or what the required 'id' represents. Essential context for correct usage is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

All four parameters are described in the input schema (100% coverage), so the schema carries the semantic burden. The description adds nothing beyond implying 'belonging to a specific organization' corresponds to the 'id' parameter. The baseline of 3 is appropriate as no added value is needed.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Get' and resource 'devices belonging to a specific organization'. It differentiates from siblings like 'ninja_list_devices' (which lists all devices without org filter) and 'ninja_get_device' (single device). However, it could explicitly mention pagination or filtering to further distinguish.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description offers no guidance on when to use this tool versus alternatives. For example, it doesn't explain how this differs from 'ninja_list_devices' or 'ninja_search_devices', or when to prefer org-specific queries.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/Allied-Business-Solutions/ninjaone-mcp'

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