import asyncio from fastmcp import Client async def call_tool( query: str, start: str, end: str, step: str, vendor: str = "local", region: str = "r1", tenant: str = "t1", cluster_id: str = "c1", ): client = Client("http://localhost:8000/mcp") async with client: result = await client.call_tool( "query_range", { "query": query, "start": start, "end": end, "step": step, "vendor": vendor, "region": region, "tenant": tenant, "cluster_id": cluster_id, }, ) print(result) if __name__ == "__main__": asyncio.run( call_tool( "histogram_quantile(0.99,+sum(rate(tidb_session_transaction_duration_seconds_bucket%7Bscope%3D~%22general%22%7D[2m]))+by+(le))+or+vector(0)", "2026-01-29T00:00:00Z", "2026-01-29T01:00:00Z", "5m", ) )