Documentation
¶
Overview ¶
Package config reads and atomically edits tap's ordered server registry and its settings. It expands environment and home references only when a connection is opened.
Index ¶
- Constants
- Variables
- func Add(path, name string, def wire.Object) error
- func Expand(value any) string
- func Home(value string) string
- func JSONError(data []byte, fallback error) string
- func Load(path string) (wire.Object, error)
- func Loopback(host string) bool
- func NormalizeURL(raw string, insecure bool) (string, error)
- func Path() string
- func Remove(path, name string) (bool, error)
- func Save(path string, servers wire.Object) error
- func Set(path, server, name string, value any) error
- func SetRemote(path string, r *Remote) error
- type Own
- type Remote
- type Setting
- type Value
- type Values
Constants ¶
const ( StartOnCall = "call" // only a call starts the server, once tap knows its tools StartOnSearch = "search" // a search starts it too, to check its tools again StartWithTap = "start" // it starts with tap and keeps running )
Starts are the values of the start setting, from laziest to most eager.
Variables ¶
var Settings = []Setting{ {Name: "start", About: "when tap starts a server: call, search or start", Default: "call", PerServer: true, /* contains filtered or unexported fields */}, {Name: "references", About: "let an agent keep large results as references: on or off", Default: "off", Env: "TAP_REFERENCES", /* contains filtered or unexported fields */}, {Name: "searchLimit", About: "how many tools a search returns unless asked for more (1 to 25)", Default: "8", /* contains filtered or unexported fields */}, {Name: "searchMaxBytes", About: "how much a search may return unless asked for more (1024 to 16777216)", Default: "32768", /* contains filtered or unexported fields */}, {Name: "deadlineMs", About: "how long a server may take to connect and list its tools", Default: "5000", Env: "TAP_DEADLINE_MS", /* contains filtered or unexported fields */}, {Name: "idleTimeoutMs", About: "how long an unused server keeps running", Default: "300000", Env: "TAP_IDLE_TTL_MS", PerServer: true, /* contains filtered or unexported fields */}, {Name: "retryAfterMs", About: "how long tap waits before trying a failed server again", Default: "5000", Env: "TAP_FAIL_TTL_MS", /* contains filtered or unexported fields */}, }
Settings lists every setting, in the order tap shows them.
Functions ¶
func JSONError ¶
JSONError reports invalid JSON using the original CLI's JSON.parse diagnostics. Parsing valid values remains the standard library's job; this is only an error formatter.
func NormalizeURL ¶
NormalizeURL accepts a remote base URL or its /mcp endpoint, without credentials.
func Path ¶
func Path() string
Path returns TAP_CONFIG, or the default home-relative path when it is empty.
Types ¶
type Remote ¶
type Remote struct {
URL string `json:"url"`
TokenEnv string `json:"tokenEnv"`
AllowInsecure bool `json:"allowInsecure,omitempty"`
}
Remote selects the relay endpoint and the environment variable holding its token.
func LoadRemote ¶
LoadRemote returns nil only when the remote block is absent.
type Setting ¶
type Setting struct {
Name, About, Default, Env string
PerServer bool
// contains filtered or unexported fields
}
Setting is one choice a person may make about how tap behaves. It is kept under its Name in the config's settings block, and PerServer ones also in a server's own definition, where they win over the block. Env, when set, names the environment variable that wins over both.
type Value ¶
Value is one setting as it stands: what it is, as text, and where it came from: "default", "config" or the environment variable's name.
type Values ¶
type Values struct {
Start string
References bool
SearchLimit, SearchMaxBytes int
DeadlineMs, IdleTimeoutMs, RetryAfterMs int
}
Values are the settings a tap process runs with.
func LoadValues ¶
LoadValues reads the values a tap process runs with. A config that cannot be read gives the defaults and the environment, since whatever reads it next reports why.