fix: skip unhealthy or disabled services form nacos and always marshal AllowTools field (#3220)

Co-authored-by: EricaLiu <30773688+Erica177@users.noreply.github.com>
This commit is contained in:
aias00
2026-01-15 10:46:21 +08:00
committed by GitHub
parent f1a5f18c78
commit eb7b22d2b9
2 changed files with 5 additions and 2 deletions

View File

@@ -43,7 +43,7 @@ type McpServerRule struct {
MatchRoute []string `json:"_match_route_,omitempty"`
Server *ServerConfig `json:"server,omitempty"`
Tools []*McpTool `json:"tools,omitempty"`
AllowTools []string `json:"allowTools,omitempty"`
AllowTools []string `json:"allowTools"`
}
type ServerConfig struct {

View File

@@ -434,7 +434,7 @@ func (w *watcher) processToolConfig(dataId, data string, credentials map[string]
rule.Server.SecuritySchemes = toolsDescription.SecuritySchemes
}
var allowTools []string
allowTools := []string{}
for _, t := range toolsDescription.Tools {
convertTool := &provider.McpTool{Name: t.Name, Description: t.Description}
@@ -813,6 +813,9 @@ func generateServiceEntry(host string, services *model.Service) *v1alpha3.Servic
endpoints := make([]*v1alpha3.WorkloadEntry, 0)
for _, service := range services.Hosts {
if !service.Healthy || !service.Enable {
continue
}
protocol := common.HTTP
if service.Metadata != nil && service.Metadata["protocol"] != "" {
protocol = common.ParseProtocol(service.Metadata["protocol"])