Skip to content

feat(cli): /tools lists every tool available in this session#231

Merged
emal-avala merged 1 commit intomainfrom
feat/tools-command
Apr 23, 2026
Merged

feat(cli): /tools lists every tool available in this session#231
emal-avala merged 1 commit intomainfrom
feat/tools-command

Conversation

@emal-avala
Copy link
Copy Markdown
Member

Summary

Adds /tools — a slash command that prints every tool currently registered on the active query engine.

Complements:

  • /skills — lists the user-authored .md skill surface
  • /help — lists slash commands, not tools

Why this exists: users troubleshooting "the agent didn't call the tool I expected" have no way to confirm which tools are actually available — they have to read source or guess from error messages. /tools closes that gap in one shot.

Example

> /tools
31 tool(s) available:
  Agent                  Launch a subagent to handle a complex task autonomously...
  AskUserQuestion        Ask the user a structured question with optional choices...
  Bash                   Run a shell command in the session cwd with optional...
  ...

Output is alphabetized for stable diffing across sessions. Each row is <name> <one-line description>, with descriptions whitespace-collapsed to one line and clipped at 120 chars so rows stay readable in any terminal width.

Implementation

  • New pub fn tools(&self) -> &ToolRegistry accessor on QueryEngine so CLI surfaces can introspect the registry without knowing engine internals
  • execute_tools helper in commands/mod.rs that sorts + renders
  • Two pure helpers (render_tool_summary, clip_summary) kept testable without needing an engine

Test plan

  • cargo clippy --workspace --tests --no-deps -- -D warnings — clean
  • cargo test -p agent-code --bin agent commands::tests::render_tool_summary — 2/2 pass
  • cargo test -p agent-code --bin agent commands::tests::clip_summary — 3/3 pass

5 new tests:

  1. render_tool_summary collapses / whitespace to single spaces
  2. render_tool_summary pads the name column to 22 chars for alignment
  3. clip_summary passes short strings through unchanged
  4. clip_summary truncates long strings with a trailing
  5. clip_summary respects char (not byte) boundaries for multi-byte glyphs

Adds /tools — a slash command that prints every tool currently
registered on the active query engine. Complements /skills (which
lists the user-authored .md skill surface) and /help (which lists
slash commands, not tools).

Why this exists: users troubleshooting 'the agent didn't call the
tool I expected' have no way to confirm which tools are actually
available — they have to read source or guess from error messages.
/tools closes that gap in one shot.

Output is alphabetized for stable diffing across sessions; each row
is `<name>  <one-line description>`, with descriptions whitespace-
collapsed to one line and clipped at 120 chars so rows stay
readable in any terminal width.

Implementation:

- New `pub fn tools(&self) -> &ToolRegistry` accessor on
  QueryEngine so CLI surfaces can introspect the registry without
  knowing engine internals
- execute_tools helper in commands/mod.rs that sorts + renders
- Two new pure helpers (render_tool_summary, clip_summary) kept
  testable without needing an engine

Tests: 5 new
- render_tool_summary collapses \n and \t whitespace to single spaces
- render_tool_summary pads the name column to 22 chars for alignment
- clip_summary passes short strings through unchanged
- clip_summary truncates long strings with a trailing …
- clip_summary respects char (not byte) boundaries for multi-byte glyphs
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@emal-avala emal-avala merged commit ae40e0e into main Apr 23, 2026
14 checks passed
@emal-avala emal-avala deleted the feat/tools-command branch April 23, 2026 22:35
@emal-avala emal-avala mentioned this pull request Apr 24, 2026
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant