set_auth_token
Authenticate API requests by configuring the JWT Bearer token required to access Ambivo API endpoints for natural language data queries.
Instructions
Set the authentication token for API requests. This must be called before using other tools to authenticate with the Ambivo API.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| token | Yes | JWT Bearer token for authentication with Ambivo API |
Implementation Reference
- ambivo_mcp_server/server.py:246-267 (handler)The main handler logic for the set_auth_token tool within the handle_call_tool function. Extracts the token argument, checks if provided, calls the helper to set it, caches if enabled, and returns a success message or error.if name == "set_auth_token": token = arguments.get("token") if not token: return [ types.TextContent( type="text", text="Error: Authentication token is required" ) ] # Validate and set token api_client.set_auth_token(token) # Cache the token if validation is enabled if config.token_validation_enabled: token_validator.cache_token(token) return [ types.TextContent( type="text", text="Authentication token set successfully. You can now use other tools to query the Ambivo API.", ) ]
- ambivo_mcp_server/server.py:201-216 (registration)Tool registration in handle_list_tools(), defining the name, description, and inputSchema for set_auth_token.types.Tool( name="set_auth_token", description="Set the authentication token for API requests. " "This must be called before using other tools to authenticate with the Ambivo API.", inputSchema={ "type": "object", "properties": { "token": { "type": "string", "description": "JWT Bearer token for authentication with Ambivo API", } }, "required": ["token"], }, ), ]
- ambivo_mcp_server/server.py:205-214 (schema)Input schema for the set_auth_token tool, requiring a 'token' string property.inputSchema={ "type": "object", "properties": { "token": { "type": "string", "description": "JWT Bearer token for authentication with Ambivo API", } }, "required": ["token"], },
- ambivo_mcp_server/server.py:62-71 (helper)Helper method in AmbivoAPIClient class that sets the auth_token after optional validation.def set_auth_token(self, token: str): """Set the authentication token with validation""" try: if self.config.token_validation_enabled: token_validator.validate_token_format(token) self.auth_token = token self.logger.info("Authentication token set successfully") except ValueError as e: self.logger.error(f"Invalid token format: {e}") raise