Skip to content

Enhancement: Order tool list by usage so truncating clients keep key tools#369

Merged
rafaeljusto merged 1 commit into
mainfrom
enhancement/tools-order
Jun 26, 2026
Merged

Enhancement: Order tool list by usage so truncating clients keep key tools#369
rafaeljusto merged 1 commit into
mainfrom
enhancement/tools-order

Conversation

@rafaeljusto

Copy link
Copy Markdown
Contributor

Description

MCP clients that cap the tool list at a fixed size were dropping commonly used tools, since the go-sdk returns tools sorted alphabetically by name. Reorder the tools/list response to surface the most useful tools first, falling back to alphabetical order for the rest.

The preferred order is registered via the new toolsets.RegisterToolOrder registry (mirroring the existing profile registry) from internal/cli, which references the concrete Method constants. This keeps config free of the twdesk -> config import cycle and avoids hard-coded tool-name strings.

image

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Testing

  • Tests pass locally (go test -v ./...)
  • Added/updated tests for new functionality

Checklist

  • Code follows project style guidelines
  • Self-reviewed the code
  • Added necessary documentation
  • No new warnings or errors

…tools

MCP clients that cap the tool list at a fixed size were dropping
commonly used tools, since the go-sdk returns tools sorted alphabetically
by name. Reorder the tools/list response to surface the most useful tools
first, falling back to alphabetical order for the rest.

The preferred order is registered via the new toolsets.RegisterToolOrder
registry (mirroring the existing profile registry) from internal/cli, which
references the concrete Method constants. This keeps config free of the
twdesk -> config import cycle and avoids hard-coded tool-name strings.
@rafaeljusto rafaeljusto requested a review from a team as a code owner June 25, 2026 18:54
@rafaeljusto rafaeljusto merged commit 641852d into main Jun 26, 2026
3 checks passed
@rafaeljusto rafaeljusto deleted the enhancement/tools-order branch June 26, 2026 11:02
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.

2 participants