Skip to main content
Glama
connection.py1.79 kB
"""Wakapi connection test tool.""" from typing import Any from mcp_server import app from wakapi_sdk.core.logging import get_logger @app.tool async def test_connection() -> dict[str, Any]: """Test Wakapi server connection via simple API call to fetch projects. Returns: A dictionary with the connection test result, including: - status (str): 'success' or 'error'. - message (str): Description of the result. - projects_count (int, optional): Number of projects if successful. - server_url (str): The Wakapi server URL. - api_path (str): The API path used for requests. - error (str, optional): Error message if failed. """ logger = get_logger("connection_tool") from mcp_tools.dependency_injection import get_wakapi_client logger.info("Starting connection test", method="test_connection") client = get_wakapi_client() try: # Test connection with a simple API call projects = await client.get_projects() logger.debug( f"Projects type: {type(projects)}, data length: " f"{len(projects.data) if hasattr(projects, 'data') else 'No data attr'}" ) return { "status": "success", "message": f"Successfully connected to Wakapi server " f"({client.config.base_url})", "projects_count": len(projects.data), "server_url": client.config.base_url, "api_path": client.config.api_path, } except Exception as e: return { "status": "error", "message": f"Failed to connect to Wakapi server: {e!s}", "server_url": client.config.base_url, "api_path": client.config.api_path, "error": str(e), }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/impure0xntk/mcp-wakapi'

If you have feedback or need assistance with the MCP directory API, please join our Discord server