ninja_list_automation_scripts
Lists all automation scripts in your NinjaOne platform for quick access and management.
Instructions
List all automation scripts available in NinjaOne.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/system.ts:37-43 (handler)The handler for 'ninja_list_automation_scripts' makes a GET request to '/automation/scripts' via the NinjaOneClient.
{ tool: { name: 'ninja_list_automation_scripts', description: 'List all automation scripts available in NinjaOne.', inputSchema: { type: 'object', properties: {} }, }, handler: async (_args, client: NinjaOneClient) => client.get('/automation/scripts'), - src/tools/system.ts:40-41 (schema)The input schema for 'ninja_list_automation_scripts' - no parameters required (empty object).
description: 'List all automation scripts available in NinjaOne.', inputSchema: { type: 'object', properties: {} }, - src/tools/index.ts:13-24 (registration)The tool is registered in the ALL_TOOLS array via the systemTools export, which is combined into the global tool map.
export const ALL_TOOLS = [ ...deviceTools, ...organizationTools, ...alertTools, ...activityTools, ...ticketingTools, ...queryTools, ...policyTools, ...userTools, ...backupTools, ...systemTools, ]; - src/index.ts:24-24 (registration)The tool is registered in the MCP server via toolMap, which maps tool names to their handler functions.
const toolMap = new Map(ALL_TOOLS.map((def) => [def.tool.name, def.handler])); - src/client.ts:47-112 (helper)The NinjaOneClient.get() method that performs the actual GET request for '/automation/scripts'.
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)}`); } } async post<T = unknown>(path: string, body?: unknown): Promise<T> { try { const res = await this.http.post<T>(path, body, { headers: await this.authHeader(), }); return res.data; } catch (err) { throw new Error(`POST ${path} failed: ${apiError(err)}`); } } async patch<T = unknown>(path: string, body?: unknown): Promise<T> { try { const res = await this.http.patch<T>(path, body, { headers: await this.authHeader(), }); return res.data; } catch (err) { throw new Error(`PATCH ${path} failed: ${apiError(err)}`); } } async put<T = unknown>(path: string, body?: unknown): Promise<T> { try { const res = await this.http.put<T>(path, body, { headers: await this.authHeader(), }); return res.data; } catch (err) { throw new Error(`PUT ${path} failed: ${apiError(err)}`); } } async delete<T = unknown>(path: string): Promise<T> { try { const res = await this.http.delete<T>(path, { headers: await this.authHeader(), }); return res.data; } catch (err) { throw new Error(`DELETE ${path} failed: ${apiError(err)}`); } } } function apiError(err: unknown): string { if (err instanceof AxiosError) { const data = err.response?.data; if (data && typeof data === 'object') return JSON.stringify(data); if (typeof data === 'string' && data) return data; return err.message; } return String(err); }