ninja_list_node_roles
Retrieve a complete list of all available device or node roles in your NinjaOne environment.
Instructions
List all available device/node roles.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/policies.ts:51-52 (handler)Handler function that executes the tool - makes a GET request to /roles endpoint via NinjaOneClient
handler: async (_args, client: NinjaOneClient) => client.get('/roles'), }, - src/tools/policies.ts:45-52 (schema)Tool definition including inputSchema (empty object, no params) and the handler
{ tool: { name: 'ninja_list_node_roles', description: 'List all available device/node roles.', inputSchema: { type: 'object', properties: {} }, }, handler: async (_args, client: NinjaOneClient) => client.get('/roles'), }, - src/tools/index.ts:13-24 (registration)Tool registration - policyTools (containing ninja_list_node_roles) is spread into ALL_TOOLS array
export const ALL_TOOLS = [ ...deviceTools, ...organizationTools, ...alertTools, ...activityTools, ...ticketingTools, ...queryTools, ...policyTools, ...userTools, ...backupTools, ...systemTools, ]; - src/index.ts:31-33 (registration)MCP server registration - tool is listed via ListToolsRequestSchema and dispatched via CallToolRequestSchema using a handler map built from ALL_TOOLS
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: ALL_TOOLS.map((def) => def.tool), })); - src/client.ts:47-57 (helper)Helper - NinjaOneClient.get() method that performs the actual HTTP GET request to the API
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)}`); } }