MCPcopy Create free account
hub / github.com/astercloud/aster / TestMCPServer_RegisterTools

Function TestMCPServer_RegisterTools

pkg/tools/mcp/server_test.go:81–98  ·  view source on GitHub ↗

TestMCPServer_RegisterTools 测试工具注册

(t *testing.T)

Source from the content-addressed store, hash-verified

79
80// TestMCPServer_RegisterTools 测试工具注册
81func TestMCPServer_RegisterTools(t *testing.T) {
82 registry := tools.NewRegistry()
83
84 server, err := NewMCPServer(&MCPServerConfig{
85 ServerID: "test-server",
86 Endpoint: "http://localhost:8080/mcp",
87 }, registry)
88
89 if err != nil {
90 t.Fatalf("Failed to create server: %v", err)
91 }
92
93 // 在没有连接的情况下注册应该失败
94 err = server.RegisterTools()
95 if err == nil {
96 t.Error("Expected error when registering tools before connect")
97 }
98}

Callers

nothing calls this directly

Calls 4

RegisterToolsMethod · 0.95
NewRegistryFunction · 0.92
NewMCPServerFunction · 0.85
ErrorMethod · 0.65

Tested by

no test coverage detected