check_polarion_status
Verify Polarion authentication and connection status to diagnose login issues, confirm setup before exploration, and troubleshoot when other tools return errors.
Instructions
<purpose>Verify Polarion authentication and connection status</purpose>
<when_to_use>
- When experiencing authentication errors
- To verify setup before starting exploration
- When debugging connection issues
- As a diagnostic tool when other tools fail
</when_to_use>
<workflow_position>
DIAGNOSTIC: Use when authentication issues occur
VERIFICATION: Use after set_polarion_token() to confirm setup
TROUBLESHOOTING: Use when other tools return 401 errors
</workflow_position>
<output>
Authentication status and next steps if issues found
</output>
<next_steps>
If no token: Use open_polarion_login() then set_polarion_token()
If token exists: Try get_polarion_projects() to test connectivity
</next_steps>
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- polarion_mcp/server.py:390-436 (handler)The primary handler function for the 'check_polarion_status' tool. Decorated with @mcp.tool() for registration. It verifies the existence of a Polarion authentication token by checking the global polarion_client instance and a local token file, then returns a JSON status report with recommended next steps.@mcp.tool() def check_polarion_status() -> str: """ <purpose>Verify Polarion authentication and connection status</purpose> <when_to_use> - When experiencing authentication errors - To verify setup before starting exploration - When debugging connection issues - As a diagnostic tool when other tools fail </when_to_use> <workflow_position> DIAGNOSTIC: Use when authentication issues occur VERIFICATION: Use after set_polarion_token() to confirm setup TROUBLESHOOTING: Use when other tools return 401 errors </workflow_position> <output> Authentication status and next steps if issues found </output> <next_steps> If no token: Use open_polarion_login() then set_polarion_token() If token exists: Try get_polarion_projects() to test connectivity </next_steps> """ logger.info("Checking Polarion status") TOKEN_FILE = "polarion_token.json" status = { "has_token": bool(polarion_client.token or polarion_client.load_token()), "token_saved": os.path.exists(TOKEN_FILE) } next_steps = [] if not status["has_token"]: next_steps.append("Use open_polarion_login() to authenticate") next_steps.append("Then use set_polarion_token() with generated token") else: next_steps.append("Authentication appears ready") next_steps.append("Use get_polarion_projects() to begin exploration") return json.dumps({ "status": "success", "polarion_status": status, "next_steps": next_steps }, indent=2)
- polarion_mcp/client.py:142-151 (helper)The load_token method of the PolarionClient class, directly called by the handler to check for a saved authentication token from 'polarion_token.json'.def load_token(self) -> Optional[str]: """Load token from file""" try: if os.path.exists(TOKEN_FILE): with open(TOKEN_FILE, 'r') as f: token_data = json.load(f) return token_data.get("token") except Exception as e: logger.error(f"Failed to load token: {e}") return None
- polarion_mcp/server.py:12-13 (helper)Global instantiation of PolarionClient used by all Polarion MCP tools, including check_polarion_status.# Global Polarion client instance polarion_client = PolarionClient()
- polarion_mcp/server.py:518-518 (registration)The MCP server run call that activates all @mcp.tool() decorated functions, including check_polarion_status.mcp.run(transport="stdio")