diff --git a/src/beaver_gateway/frontends/markdown/renderer.py b/src/beaver_gateway/frontends/markdown/renderer.py index 6009a95..2c3e765 100644 --- a/src/beaver_gateway/frontends/markdown/renderer.py +++ b/src/beaver_gateway/frontends/markdown/renderer.py @@ -42,9 +42,11 @@ USER_SCAFFOLD = "### User:\n" # contain ``` and we get language syntax highlighting in Obsidian for free. FENCE = "````" -# Used when a tool input mentions a path/file we can dangle in the -# callout title — purely cosmetic. -_PATH_KEYS = ("path", "file", "filename", "url", "command", "query") +# Input keys we dangle after the tool name in the callout title, best +# first — purely cosmetic. ``description`` wins because when a tool +# offers one it's a human-written summary of the call, which beats a +# truncated shell command or path. +_TITLE_KEYS = ("description", "path", "file", "filename", "url", "command", "query") def render_user_text(content: str) -> str: @@ -114,9 +116,9 @@ def append_to_body(existing: str, new_block: str) -> str: def summarize_tool_input(name: str, tool_input: object) -> str: """Build the ``[!tool]- `` title string. - Tries to pick a single salient field (``path``, ``command``, etc.) - from the input dict so the collapsed callout shows something - meaningful in Obsidian. Falls back to just the tool name. + Tries to pick a single salient field (``description``, ``path``, + ``command``, etc.) from the input dict so the collapsed callout shows + something meaningful in Obsidian. Falls back to just the tool name. """ if not isinstance(tool_input, dict): return name @@ -125,7 +127,7 @@ def summarize_tool_input(name: str, tool_input: object) -> str: # cast keeps the rest of the function readable without sprinkling # per-line type narrowing on every ``.get`` call. d = cast("dict[str, Any]", tool_input) - for key in _PATH_KEYS: + for key in _TITLE_KEYS: value = d.get(key) if isinstance(value, str) and value: short = value if len(value) <= 60 else value[:57] + "..."