MCPcopy Create free account
hub / github.com/bytebase/bytebase / TestSearchAPIByService

Function TestSearchAPIByService

backend/api/mcp/tool_search_test.go:33–51  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

31}
32
33func TestSearchAPIByService(t *testing.T) {
34 profile := &config.Profile{Mode: common.ReleaseModeDev}
35 s, err := NewServer(nil, profile, "test-secret")
36 require.NoError(t, err)
37
38 // Test browsing a specific service
39 result, _, err := s.handleSearchAPI(context.Background(), nil, SearchInput{
40 Service: "SQLService",
41 })
42 require.NoError(t, err)
43 require.NotNil(t, result)
44 require.Len(t, result.Content, 1)
45
46 text := result.Content[0].(*mcpsdk.TextContent).Text
47 require.Contains(t, text, "SQLService/")
48 require.Contains(t, text, "endpoints")
49 // Browse mode should not include schema
50 require.NotContains(t, text, "Request Body")
51}
52
53func TestSearchAPIByServiceNotFound(t *testing.T) {
54 profile := &config.Profile{Mode: common.ReleaseModeDev}

Callers

nothing calls this directly

Calls 3

handleSearchAPIMethod · 0.95
LenMethod · 0.80
NewServerFunction · 0.70

Tested by

no test coverage detected