Documentation
¶
Overview ¶
Copyright 2024 Google LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- func InitializeConfigs(ctx context.Context, cfg ServerConfig) (map[string]sources.Source, map[string]auth.AuthService, map[string]tools.Tool, ...)
- func NewStdioSession(s *Server, stdin io.Reader, stdout io.Writer) *stdioSession
- type AuthServiceConfigs
- type ResourceManager
- func (r *ResourceManager) GetAuthService(authServiceName string) (auth.AuthService, bool)
- func (r *ResourceManager) GetAuthServiceMap() map[string]auth.AuthService
- func (r *ResourceManager) GetSource(sourceName string) (sources.Source, bool)
- func (r *ResourceManager) GetTool(toolName string) (tools.Tool, bool)
- func (r *ResourceManager) GetToolsMap() map[string]tools.Tool
- func (r *ResourceManager) GetToolset(toolsetName string) (tools.Toolset, bool)
- func (r *ResourceManager) SetResources(sourcesMap map[string]sources.Source, ...)
- type Server
- type ServerConfig
- type SourceConfigs
- type StringLevel
- type ToolConfigs
- type ToolsetConfigs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitializeConfigs ¶ added in v0.9.0
Types ¶
type AuthServiceConfigs ¶ added in v0.2.0
type AuthServiceConfigs map[string]auth.AuthServiceConfig
AuthServiceConfigs is a type used to allow unmarshal of the data authService config map
func (*AuthServiceConfigs) UnmarshalYAML ¶ added in v0.2.0
func (c *AuthServiceConfigs) UnmarshalYAML(ctx context.Context, unmarshal func(interface{}) error) error
type ResourceManager ¶ added in v0.9.0
type ResourceManager struct {
// contains filtered or unexported fields
}
ResourceManager contains available resources for the server. Should be initialized with NewResourceManager().
func NewResourceManager ¶ added in v0.9.0
func (*ResourceManager) GetAuthService ¶ added in v0.9.0
func (r *ResourceManager) GetAuthService(authServiceName string) (auth.AuthService, bool)
func (*ResourceManager) GetAuthServiceMap ¶ added in v0.9.0
func (r *ResourceManager) GetAuthServiceMap() map[string]auth.AuthService
func (*ResourceManager) GetSource ¶ added in v0.9.0
func (r *ResourceManager) GetSource(sourceName string) (sources.Source, bool)
func (*ResourceManager) GetTool ¶ added in v0.9.0
func (r *ResourceManager) GetTool(toolName string) (tools.Tool, bool)
func (*ResourceManager) GetToolsMap ¶ added in v0.9.0
func (r *ResourceManager) GetToolsMap() map[string]tools.Tool
func (*ResourceManager) GetToolset ¶ added in v0.9.0
func (r *ResourceManager) GetToolset(toolsetName string) (tools.Toolset, bool)
func (*ResourceManager) SetResources ¶ added in v0.9.0
type Server ¶
type Server struct {
ResourceMgr *ResourceManager
// contains filtered or unexported fields
}
Server contains info for running an instance of Toolbox. Should be instantiated with NewServer().
func NewServer ¶
func NewServer(ctx context.Context, cfg ServerConfig) (*Server, error)
NewServer returns a Server object based on provided Config.
func (*Server) ServeStdio ¶ added in v0.6.0
ServeStdio starts a new stdio session for mcp.
type ServerConfig ¶ added in v0.0.2
type ServerConfig struct {
// Server version
Version string
// Address is the address of the interface the server will listen on.
Address string
// Port is the port the server will listen on.
Port int
// SourceConfigs defines what sources of data are available for tools.
SourceConfigs SourceConfigs
// AuthServiceConfigs defines what sources of authentication are available for tools.
AuthServiceConfigs AuthServiceConfigs
// ToolConfigs defines what tools are available.
ToolConfigs ToolConfigs
// ToolsetConfigs defines what tools are available.
ToolsetConfigs ToolsetConfigs
// LoggingFormat defines whether structured loggings are used.
LoggingFormat logFormat
// LogLevel defines the levels to log.
LogLevel StringLevel
// TelemetryGCP defines whether GCP exporter is used.
TelemetryGCP bool
// TelemetryOTLP defines OTLP collector url for telemetry exports.
TelemetryOTLP string
// TelemetryServiceName defines the value of service.name resource attribute.
TelemetryServiceName string
// Stdio indicates if Toolbox is listening via MCP stdio.
Stdio bool
// DisableReload indicates if the user has disabled dynamic reloading for Toolbox.
DisableReload bool
// UI indicates if Toolbox UI endpoints (/ui) are available
UI bool
}
type SourceConfigs ¶ added in v0.0.2
type SourceConfigs map[string]sources.SourceConfig
SourceConfigs is a type used to allow unmarshal of the data source config map
func (*SourceConfigs) UnmarshalYAML ¶ added in v0.0.2
func (c *SourceConfigs) UnmarshalYAML(ctx context.Context, unmarshal func(interface{}) error) error
type StringLevel ¶ added in v0.0.3
type StringLevel string
func (*StringLevel) Set ¶ added in v0.0.3
func (s *StringLevel) Set(v string) error
validate log level flag
func (*StringLevel) String ¶ added in v0.0.3
func (s *StringLevel) String() string
String is used by both fmt.Print and by Cobra in help text
func (*StringLevel) Type ¶ added in v0.0.3
func (s *StringLevel) Type() string
Type is used in Cobra help text
type ToolConfigs ¶ added in v0.0.2
type ToolConfigs map[string]tools.ToolConfig
ToolConfigs is a type used to allow unmarshal of the tool configs
func (*ToolConfigs) UnmarshalYAML ¶ added in v0.0.2
func (c *ToolConfigs) UnmarshalYAML(ctx context.Context, unmarshal func(interface{}) error) error
type ToolsetConfigs ¶ added in v0.0.2
type ToolsetConfigs map[string]tools.ToolsetConfig
ToolConfigs is a type used to allow unmarshal of the toolset configs
func (*ToolsetConfigs) UnmarshalYAML ¶ added in v0.0.2
func (c *ToolsetConfigs) UnmarshalYAML(ctx context.Context, unmarshal func(interface{}) error) error