Skip to content

fix(autocomplete): surface arguments for one-of/all-optional tool schemas - #698

Merged
edenreich merged 2 commits into
mainfrom
fix/autocomplete-tool-argument-hints-690
Jun 30, 2026
Merged

edenreich merged 2 commits into
mainfrom
fix/autocomplete-tool-argument-hints-690

Conversation

@edenreich

@edenreich edenreich commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #690.

The !! direct-tool autocomplete only filled the skeleton with top-level required properties, so tools with no top-level required array (like the Agent tool - a one-of between tasks and description) showed a bare Agent() with no indication of what to pass. The same gap affected any tool whose useful arguments are not top-level required (one-of or all-optional schemas).

Root cause

generateToolTemplate (internal/ui/autocomplete/autocomplete.go) filled the parentheses with only the tool's top-level required properties via extractRequiredArguments. The Agent tool's schema (internal/agent/tools/agent.go) has no top-level required array - its only required is nested under tasks.items - so extractRequiredArguments returned nothing and the template was !!Agent(). The suggestion's Description was the generic "Execute tool directly" and its Usage was empty, so no parameter names/types/descriptions were surfaced anywhere.

Changes

  • generateToolArguments (new, extracted from generateToolTemplate to keep nesting under the nestif limit) - prefers top-level required properties, then falls back to all top-level properties so one-of / all-optional schemas still surface their meaningful arguments.
  • extractAllProperties (new) - builds argument templates for every top-level property, slices.Sort-ed by name for deterministic output. Returns nil when there are no properties (so parameter-less tools like WebSearch/Tree keep !!WebSearch( unchanged).
  • generateArgumentTemplate - added array -> =[] and object -> ={} cases (previously both fell through to ="").
  • generateParameterHints (new) - builds a compact name (type, required|optional) list from the schema's top-level properties and required array, sorted by name. Used to enrich the dropdown description.
  • loadTools - appends - args: <hints> to the dropdown Description when the tool has parameters.

Before / after

Agent tool (!! Age):

Before After
Skeleton Agent() Agent(description="", system_prompt="", tasks=[], type="")
Description Execute Agent tool directly Execute Agent tool directly - args: description (string, optional), system_prompt (string, optional), tasks (array, optional), type (string, optional)

Tools with top-level required (Read/Write/Bash) and parameter-less tools (WebSearch/Tree) are unchanged.

Test coverage

TestAutocomplete_ToolsAllOptionalSchema registers an Agent-shaped schema (one-of, all-optional top-level properties, with an array property and a nested required under tasks.items) and asserts:

  • The skeleton includes all top-level properties with type-appropriate defaults (=[] for array, ="" for string), in sorted order.
  • The dropdown description lists each parameter with its type and optional qualifier.
  • Filtering on !!Age and the empty !! prefix both work.

Verification

  • task test - all packages pass
  • task lint - 0 issues
  • task fmt - clean
  • pre-commit hooks passed (fmt, lint, trailing whitespace, EOF)

no docs ticket: internal-only TUI autocomplete fix

Fixed by GLM-5.2

…emas (#690)

The !! direct-tool autocomplete only filled the skeleton with top-level
required properties, so tools with no top-level required array (like the
Agent tool, a one-of between tasks and description) showed a bare Agent()
with no indication of what to pass.

generateToolArguments now falls back to all top-level properties when there
are no top-level required ones, so one-of / all-optional schemas still
surface their meaningful arguments. generateArgumentTemplate handles array
and object types ([] and {} placeholders). generateParameterHints enriches
the dropdown description with a compact name (type, required|optional) list
derived from the schema.

Net effect for Agent: the skeleton becomes
!!Agent(description="", system_prompt="", tasks=[], type="") and the
description lists args: description (string, optional), system_prompt
(string, optional), tasks (array, optional), type (string, optional).

Tools with top-level required (Read/Write/Bash) and parameter-less tools
(WebSearch/Tree) are unchanged.
@edenreich
edenreich requested a review from a team as a code owner June 30, 2026 17:02
Co-authored-by: Eden Reich <[email protected]>
@edenreich
edenreich merged commit 655b2e4 into main Jun 30, 2026
1 check passed
@edenreich
edenreich deleted the fix/autocomplete-tool-argument-hints-690 branch June 30, 2026 17:13
inference-gateway-releaser Bot added a commit that referenced this pull request Jun 30, 2026
## [0.126.0](v0.125.0...v0.126.0) (2026-06-30)

### 🚀 Features

* add persistent memory tool for agent ([#679](#679)) ([a487b13](a487b13))
* **agent:** interactive subagent management and unified background-work tracking ([#684](#684)) ([343e083](343e083))

### 🐛 Bug Fixes

* **chat:** bind opt+backspace and ctrl+backspace to delete-word-backward ([#697](#697)) ([173fe83](173fe83)), closes [#689](#689) [#576](#576)
* **a2a:** retain completed background tasks in /tasks ([#691](#691)) ([#701](#701)) ([43b8e13](43b8e13))
* **autocomplete:** surface arguments for one-of/all-optional tool schemas ([#698](#698)) ([655b2e4](655b2e4))

### ♻️ Code Refactoring

* add .gitignore by default to the projects dir ([4717deb](4717deb))
* enable memory by default ([86c2158](86c2158))
* make infer config userspace-first ([#682](#682)) ([1e77e42](1e77e42)), closes [#680](#680)
* **tui:** single event-loop ingress - one notifier, no self-rescheduling pollers ([#700](#700)) ([2ab8854](2ab8854))
* standardize comment punctuation by replacing em dashes with hyphens ([78f53a8](78f53a8))

### 📚 Documentation

* fix docs/ drift found by the README-to-codebase audit ([#687](#687)) ([413047a](413047a)), closes [#572](#572) [#686](#686)
* sync README and reference docs with the codebase ([#685](#685)) ([c328423](c328423)), closes [#572](#572) [#684](#684) [#684](#684)

### 👷 CI/CD

* **deps:** update CLAUDE workflow to version 0.14.5 ([eaba2b3](eaba2b3))

### 🧹 Maintenance

* add .infer to .gitignore ([08ef319](08ef319))
* **deps:** bump infer CLI v0.124.0 -> v0.125.0, infer-action v0.19.0 -> v0.19.1 ([#681](#681)) ([e9e7e21](e9e7e21))
* remove agent definitions ([4f7fd7d](4f7fd7d))
* remove unused configuration and shortcut files ([4c611db](4c611db))
* update claude-code to 2.1.191 ([729e81c](729e81c))
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.126.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@inference-gateway-releaser inference-gateway-releaser Bot added the released Shipped in a release label Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] !! direct-tool autocomplete shows Agent() with no arguments to pass

1 participant