test_connection
Verify connectivity to the WeWork API to check service status and ensure data access for project management tasks.
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-363 (handler)The core handler function for the 'test_connection' MCP tool. It tests the connection to WeWork API by checking client initialization and fetching projects. Decorated with @mcp.tool() for registration.@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) }