cli_list
List and filter archived snapshots from ArchiveBox with customizable sorting, status filters, and output formats including JSON, HTML, or CSV.
Instructions
Execute archivebox list command.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filter_patterns | No | List of filter patterns | |
| filter_type | No | Filter type | substring |
| status | No | Filter by status | indexed |
| after | No | Filter snapshots after timestamp | |
| before | No | Filter snapshots before timestamp | |
| sort | No | Sort field | bookmarked_at |
| as_json | No | Output as JSON | |
| as_html | No | Output as HTML | |
| as_csv | No | Output as CSV or fields to include | timestamp,url |
| with_headers | No | Include headers in output | |
| extra_data | No | Additional parameters as a dictionary |
Implementation Reference
- archivebox_api/archivebox_mcp.py:785-795 (registration)Registers the MCP tool named 'cli_list' with excluded authentication arguments and 'cli' tag.@mcp.tool( exclude_args=[ "archivebox_url", "username", "password", "token", "api_key", "verify", ], tags={"cli"}, )
- archivebox_api/archivebox_mcp.py:796-865 (handler)The primary handler for the 'cli_list' MCP tool. It constructs an ArchiveBox API client using provided or env-based credentials and invokes the client's cli_list method to execute the listing logic, returning the JSON response.def cli_list( filter_patterns: Optional[List[str]] = Field( None, description="List of filter patterns" ), filter_type: str = Field("substring", description="Filter type"), status: Optional[str] = Field("indexed", description="Filter by status"), after: Optional[float] = Field(0, description="Filter snapshots after timestamp"), before: Optional[float] = Field( 999999999999999, description="Filter snapshots before timestamp" ), sort: str = Field("bookmarked_at", description="Sort field"), as_json: bool = Field(True, description="Output as JSON"), as_html: bool = Field(False, description="Output as HTML"), as_csv: Union[str, bool] = Field( "timestamp,url", description="Output as CSV or fields to include" ), with_headers: bool = Field(False, description="Include headers in output"), extra_data: Optional[Dict] = Field( None, description="Additional parameters as a dictionary" ), archivebox_url: str = Field( default=os.environ.get("ARCHIVEBOX_URL", None), description="The URL of the ArchiveBox instance", ), username: Optional[str] = Field( default=os.environ.get("ARCHIVEBOX_USERNAME", None), description="Username for authentication", ), password: Optional[str] = Field( default=os.environ.get("ARCHIVEBOX_PASSWORD", None), description="Password for authentication", ), token: Optional[str] = Field( default=os.environ.get("ARCHIVEBOX_TOKEN", None), description="Bearer token for authentication", ), api_key: Optional[str] = Field( default=os.environ.get("ARCHIVEBOX_API_KEY", None), description="API key for authentication", ), verify: Optional[bool] = Field( default=to_boolean(os.environ.get("ARCHIVEBOX_VERIFY", "True")), description="Whether to verify SSL certificates", ), ) -> dict: """ Execute archivebox list command. """ client = Api( url=archivebox_url, username=username, password=password, token=token, api_key=api_key, verify=verify, ) response = client.cli_list( filter_patterns=filter_patterns, filter_type=filter_type, status=status, after=after, before=before, sort=sort, as_json=as_json, as_html=as_html, as_csv=as_csv, with_headers=with_headers, extra_data=extra_data, ) return response.json()
- Supporting helper method in the Api class that sends a POST request to the ArchiveBox server's /api/v1/cli/list endpoint with the provided parameters to list snapshots.def cli_list( self, filter_patterns: Optional[List[str]] = None, filter_type: str = "substring", status: Optional[str] = "indexed", after: Optional[float] = 0, before: Optional[float] = 999999999999999, sort: str = "bookmarked_at", as_json: bool = True, as_html: bool = False, as_csv: Union[str, bool] = "timestamp,url", with_headers: bool = False, extra_data: Optional[Dict] = None, ) -> requests.Response: """ Execute archivebox list command Args: filter_patterns: List of filter patterns (default: ["https://example.com"]). filter_type: Filter type (default: "substring"). status: Filter by status (default: "indexed"). after: Filter snapshots after timestamp (default: 0). before: Filter snapshots before timestamp (default: 999999999999999). sort: Sort field (default: "bookmarked_at"). as_json: Output as JSON (default: True). as_html: Output as HTML (default: False). as_csv: Output as CSV or fields to include (default: "timestamp,url"). with_headers: Include headers in output (default: False). extra_data: Additional parameters as a dictionary (optional). Returns: Response: The response object from the POST request. Raises: ParameterError: If the provided parameters are invalid. """ data = { k: v for k, v in locals().items() if k != "self" and v is not None and k != "extra_data" } if filter_patterns is None: data["filter_patterns"] = ["https://example.com"] if extra_data: data.update(extra_data) try: response = self._session.post( url=f"{self.url}/api/v1/cli/list", json=data, headers=self.headers, verify=self.verify, ) except ValidationError as e: raise ParameterError(f"Invalid parameters: {e.errors()}") return response