a06f331eb8
CI / benchmark (push) Has been skipped
install-script / posix-syntax (push) Successful in 6m1s
CI / build-onnx (push) Failing after 6m43s
init-smoke / dry-run (push) Failing after 15m57s
security / govulncheck (push) Has been cancelled
security / trivy-fs (push) Has been cancelled
CI / test (1.26, ubuntu-latest) (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
CI / test (1.26, macos-latest) (push) Has been cancelled
CI / build-windows (push) Has been cancelled
CI / lint (push) Has been cancelled
install-script / powershell-syntax (push) Has been cancelled
install-script / install (macos-14) (push) Has been cancelled
install-script / install (ubuntu-latest) (push) Has been cancelled
29 lines
862 B
Go
29 lines
862 B
Go
package main
|
|
|
|
import (
|
|
"github.com/zzet/gortex/internal/config"
|
|
gortexmcp "github.com/zzet/gortex/internal/mcp"
|
|
)
|
|
|
|
// applyToolPresetFlags folds the --tools / --tools-mode flags into the
|
|
// loaded config's mcp.tools block before the server stack reads it
|
|
// (flag overrides config file). GORTEX_TOOLS / GORTEX_TOOLS_MODE still
|
|
// override at server construction, so the effective precedence is
|
|
// env > flag > config > default(full).
|
|
func applyToolPresetFlags(cfg *config.Config, flagTools, flagMode string) {
|
|
if cfg == nil {
|
|
return
|
|
}
|
|
if flagTools != "" {
|
|
preset, allow, deny := gortexmcp.ParseToolSpec(flagTools)
|
|
if preset != "" {
|
|
cfg.MCP.Tools.Preset = preset
|
|
}
|
|
cfg.MCP.Tools.Allow = append(cfg.MCP.Tools.Allow, allow...)
|
|
cfg.MCP.Tools.Deny = append(cfg.MCP.Tools.Deny, deny...)
|
|
}
|
|
if flagMode != "" {
|
|
cfg.MCP.Tools.Mode = flagMode
|
|
}
|
|
}
|