ninja_list_users
Fetch a list of users from NinjaOne, optionally filtered by technician or end-user role.
Instructions
List all users in NinjaOne. Optionally filter by user type (TECHNICIAN or END_USER).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| userType | No | Filter by user type |
Implementation Reference
- src/tools/users.ts:21-22 (handler)Handler function that makes GET /users API call with optional filters (userType) after cleaning null/empty args.
handler: async (args, client: NinjaOneClient) => client.get('/users', clean(args)), }, - src/tools/users.ts:10-20 (schema)Input schema for ninja_list_users: optional userType enum (TECHNICIAN or END_USER).
inputSchema: { type: 'object', properties: { userType: { type: 'string', enum: ['TECHNICIAN', 'END_USER'], description: 'Filter by user type', }, }, }, }, - src/tools/users.ts:5-24 (registration)Tool is defined as a ToolDef entry in the userTools array exported from src/tools/users.ts.
export const userTools: ToolDef[] = [ { tool: { name: 'ninja_list_users', description: 'List all users in NinjaOne. Optionally filter by user type (TECHNICIAN or END_USER).', inputSchema: { type: 'object', properties: { userType: { type: 'string', enum: ['TECHNICIAN', 'END_USER'], description: 'Filter by user type', }, }, }, }, handler: async (args, client: NinjaOneClient) => client.get('/users', clean(args)), }, { tool: { - src/tools/index.ts:13-24 (registration)userTools (containing ninja_list_users) is aggregated into ALL_TOOLS array in src/tools/index.ts.
export const ALL_TOOLS = [ ...deviceTools, ...organizationTools, ...alertTools, ...activityTools, ...ticketingTools, ...queryTools, ...policyTools, ...userTools, ...backupTools, ...systemTools, ]; - src/index.ts:24-60 (registration)MCP server registration in src/index.ts: tools are listed via ListToolsRequestSchema and dispatched via CallToolRequestSchema using toolMap.
const toolMap = new Map(ALL_TOOLS.map((def) => [def.tool.name, def.handler])); const server = new Server( { name: 'ninjaone-mcp', version: '1.0.0' }, { capabilities: { tools: {} } }, ); server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: ALL_TOOLS.map((def) => def.tool), })); server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args } = request.params; const handler = toolMap.get(name); if (!handler) { return { content: [{ type: 'text', text: `Unknown tool: ${name}` }], isError: true, }; } try { const result = await handler( (args ?? {}) as Record<string, unknown>, ninjaClient, ); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; } catch (err) { return { content: [{ type: 'text', text: err instanceof Error ? err.message : String(err) }], isError: true, }; } });