cli_remove
Remove archived snapshots from ArchiveBox using timestamp filters and pattern matching to manage your web archive collection.
Instructions
Execute archivebox remove command.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| delete | No | Delete matching snapshots | |
| after | No | Filter snapshots after timestamp | |
| before | No | Filter snapshots before timestamp | |
| filter_type | No | Filter type | exact |
| filter_patterns | No | List of filter patterns | |
| extra_data | No | Additional parameters as a dictionary |
Implementation Reference
- archivebox_api/archivebox_mcp.py:868-936 (handler)MCP tool handler for 'cli_remove': decorated with @mcp.tool, defines input schema with Pydantic Fields, creates ArchiveBox Api client, calls its cli_remove method, and returns JSON response.@mcp.tool( exclude_args=[ "archivebox_url", "username", "password", "token", "api_key", "verify", ], tags={"cli"}, ) def cli_remove( delete: bool = Field(True, description="Delete matching snapshots"), after: Optional[float] = Field(0, description="Filter snapshots after timestamp"), before: Optional[float] = Field( 999999999999999, description="Filter snapshots before timestamp" ), filter_type: str = Field("exact", description="Filter type"), filter_patterns: Optional[List[str]] = Field( None, description="List of filter patterns" ), 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 remove command. """ client = Api( url=archivebox_url, username=username, password=password, token=token, api_key=api_key, verify=verify, ) response = client.cli_remove( delete=delete, after=after, before=before, filter_type=filter_type, filter_patterns=filter_patterns, extra_data=extra_data, ) return response.json()
- Supporting helper method Api.cli_remove that sends HTTP POST request to ArchiveBox's /api/v1/cli/remove endpoint with the provided parameters.@require_auth def cli_remove( self, delete: bool = True, after: Optional[float] = 0, before: Optional[float] = 999999999999999, filter_type: str = "exact", filter_patterns: Optional[List[str]] = None, extra_data: Optional[Dict] = None, ) -> requests.Response: """ Execute archivebox remove command Args: delete: Delete matching snapshots (default: True). after: Filter snapshots after timestamp (default: 0). before: Filter snapshots before timestamp (default: 999999999999999). filter_type: Filter type (default: "exact"). filter_patterns: List of filter patterns (default: ["https://example.com"]). 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/remove", json=data, headers=self.headers, verify=self.verify, ) except ValidationError as e: raise ParameterError(f"Invalid parameters: {e.errors()}") return response
- archivebox_api/archivebox_mcp.py:868-879 (registration)The @mcp.tool decorator registers the cli_remove function as an MCP tool, excluding auth params from the tool schema.@mcp.tool( exclude_args=[ "archivebox_url", "username", "password", "token", "api_key", "verify", ], tags={"cli"}, ) def cli_remove(