Skip to content

fix(ai): stop advertising semantic_search when no vector search plugin is enabled - #1597

Merged
LinkinStars merged 2 commits into
apache:devfrom
lb1038678031:feat/fix-semantic-search-clean
Aug 28, 2026
Merged

fix(ai): stop advertising semantic_search when no vector search plugin is enabled#1597
LinkinStars merged 2 commits into
apache:devfrom
lb1038678031:feat/fix-semantic-search-clean

Conversation

@lb1038678031

Copy link
Copy Markdown

Fixes #1532.

Problem

The semantic_search MCP tool was always advertised to the model, even when
no Vector搜索 plugin was enabled. The model could select it, the call
reached EmbeddingService.搜索Similar, and every such conversation logged
semantic search failed: semantic search is not available: no vector search plugin is enabled — polluting logs and wasting a tool-call round trip on a
capability that does not exist in the deployment.

Fix

  • 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; all
    other MCP tools keep working exactly as before.
  • The default AI prompts (zh/en, and admin-custom prompts) drop the
    semantic_search instruction lines in the same situation, so the model is
    no longer nudged toward a missing capability.

Testing

  • 新建 unit tests: tool advertisement with/without the capability, prompt-line
    stripping, and prompt adaptation (internal/controller/ai_tools_test.go).
  • go test ./internal/controller/ — all pass.

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.
@LinkinStars
LinkinStars changed the base branch from main to dev August 28, 2026 06:54
@LinkinStars
LinkinStars merged commit 947a48b into apache:dev Aug 28, 2026
@LinkinStars

Copy link
Copy Markdown
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!

注册 for free to join this conversation on GitHub. Already have an account? 登录 to comment

标签

None yet

项目

None yet

Development

Successfully merging this pull request may close these issues.

AI chat calls semantic_search and errors out when no Vector搜索 plugin is enabled

2 participants