set_auth_token
Set the JWT Bearer token to authenticate API requests with Ambivo MCP Server, enabling access to its natural language querying tools.
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 generic call_tool handler. Extracts the token from arguments, sets it via api_client, caches if enabled, and returns success message.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-215 (registration)Registers the 'set_auth_token' tool with its description and input schema in the list_tools handler.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:62-71 (helper)Helper method on AmbivoAPIClient that sets the authentication token after validating its format if enabled.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
- ambivo_mcp_server/server.py:205-214 (schema)Input schema definition for the set_auth_token tool, specifying the required 'token' parameter.inputSchema={ "type": "object", "properties": { "token": { "type": "string", "description": "JWT Bearer token for authentication with Ambivo API", } }, "required": ["token"], },