start_scan
Initiate security scans on repositories to identify vulnerabilities, secrets, and patches for enhanced code safety.
Instructions
Start a new security scan on one or more repositories.
Args:
repository_ids: List of repository IDs to scan
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| repository_ids | No |
Implementation Reference
- The primary handler function for the 'start_scan' MCP tool. It is decorated with @mcp.tool() for automatic registration and schema generation. Handles input validation, JSON parsing for repository_ids, calls the ZeroPath API to start scans, and formats success/error responses.@mcp.tool() def start_scan(repository_ids: list[str] = None) -> str: """ Start a new security scan on one or more repositories. Args: repository_ids: List of repository IDs to scan """ if not repository_ids: return "Error: At least one repository ID is required" # Handle case where repository_ids might be passed as a JSON string if isinstance(repository_ids, str): try: repository_ids = json.loads(repository_ids) except json.JSONDecodeError: # If it's a single ID as a string, wrap it in a list repository_ids = [repository_ids] response, error = make_api_request( "scans/start", {"repositoryIds": repository_ids} ) if error: return error if response.status_code == 200: result = response.json() scan_id = result.get("scanId", result.get("id", "unknown")) return f"Scan started successfully. Scan ID: {scan_id}" elif response.status_code == 401: return "Error: Unauthorized - check API credentials" elif response.status_code == 400: return f"Error: Bad request - {response.text}" else: return f"Error: API returned status {response.status_code}: {response.text}"