Skip to main content
Glama
Cyreslab-AI

Nessus MCP Server

get_scan_results

Retrieve detailed results of a completed scan by specifying its unique ID, enabling efficient analysis and reporting of vulnerabilities.

Instructions

Get the results of a completed scan

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scan_idYesID of the scan to get results for

Implementation Reference

  • The primary handler for the 'get_scan_results' tool. Validates the scan_id argument, fetches results via getScanResults helper, handles errors, formats output using formatScanResults, and returns MCP-formatted content.
    export const getScanResultsToolHandler = async (args: Record<string, unknown>) => {
      try {
        // Validate arguments
        const scanId = validateScanId(args.scan_id);
    
        // Get scan results
        const results = await getScanResults(scanId);
    
        // Check if there was an error
        if ('error' in results) {
          return {
            content: [
              {
                type: 'text',
                text: `Error: ${results.error}`
              }
            ],
            isError: true
          };
        }
    
        // Format the results
        const formattedResults = formatScanResults(results);
    
        return {
          content: [
            {
              type: 'text',
              text: formattedResults
            }
          ]
        };
      } catch (error) {
        const mcpError = handleNessusApiError(error);
        return {
          content: [
            {
              type: 'text',
              text: `Error: ${mcpError.message}`
            }
          ],
          isError: true
        };
      }
    };
  • The input schema definition for the 'get_scan_results' tool, specifying the required scan_id parameter.
    export const getScanResultsToolSchema = {
      name: 'get_scan_results',
      description: 'Get the results of a completed scan',
      inputSchema: {
        type: 'object',
        properties: {
          scan_id: {
            type: 'string',
            description: 'ID of the scan to get results for'
          }
        },
        required: ['scan_id']
      }
    };
  • src/index.ts:103-104 (registration)
    Tool dispatch registration in the main CallToolRequestSchema handler switch statement.
    case 'get_scan_results':
      return await getScanResultsToolHandler(args);
  • src/index.ts:75-84 (registration)
    Tool schema registration in the ListToolsRequestSchema handler, where getScanResultsToolSchema is listed among available tools.
      tools: [
        listScanTemplatesToolSchema,
        startScanToolSchema,
        getScanStatusToolSchema,
        getScanResultsToolSchema,
        listScansToolSchema,
        getVulnerabilityDetailsToolSchema,
        searchVulnerabilitiesToolSchema
      ]
    };
  • Core helper function called by the tool handler to retrieve scan results from Nessus API (mock or real).
    export const getScanResults = async (scanId: string) => {
      if (config.useMock) {
        return getMockScanResults(scanId);
      }
    
      // Real API implementation would go here
      throw new Error("Real API not implemented");
    };
Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Cyreslab-AI/nessus-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server