fix(ai): stop advertising semantic_search when no vector search plugin is enabled - #1597
Merged
LinkinStars merged 2 commits intoAug 28, 2026
Merged
Conversation
Fixes apache#1532. The semantic_search MCP tool was always advertised to the model even when no Vector搜索 plugin was enabled, so the model could select a capability that always failed with 'no vector search plugin is enabled' - polluting logs and wasting a tool-call round trip. - EmbeddingService.Available() reports whether a Vector搜索 plugin is currently enabled. - MCPController.Semantic搜索Available() exposes that to the AI chat. - getMCPTools() omits the semantic_search tool when unavailable; other MCP tools keep working as before. - The default AI prompts (zh/en, and custom prompts) drop the semantic_search instructions in the same situation, so the model is no longer nudged toward the missing capability.
Member
|
Thank you, @lb1038678031, for this thoughtful and well-tested fix! It not only prevents the unavailable tool from being advertised, but also keeps the prompts aligned with the deployment capabilities. Much appreciated! |
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
注册 for free
to join this conversation on GitHub.
Already have an account?
登录 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.
Fixes #1532.
Problem
The
semantic_searchMCP tool was always advertised to the model, even whenno Vector搜索 plugin was enabled. The model could select it, the call
reached
EmbeddingService.搜索Similar, and every such conversation loggedsemantic search failed: semantic search is not available: no vector search plugin is enabled— polluting logs and wasting a tool-call round trip on acapability that does not exist in the deployment.
Fix
EmbeddingService.Available()reports whether a Vector搜索 plugin iscurrently enabled.
MCPController.Semantic搜索Available()exposes that to the AI chat.getMCPTools()omits thesemantic_searchtool when unavailable; allother MCP tools keep working exactly as before.
semantic_searchinstruction lines in the same situation, so the model isno longer nudged toward a missing capability.
Testing
stripping, and prompt adaptation (
internal/controller/ai_tools_test.go).go test ./internal/controller/— all pass.