Skip to main content
Glama
agentience

Tribal Knowledge Service

by agentience

get_api_status

Check the operational status of the Tribal Knowledge Service API to verify connectivity and functionality for error tracking and learning.

Instructions

Check the API status.

Returns:
    API status information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function for the 'get_api_status' MCP tool. It checks the external API health by making a GET request to '/health' using the make_api_request helper.
    @mcp.tool()
    async def get_api_status() -> Dict:
        """
        Check the API status.
    
        Returns:
            API status information
        """
        return await make_api_request("GET", "/health")
  • Alternative handler for 'get_api_status' MCP tool. Returns static status information about the Tribal MCP server including 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__,
        }
  • Helper utility function used by the get_api_status handler (and other tools) to perform HTTP requests to the backend Tribal 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()
  • Explicit tool execution handler that registers and dispatches the 'get_api_status' tool (among others) by calling the appropriate handler function.
    @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}")

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/agentience/tribal_mcp_server'

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