check_typesense_health
Verify the health status of a configured Typesense server to ensure optimal search performance and database functionality.
Instructions
Checks the health status of the configured Typesense server.
Args:
ctx (Context): The MCP context, providing access to application resources.
Returns:
dict | str: The health status dictionary from Typesense or an error message.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- main.py:94-114 (handler)The handler function for the 'check_typesense_health' tool. It is registered via the @mcp.tool() decorator and executes the logic to check the Typesense server's health using the client from the application context.@mcp.tool() async def check_typesense_health(ctx: Context) -> dict | str: """ Checks the health status of the configured Typesense server. Args: ctx (Context): The MCP context, providing access to application resources. Returns: dict | str: The health status dictionary from Typesense or an error message. """ # Access the Typesense client from the lifespan context try: client: typesense.Client = ctx.request_context.lifespan_context.client health_status = await client.health.retrieve() return health_status except Exception as e: # Log the exception ideally print(f"Error checking Typesense health: {e}") return f"Error connecting to Typesense or checking health: {e}"