ninja_query_antivirus_threats
Query antivirus threats detected across managed devices. Filter by device, set maximum results, and paginate with cursor.
Instructions
Query antivirus threats detected across all managed devices.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| df | No | Device filter expression | |
| pageSize | No | Max results to return | |
| cursor | No | Pagination cursor from previous response |
Implementation Reference
- src/tools/queries.ts:26-27 (handler)The handler for 'ninja_query_antivirus_threats' is the generic handler returned by queryTool(), which calls client.get('/queries/antivirus-threats', clean(args)). The handler executes an HTTP GET request to the NinjaOne API endpoint /v2/queries/antivirus-threats with optional pagination/device filter parameters.
handler: async (args, client: NinjaOneClient) => client.get(path, clean(args)), }; - src/tools/queries.ts:17-24 (schema)The input schema for 'ninja_query_antivirus_threats' is defined by queryTool() at line 36-40. It includes base pagination props (df, pageSize, cursor) but no extra properties, so its inputSchema accepts: df (string), pageSize (number), cursor (string).
return { tool: { name, description, inputSchema: { type: 'object', properties: { ...basePaginationProps, ...extraProps }, }, - src/tools/queries.ts:36-40 (registration)The tool 'ninja_query_antivirus_threats' is registered in the queryTools array (line 36-40) via the queryTool() helper with name 'ninja_query_antivirus_threats', description 'Query antivirus threats detected across all managed devices.', and path '/queries/antivirus-threats'.
queryTool( 'ninja_query_antivirus_threats', 'Query antivirus threats detected across all managed devices.', '/queries/antivirus-threats', ), - src/tools/index.ts:13-24 (registration)The ALL_TOOLS array in src/tools/index.ts spreads queryTools (along with other tool arrays), which is where the tool registration flows into the server registration in src/index.ts.
export const ALL_TOOLS = [ ...deviceTools, ...organizationTools, ...alertTools, ...activityTools, ...ticketingTools, ...queryTools, ...policyTools, ...userTools, ...backupTools, ...systemTools, ]; - src/index.ts:31-60 (registration)The MCP server registers all tools via ListToolsRequestSchema (line 31-33) and dispatches calls via CallToolRequestSchema (line 35-60). The tool name to handler mapping is built on line 24 using toolMap = new Map(ALL_TOOLS.map(def => [def.tool.name, def.handler])).
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, }; } });