Enrich optimizer tool descriptions for better LLM usage#4031
Merged
aponcedeleonch merged 2 commits intomainfrom Mar 6, 2026
Merged
Enrich optimizer tool descriptions for better LLM usage#4031aponcedeleonch merged 2 commits intomainfrom
aponcedeleonch merged 2 commits intomainfrom
Conversation
The `find_tool` and `call_tool` MCP tools exposed by the optimizer had minimal descriptions that did not give LLMs enough context to use them effectively. LLMs rely heavily on tool descriptions to decide when and how to invoke tools, so sparse descriptions led to poor tool discovery and incorrect invocations. This aligns the Go descriptions with the richer ones in the Python mcp-optimizer reference (`server.py`), covering: - When and why to use each tool (use cases) - What the tools return (response structure) - Workflow guidance (always call find_tool before call_tool) - Examples for find_tool queries - Detailed parameter descriptions with examples for input schemas Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
JAORMX
previously approved these changes
Mar 6, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4031 +/- ##
==========================================
- Coverage 68.61% 68.58% -0.04%
==========================================
Files 444 444
Lines 45187 45242 +55
==========================================
+ Hits 31007 31027 +20
- Misses 11780 11816 +36
+ Partials 2400 2399 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
JAORMX
approved these changes
Mar 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
find_toolandcall_toolMCP tool descriptions with detailed usage guidance, examples, and return value documentationFindToolInputandCallToolInputstruct field description tags with examples and clarificationsMotivation
LLMs rely heavily on tool descriptions to decide when and how to invoke tools. The previous descriptions were minimal (e.g.
"Call a tool by name with the given parameters"), which did not provide enough context for LLMs to use them effectively. This led to poor tool discovery and incorrect invocations in practice.The Python mcp-optimizer reference implementation (
server.py) already had rich, detailed descriptions that guided LLMs through the correct workflow (discover tools first, then call them). This PR aligns the Go optimizer tool descriptions with that reference, adapted for the vMCP context.Changes
pkg/vmcp/server/adapter/optimizer_adapter.go— Tool-level descriptions:find_tool: Now explains when to use it (discover tools, find the right tool before solving a problem), what it returns (tools with schemas + token metrics), includes an example query, and instructs the LLM to always call this beforecall_toolcall_tool: Now explains use cases, instructs to always usefind_toolfirst, and describes the result structurepkg/vmcp/optimizer/optimizer.go— Input schema field descriptions:tool_description: Now includes examples like "web search", "analyze CSV file" and explains semantic matchingtool_keywords: Now explains BM25 text search with examples like['list', 'issues', 'github']tool_name: Now clarifies to obtain fromfind_toolresultsparameters: Now clarifies structure must match the tool's input schema fromfind_toolTest plan
go build ./pkg/vmcp/...compiles successfullytask lint-fixpasses with 0 issues🤖 Generated with Claude Code