Skip to main content
Glama

health_check

Verify system health by checking database connections, S3/MinIO storage access, and required database extensions for academic literature management.

Instructions

检查系统健康状态

验证数据库连接、S3/MinIO 存储桶访问以及必要的数据库扩展是否正常。

Returns: 健康状态信息,包含: - ok: 整体状态是否正常 - db: 数据库连接状态 - s3: S3/MinIO 存储状态

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function for the 'health_check' tool. It checks the database connection using check_connection(), S3 storage using check_bucket(), computes an overall health status, and returns a dictionary with the results.
    def health_check() -> dict[str, Any]:
        """检查系统健康状态
        
        验证数据库连接、S3/MinIO 存储桶访问以及必要的数据库扩展是否正常。
        
        Returns:
            健康状态信息,包含:
            - ok: 整体状态是否正常
            - db: 数据库连接状态
            - s3: S3/MinIO 存储状态
        """
        # 检查数据库
        db_status = check_connection()
        
        # 检查 S3
        s3_status = check_bucket()
        
        # 综合判断
        ok = (
            db_status.get("connected", False) 
            and db_status.get("vector_enabled", False)
            and s3_status.get("accessible", False)
        )
        
        return {
            "ok": ok,
            "db": db_status,
            "s3": s3_status,
        }
  • The registration function that defines and registers the health_check tool using the @mcp.tool() decorator on the FastMCP instance.
    def register_health_tools(mcp: FastMCP) -> None:
        """注册健康检查工具"""
    
        @mcp.tool()
        def health_check() -> dict[str, Any]:
            """检查系统健康状态
            
            验证数据库连接、S3/MinIO 存储桶访问以及必要的数据库扩展是否正常。
            
            Returns:
                健康状态信息,包含:
                - ok: 整体状态是否正常
                - db: 数据库连接状态
                - s3: S3/MinIO 存储状态
            """
            # 检查数据库
            db_status = check_connection()
            
            # 检查 S3
            s3_status = check_bucket()
            
            # 综合判断
            ok = (
                db_status.get("connected", False) 
                and db_status.get("vector_enabled", False)
                and s3_status.get("accessible", False)
            )
            
            return {
                "ok": ok,
                "db": db_status,
                "s3": s3_status,
            }
  • The top-level call in the MCP server entrypoint that registers the health tools, including health_check, by invoking register_health_tools(mcp).
    register_health_tools(mcp)

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/h-lu/paperlib-mcp'

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