ninja_list_groups
Retrieve all device groups in NinjaOne to view, filter, and manage your organized device collections.
Instructions
List all device groups in NinjaOne.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/system.ts:12-12 (handler)The handler function for 'ninja_list_groups' that calls client.get('/groups') to list all device groups.
handler: async (_args, client: NinjaOneClient) => client.get('/groups'), - src/tools/system.ts:10-10 (schema)The input schema definition for 'ninja_list_groups' - an empty object (no parameters required).
inputSchema: { type: 'object', properties: {} }, - src/tools/system.ts:5-13 (registration)Registration of 'ninja_list_groups' as part of the systemTools array with name, description, inputSchema, and handler.
export const systemTools: ToolDef[] = [ { tool: { name: 'ninja_list_groups', description: 'List all device groups in NinjaOne.', inputSchema: { type: 'object', properties: {} }, }, handler: async (_args, client: NinjaOneClient) => client.get('/groups'), }, - src/tools/index.ts:13-24 (registration)ALL_TOOLS aggregation that includes systemTools (containing ninja_list_groups) into the full tool list.
export const ALL_TOOLS = [ ...deviceTools, ...organizationTools, ...alertTools, ...activityTools, ...ticketingTools, ...queryTools, ...policyTools, ...userTools, ...backupTools, ...systemTools, ]; - src/client.ts:47-57 (helper)The NinjaOneClient.get() helper method used by the handler to make the authenticated GET request to '/groups'.
async get<T = unknown>(path: string, params?: Record<string, unknown>): Promise<T> { try { const res = await this.http.get<T>(path, { params, headers: await this.authHeader(), }); return res.data; } catch (err) { throw new Error(`GET ${path} failed: ${apiError(err)}`); } }