ninja_list_locations
Retrieve a complete list of locations across all organizations, with optional pagination and filtering by organization.
Instructions
List all locations across all organizations.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| after | No | Last location ID for pagination | |
| pageSize | No | Max results to return | |
| of | No | Organization filter expression |
Implementation Reference
- src/tools/system.ts:75-77 (handler)Handler function that executes the ninja_list_locations tool logic. Calls NinjaOneClient.get('/locations') with cleaned args for pagination/filtering.
handler: async (args, client: NinjaOneClient) => client.get('/locations', clean(args)), }, - src/tools/system.ts:66-73 (schema)Input schema defining optional parameters: after (pagination), pageSize (limit), of (organization filter).
inputSchema: { type: 'object', properties: { after: { type: 'number', description: 'Last location ID for pagination' }, pageSize: { type: 'number', description: 'Max results to return' }, of: { type: 'string', description: 'Organization filter expression' }, }, }, - src/tools/system.ts:62-77 (registration)Tool definition object registered in the systemTools array, which is exported and bundled into ALL_TOOLS in src/tools/index.ts.
{ tool: { name: 'ninja_list_locations', description: 'List all locations across all organizations.', inputSchema: { type: 'object', properties: { after: { type: 'number', description: 'Last location ID for pagination' }, pageSize: { type: 'number', description: 'Max results to return' }, of: { type: 'string', description: 'Organization filter expression' }, }, }, }, handler: async (args, client: NinjaOneClient) => client.get('/locations', clean(args)), }, - src/utils.ts:2-6 (helper)Helper utility used by the handler to strip null/empty values from args before passing to client.get().
export function clean(args: Record<string, any>): Record<string, unknown> { return Object.fromEntries( Object.entries(args).filter(([, v]) => v != null && v !== ''), ); } - src/tools/index.ts:13-24 (registration)Aggregation of all tool definitions including systemTools (which contains ninja_list_locations).
export const ALL_TOOLS = [ ...deviceTools, ...organizationTools, ...alertTools, ...activityTools, ...ticketingTools, ...queryTools, ...policyTools, ...userTools, ...backupTools, ...systemTools, ];