list_occurrences
Fetches all occurrences for a given issue ID, with optional filters on target addresses, tag names, and snoozed status.
Instructions
List all occurrences for a specific issue with optional filters.
Args:
issue_id: The ID of the issue to list occurrences for
target_addresses: Filter by a list of target addresses
tag_names: Filter by a list of tag names
snoozed: Filter by snoozed status (true or false)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| issue_id | Yes | ||
| target_addresses | No | ||
| tag_names | No | ||
| snoozed | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- intruder_mcp/server.py:107-127 (handler)The main tool handler for 'list_occurrences'. It's decorated with @mcp.tool() and accepts issue_id, target_addresses, tag_names, and snoozed parameters. It calls api.get_issue_occurrences_all() and formats the results as a string.
async def list_occurrences(issue_id: int, target_addresses: Optional[List[str]] = None, tag_names: Optional[List[str]] = None, snoozed: Optional[bool] = None) -> str: """ List all occurrences for a specific issue with optional filters. Args: issue_id: The ID of the issue to list occurrences for target_addresses: Filter by a list of target addresses tag_names: Filter by a list of tag names snoozed: Filter by snoozed status (true or false) """ occurrences = api.get_issue_occurrences_all( issue_id=issue_id, target_addresses=target_addresses, tag_names=tag_names, snoozed=snoozed ) formatted = [f"{occ.id} - {occ.target}:{occ.port}/{occ.protocol}" for occ in occurrences] return "\n".join(formatted) - intruder_mcp/server.py:106-107 (registration)The tool is registered via the @mcp.tool() decorator on line 106, which is part of the FastMCP framework registration pattern.
@mcp.tool() async def list_occurrences(issue_id: int, - intruder_mcp/api_client.py:80-91 (helper)Helper function 'get_issue_occurrences_all' that paginates through all occurrences for a given issue, calling get_issue_occurrences in a loop with offset-based pagination.
def get_issue_occurrences_all(self, issue_id: int, snoozed: Optional[bool] = None, tag_names: Optional[List[str]] = None, target_addresses: Optional[List[str]] = None) -> Generator[Occurrence, None, None]: offset = 0 while True: response = self.get_issue_occurrences(issue_id, snoozed=snoozed, tag_names=tag_names, target_addresses=target_addresses, limit=100, offset=offset) for occurrence in response.results: yield occurrence if not response.next: break offset += len(response.results) - intruder_mcp/api_client.py:63-78 (helper)Helper function 'get_issue_occurrences' that makes the actual API call to GET /issues/{issue_id}/occurrences/ with query parameters.
def get_issue_occurrences(self, issue_id: int, snoozed: Optional[bool] = None, tag_names: Optional[List[str]] = None, target_addresses: Optional[List[str]] = None, limit: Optional[int] = None, offset: Optional[int] = None) -> PaginatedOccurrenceList: params = {} if snoozed is not None: params["snoozed"] = snoozed if tag_names: params["tag_names"] = tag_names if target_addresses: params["target_addresses"] = target_addresses if limit: params["limit"] = limit if offset: params["offset"] = offset return PaginatedOccurrenceList(**self.client.get(f"{self.base_url}/issues/{issue_id}/occurrences/", params=params).json())