Skip to main content
Glama

check_api_token

Validate API tokens for ArchiveBox authentication to ensure they are active and authorized before performing web archiving operations.

Instructions

Validate an API token to make sure it's valid and non-expired.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
token_paramNoBearer token for authentication

Implementation Reference

  • Primary MCP tool handler for 'check_api_token', including registration decorator, input schema via Pydantic Fields, and execution logic that instantiates Api client and calls its check_api_token method to validate the token against the ArchiveBox API.
    @mcp.tool( exclude_args=[ "archivebox_url", "username", "password", "token", "api_key", "verify", ], tags={"authentication"}, ) def check_api_token( token: str = Field( description="The API token to validate", ), archivebox_url: str = Field( default=os.environ.get("ARCHIVEBOX_URL", None), description="The URL of the ArchiveBox instance (e.g., https://yourinstance.archivebox.com)", ), 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_param: 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: """ Validate an API token to make sure it's valid and non-expired. """ client = Api( url=archivebox_url, username=username, password=password, token=token_param, api_key=api_key, verify=verify, ) response = client.check_api_token(token=token) return response.json()
  • Helper method in the Api class that performs the actual HTTP POST request to the ArchiveBox server's /api/v1/auth/check_api_token endpoint to validate the provided token.
    def check_api_token(self, token: str) -> requests.Response: """ Validate an API token to make sure it's valid and non-expired Args: token: The API token to validate. Returns: Response: The response object from the POST request. Raises: ParameterError: If the provided parameters are invalid. """ try: response = self._session.post( url=f"{self.url}/api/v1/auth/check_api_token", json={"token": token}, headers={"Content-Type": "application/json"}, 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