searxng-mcp-go/mcp_test.go
XLion 291e4e101b
fix: mark search tool as read-only and open-world via ToolAnnotations (#450)
* fix: mark search tool as read-only and open-world via ToolAnnotations

* test: add unit test for search tool annotations
2026-07-02 22:45:57 +08:00

38 lines
754 B
Go

package main
import (
"encoding/json"
"testing"
)
func TestSearchToolAnnotations(t *testing.T) {
t.Parallel()
tool := newSearchTool(json.RawMessage(`{}`))
if tool.Annotations == nil {
t.Fatal("search tool should have ToolAnnotations set")
}
if !tool.Annotations.ReadOnlyHint {
t.Error("search tool ReadOnlyHint should be true")
}
if tool.Annotations.OpenWorldHint == nil {
t.Fatal("search tool OpenWorldHint should be set (non-nil)")
}
if !*tool.Annotations.OpenWorldHint {
t.Error("search tool OpenWorldHint should be true")
}
}
func TestSearchToolName(t *testing.T) {
t.Parallel()
tool := newSearchTool(json.RawMessage(`{}`))
if tool.Name != "search" {
t.Errorf("expected tool name 'search', got %q", tool.Name)
}
}