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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user