Skip to content

fix: allow enumerating deferred tools - #40243

Open
masamorishita wants to merge 1 commit into
NousResearch:mainfrom
masamorishita:fix/tool-search-enumerate-deferred-tools
Open

fix: allow enumerating deferred tools#40243
masamorishita wants to merge 1 commit into
NousResearch:mainfrom
masamorishita:fix/tool-search-enumerate-deferred-tools

Conversation

@masamorishita

Copy link
Copy Markdown

Summary

  • allow the tool-search bridge to enumerate the full deferred tool catalog with query='*'
  • add offset pagination and next_offset so catalogs larger than the per-call limit can be walked completely
  • update bridge schema descriptions and regression tests for the "list every connected tool" use-case

Tests

  • uv run --with pytest --with pytest-timeout python -m pytest tests/tools/test_tool_search.py -q

@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have tool/mcp MCP client and OAuth comp/tools Tool registry, model_tools, toolsets labels Jun 6, 2026

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing deferred-tool catalog enumeration. The underlying gap is still present on current main: tools/tool_search.py:612-614 rejects an empty query, and the bridge schema at tools/tool_search.py:459-469 has no pagination field.

Problems

  • tools/tool_search.py:650-652 cannot signal another keyword-search page. search_catalog(..., limit=limit + offset) returns at most that many rows, so a full page makes offset + len(page) == len(hits) and sets next_offset to null even if more catalog entries match.
  • website/docs/user-guide/features/tool-search.md:29-35 still documents tool_search(query, limit?); it needs the wildcard, offset, and next_offset contract.

Suggested changes

  • Retrieve a sentinel result beyond the requested page (or rank all matches), then test a multi-page keyword query through completion.
  • Update the Tool Search feature documentation alongside the schema change.

Automated hermes-sweeper review.

Comment thread tools/tool_search.py

hits = search_catalog(catalog, query, limit=limit + offset)
page = hits[offset:offset + limit]
next_offset = offset + len(page) if (offset + len(page)) < len(hits) else None

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hits is capped at limit + offset on the preceding line, so a full keyword-search page makes this condition false and returns next_offset: null even when later matches exist. Fetch a sentinel result (or rank all matches) before deriving the continuation.

@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-contained Sweeper blast radius: contained — one narrow path / opt-in / few users labels Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tools Tool registry, model_tools, toolsets P3 Low — cosmetic, nice to have sweeper:blast-contained Sweeper blast radius: contained — one narrow path / opt-in / few users sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades tool/mcp MCP client and OAuth type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants