get_api_status
Check the status of the API to monitor its availability and functionality. Provides immediate status information for troubleshooting and system reliability.
Instructions
Check the API status.
Returns:
API status information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/mcp_server_tribal/mcp_app.py:242-257 (handler)The primary handler function for the 'get_api_status' tool in the Tribal MCP server, decorated with @mcp.tool(). It returns the server's status, name, and version.@mcp.tool() async def get_api_status() -> Dict: """ Check the API status. Returns: API status information """ from mcp_server_tribal import __version__ return { "status": "ok", "name": "Tribal", "version": __version__, }
- Handler function for the 'get_api_status' tool in the proxy MCP server. It forwards the request to the backend API's /health endpoint.@mcp.tool() async def get_api_status() -> Dict: """ Check the API status. Returns: API status information """ return await make_api_request("GET", "/health")
- src/mcp_server_tribal/mcp_server.py:213-240 (registration)Manual registration and dispatching of tools, including 'get_api_status', in the handle_execution method.@mcp.handle_execution async def handle_execution(tool_name: str, params: Dict) -> Dict: """ Handle tool execution. Args: tool_name: Name of the tool to execute params: Tool parameters Returns: Tool execution result """ logger.info(f"Executing tool: {tool_name} with params: {json.dumps(params)}") if tool_name == "track_error": return await track_error(**params) elif tool_name == "find_similar_errors": return await find_similar_errors(**params) elif tool_name == "search_errors": return await search_errors(**params) elif tool_name == "get_error_by_id": return await get_error_by_id(**params) elif tool_name == "get_api_status": return await get_api_status() else: logger.error(f"Unknown tool: {tool_name}") raise ValueError(f"Unknown tool: {tool_name}")
- Helper function used by the proxy get_api_status handler to make HTTP requests to the backend API.async def make_api_request( method: str, endpoint: str, data: Optional[Dict] = None, params: Optional[Dict] = None, ) -> dict: """ Make an API request to the Tribal API. Args: method: HTTP method (GET, POST, PUT, DELETE) endpoint: API endpoint data: Request data params: Query parameters Returns: API response """ url = f"{API_URL}{endpoint}" headers = {"X-API-Key": API_KEY} async with httpx.AsyncClient() as client: if method == "GET": response = await client.get(url, headers=headers, params=params) elif method == "POST": response = await client.post(url, headers=headers, json=data) elif method == "PUT": response = await client.put(url, headers=headers, json=data) elif method == "DELETE": response = await client.delete(url, headers=headers) else: raise ValueError(f"Unsupported HTTP method: {method}") if response.status_code >= 400: logger.error(f"API request failed: {response.status_code} {response.text}") response.raise_for_status() if response.status_code == 204: # No content return {} return response.json()