list_scans
Retrieve and monitor the status of all scans using the Nessus MCP Server. Simplify scan management by accessing a comprehensive list of active and completed scans.
Instructions
List all scans and their status
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "list_scans"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/scans.ts:237-262 (handler)The handler function for the 'list_scans' tool. It fetches the list of scans using listScans() and returns them as JSON in the MCP response format, handling errors appropriately.
export const listScansToolHandler = async () => { try { // Get all scans const scans = await listScans(); return { content: [ { type: 'text', text: JSON.stringify(scans, null, 2) } ] }; } catch (error) { const mcpError = handleNessusApiError(error); return { content: [ { type: 'text', text: `Error: ${mcpError.message}` } ], isError: true }; } }; - src/tools/scans.ts:228-235 (schema)The schema definition for the 'list_scans' tool, specifying its name, description, and empty input schema since it takes no parameters.
export const listScansToolSchema = { name: 'list_scans', description: 'List all scans and their status', inputSchema: { type: 'object', properties: {} } }; - src/index.ts:105-106 (registration)Registration of the 'list_scans' tool handler in the main tool call switch statement in the MCP server's CallToolRequestHandler.
case 'list_scans': return await listScansToolHandler(); - src/index.ts:75-83 (registration)Registration of the 'list_scans' tool schema (line 80) in the ListToolsRequestHandler response array.
tools: [ listScanTemplatesToolSchema, startScanToolSchema, getScanStatusToolSchema, getScanResultsToolSchema, listScansToolSchema, getVulnerabilityDetailsToolSchema, searchVulnerabilitiesToolSchema ] - src/nessus-api.ts:110-125 (helper)Helper function listScans() that provides the actual logic to list scans, using mock data or throwing for real API.
export const listScans = async () => { if (config.useMock) { const scans = Array.from(mockScans.values()).map(scan => ({ id: scan.id, target: scan.target, type: scan.type, status: scan.status, created: scan.created })); return { scans }; } // Real API implementation would go here throw new Error("Real API not implemented"); };