set_polarion_token
Configure your Polarion access token to authenticate with the requirements management system after generating it in your browser.
Instructions
<purpose>Set Polarion access token after generating it in browser</purpose>
<when_to_use>
- After using open_polarion_login() and generating token manually
- When you have a valid Polarion token to configure
- When replacing an expired token
</when_to_use>
<workflow_position>
STEP 2: Use this after open_polarion_login() and manual token generation
NEXT: Use check_polarion_status() to verify token is working
THEN: Begin data exploration with get_polarion_projects()
</workflow_position>
<parameters>
- token: The bearer token generated from Polarion's user token page
</parameters>
<output>Confirmation of token storage and next steps</output>
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| token | Yes |
Implementation Reference
- polarion_mcp/server.py:95-120 (handler)MCP tool handler decorated with @mcp.tool(). Defines input schema via type annotation (token: str) and implements logic by delegating to PolarionClient.set_token_manually(token). This serves as both handler and registration.@mcp.tool() def set_polarion_token(token: str) -> str: """ <purpose>Set Polarion access token after generating it in browser</purpose> <when_to_use> - After using open_polarion_login() and generating token manually - When you have a valid Polarion token to configure - When replacing an expired token </when_to_use> <workflow_position> STEP 2: Use this after open_polarion_login() and manual token generation NEXT: Use check_polarion_status() to verify token is working THEN: Begin data exploration with get_polarion_projects() </workflow_position> <parameters> - token: The bearer token generated from Polarion's user token page </parameters> <output>Confirmation of token storage and next steps</output> """ logger.info("Setting Polarion token manually") return polarion_client.set_token_manually(token)
- polarion_mcp/client.py:116-131 (helper)Core helper method in PolarionClient class that stores the token in memory, persists it to 'polarion_token.json' file via save_token(), and returns formatted JSON response.def set_token_manually(self, token: str) -> str: """Set token manually (after user generates it in browser)""" try: self.token = token self.save_token(token) return json.dumps({ "status": "success", "message": "Token set successfully. Please test it by fetching work items or projects.", "token_preview": f"{token[:10]}...{token[-10:]}" }, indent=2) except Exception as e: logger.error(f"Failed to set token: {e}") return json.dumps({ "status": "error", "message": f"Failed to set token: {e}" }, indent=2)