stacklok / stacklok/toolhive

vMCP find_tool should have a dynamic description based on available tools

Open Beginner friendly
#4,357 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement vmcp
Dominant language
Go
Stars
2.2k
Forks
300
Avg merge
1d 15h
Merged PRs (30d)
184

Description

Problem

When using the vMCP optimizer, LLM agents often don't call find_tool because its generic description doesn't give them enough context about what tools are available behind it. Agents tend to reach for built-in tools (like bash, curl, or gh) instead, making it difficult to rely on the optimizer in practice.

This has been observed across multiple clients — Claude Code handles it best but still falls back to other approaches; Cursor and Copilot are significantly worse.

Proposed Solution

Allow the vMCP operator to manually configure a custom description for find_tool via OptimizerConfig. This description is global — all users see the same description regardless of their permissions.

For example, an operator could set the description to:

"Search for available tools. I have tools for accessing GitHub and Datadog."

This gives the LLM agent a hint about what capabilities are behind find_tool, making it far more likely to actually call it.

Solution sketch

1. Add FindToolDescription to OptimizerConfig (pkg/vmcp/config/config.go):

type OptimizerConfig struct {
    // ... existing fields ...

    // FindToolDescription overrides the default find_tool tool description.
    // Use this to hint at the kinds of tools available behind the optimizer
    // (e.g. "Search for tools. I have tools for GitHub, Datadog, and Slack.").
    // When empty, the built-in default description is used.
    // +optional
    FindToolDescription string `json:"findToolDescription,omitempty" yaml:"findToolDescription,omitempty"`
}

2. Pass the description through NewDecorator (pkg/vmcp/session/optimizerdec/decorator.go):

func NewDecorator(sess sessiontypes.MultiSession, opt optimizer.Optimizer, findToolDesc string) sessiontypes.MultiSession {
    if findToolDesc == "" {
        findToolDesc = defaultFindToolDescription
    }
    return &optimizerDecorator{
        MultiSession: sess,
        opt:          opt,
        optimizerTools: []vmcp.Tool{
            {
                Name:        FindToolName,
                Description: findToolDesc,
                InputSchema: findToolInputSchema,
            },
            // ... call_tool unchanged ...
        },
    }
}

3. Thread it through the factory (pkg/vmcp/server/sessionmanager/factory.go):

The optimizerDecoratorFn already has access to the config. Pass OptimizerConfig.FindToolDescription into NewDecorator at line 190.

Future improvements (out of scope)
  • Per-permission dynamic descriptions (e.g. if a user has access to tool set X, concatenate a relevant hint to the base description)
  • LLM-generated summaries that automatically describe available tools based on the indexed backends

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with pkg/vmcp/config/config.go and inspect OptimizerConfig, then trace NewDecorator in pkg/vmcp/session/optimizerdec/decorator.go and the optimizerDecoratorFn in pkg/vmcp/server/sessionmanager/factory.go. Add the optional description flow so configured text is used for find_tool while the built-in default remains effective when empty.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, backend
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
82/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.