get_tag
Retrieve a specific tag by its ID or abid from ArchiveBox, including associated snapshots for organized web archive management.
Instructions
Get a specific Tag by id or abid.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tag_id | Yes | The ID or abid of the tag | |
| with_snapshots | No | Whether to include snapshots |
Implementation Reference
- archivebox_api/archivebox_mcp.py:442-487 (handler)MCP tool handler for 'get_tag' that creates an ArchiveBox Api client instance with provided credentials and calls its get_tag method to fetch the tag data as JSON.def get_tag( tag_id: str = Field( description="The ID or abid of the tag", ), with_snapshots: bool = Field(True, description="Whether to include snapshots"), 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: """ Get a specific Tag by id or abid. """ client = Api( url=archivebox_url, username=username, password=password, token=token, api_key=api_key, verify=verify, ) response = client.get_tag( tag_id=tag_id, with_snapshots=with_snapshots, ) return response.json()
- archivebox_api/archivebox_mcp.py:431-441 (registration)Registration of the 'get_tag' tool using FastMCP's @mcp.tool decorator, excluding auth parameters from the tool schema and tagging it as core.@mcp.tool( exclude_args=[ "archivebox_url", "username", "password", "token", "api_key", "verify", ], tags={"core"}, )
- Input schema for the get_tag tool defined using Pydantic Field with descriptions, defaults from environment variables for authentication parameters.tag_id: str = Field( description="The ID or abid of the tag", ), with_snapshots: bool = Field(True, description="Whether to include snapshots"), 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:
- Supporting Api.get_tag method in the ArchiveBox client class that performs an authenticated HTTP GET request to retrieve the specific tag from the ArchiveBox API endpoint.def get_tag(self, tag_id: str, with_snapshots: bool = True) -> requests.Response: """ Get a specific Tag by id or abid Args: tag_id: The ID or abid of the tag. with_snapshots: Whether to include snapshots (default: True). Returns: Response: The response object from the GET request. Raises: ParameterError: If the provided parameters are invalid. """ try: response = self._session.get( url=f"{self.url}/api/v1/core/tag/{tag_id}", params={"with_snapshots": with_snapshots}, headers=self.headers, verify=self.verify, ) except ValidationError as e: raise ParameterError(f"Invalid parameters: {e.errors()}") return response