Skip to main content
Glama

cli_remove

Remove archived snapshots from ArchiveBox using timestamp filters and pattern matching to manage storage and clean up outdated content.

Instructions

Execute archivebox remove command.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deleteNoDelete matching snapshots
afterNoFilter snapshots after timestamp
beforeNoFilter snapshots before timestamp
filter_typeNoFilter typeexact
filter_patternsNoList of filter patterns
extra_dataNoAdditional parameters as a dictionary

Implementation Reference

  • Primary handler and registration for the MCP tool 'cli_remove'. Includes input schema definitions using Pydantic Fields and the execution logic that wraps the ArchiveBox API client call.
    @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 in the ArchiveBoxApi class that performs the actual HTTP POST request to the ArchiveBox server's /api/v1/cli/remove endpoint.
    @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

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/Knuckles-Team/archivebox-api'

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