MCPcopy Index your code
hub / github.com/github/copilot-sdk / validateNewClientForMode

Function validateNewClientForMode

go/mode_empty.go:17–38  ·  view source on GitHub ↗

validateNewClientForMode checks the cross-cutting requirements that [ModeEmpty] places on [ClientOptions]. Called from [NewClient].

(opts *ClientOptions)

Source from the content-addressed store, hash-verified

15// validateNewClientForMode checks the cross-cutting requirements that
16// [ModeEmpty] places on [ClientOptions]. Called from [NewClient].
17func validateNewClientForMode(opts *ClientOptions) {
18 if opts == nil || opts.Mode != ModeEmpty {
19 return
20 }
21 // Empty mode requires durable, app-owned storage. Either:
22 // - the app supplied a BaseDirectory the runtime can write to,
23 // - the app supplied a SessionFS implementation,
24 // - or the app is connecting to an externally-managed runtime via
25 // URIConnection (in which case the host owns storage).
26 if opts.BaseDirectory != "" {
27 return
28 }
29 if opts.SessionFS != nil {
30 return
31 }
32 if _, ok := opts.Connection.(URIConnection); ok {
33 return
34 }
35 panic("Client is in Mode=ModeEmpty but neither BaseDirectory, SessionFS, nor a URIConnection was supplied. " +
36 "Empty mode requires explicit, per-tenant storage; set ClientOptions.BaseDirectory or .SessionFS, " +
37 "or connect to an externally-managed runtime via URIConnection.")
38}
39
40// validateToolFilterList rejects bare "*" entries with an actionable error
41// pointing at the [ToolSet] builder. Called for both availableTools and

Callers 1

NewClientFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…