From a1710ec4dba0d84eb9ce72759e799aa331223924 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 25 Jun 2026 13:05:55 +0800 Subject: [PATCH] refactor(main): count MCP tools at INFO, per-tool details at DEBUG Production log noise: every container start was emitting 14 INFO lines listing every tool name and full description, which is dev-time debugging info that doesn't belong in INFO. Now: - INFO: one line per service with the count 'MCP service \042spark_executor\042: 14 tool(s) registered' - DEBUG: per-tool name + description, prefixed with the service name so multi-service deploys are grep-friendly ' spark_executor._prepare_submit_job_prepare_submit_job_post - ...' Operators can flip SPARK_EXECUTOR_LOG_LEVEL=INFO for production (no per-tool spam) or DEBUG for dev (full inventory). 146/146 still pass. Live verified: at INFO level only the count line shows; at DEBUG level both the count and per-tool lines show. --- main.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index b88fc3f..b06e52a 100644 --- a/main.py +++ b/main.py @@ -50,13 +50,16 @@ def _log_mcp_tools(mcp_server, service: McpService) -> None: scannable. Each tool is logged on one line: ` N. tool_name - desc`. """ tools = mcp_server.tools - logger.info(f"MCP tools registered ({service.name}, {len(tools)}):") + # Single INFO line per service summarizing how many tools it exposes. + # Per-tool name + description is DEBUG-level so production logs (INFO) + # stay scannable but operators can flip to DEBUG to see the full list. + logger.info(f"MCP service {service.name!r}: {len(tools)} tool(s) registered") for i, tool in enumerate(tools, 1): desc = (tool.description or "").strip() if "### Responses" in desc: desc = desc.split("### Responses", 1)[0].rstrip() desc = " ".join(desc.split()) - logger.info(f" {i:>2}. {tool.name} - {desc}") + logger.debug(f" {service.name}.{tool.name} - {desc}") @asynccontextmanager