test_connection
Verify connectivity to WeWork API by testing the connection and retrieving real-time status information, ensuring reliable access for project management and data analysis.
Instructions
Test kết nối với WeWork API
Returns:
Thông tin về trạng thái kết nối
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- wework_mcp_server.py:330-364 (handler)The handler function for the MCP tool 'test_connection'. It tests the connection to the WeWork API by attempting to fetch projects using the WeWorkClient. Includes the @mcp.tool() decorator which registers the tool.@mcp.tool() def test_connection() -> Dict[str, Any]: """ Test kết nối với WeWork API Returns: Thông tin về trạng thái kết nối """ try: if not wework_client: return { 'success': False, 'error': 'WeWork client not initialized', 'token_available': bool(WEWORK_ACCESS_TOKEN) } logger.info("Testing WeWork API connection") projects = wework_client.fetch_projects() return { 'success': True, 'connection_status': 'Connected', 'projects_count': len(projects) if projects else 0, 'token_available': bool(WEWORK_ACCESS_TOKEN), 'sample_projects': [p.get('name', 'Unknown') for p in (projects[:3] if projects else [])] } except Exception as e: logger.error(f"Error in test_connection: {e}") return { 'success': False, 'error': str(e), 'token_available': bool(WEWORK_ACCESS_TOKEN) }