Documentation
¶
Overview ¶
Copyright 2025 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 GetCompatibleSource[T any](resourceMgr SourceProvider, sourceName, toolName, toolType string) (T, error)
- func IsAuthorized(authRequiredSources []string, verifiedAuthServices []string) bool
- func IsValidName(s string) bool
- func Register(resourceType string, factory ToolConfigFactory) bool
- type AccessToken
- type HTTPMethod
- type Manifest
- type McpManifest
- type SourceProvider
- type Tool
- type ToolAnnotations
- type ToolConfig
- type ToolConfigFactory
- type Toolset
- type ToolsetConfig
- type ToolsetManifest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCompatibleSource ¶
func GetCompatibleSource[T any](resourceMgr SourceProvider, sourceName, toolName, toolType string) (T, error)
func IsAuthorized ¶
Helper function that returns if a tool invocation request is authorized
func IsValidName ¶
func Register ¶
func Register(resourceType string, factory ToolConfigFactory) bool
Register allows individual tool packages to register their configuration factory function. This is typically called from an init() function in the tool's package. It associates a 'type' string with a function that can produce the specific ToolConfig type. It returns true if the registration was successful, and false if a tool with the same type was already registered.
Types ¶
type AccessToken ¶
type AccessToken string
func (AccessToken) ParseBearerToken ¶
func (token AccessToken) ParseBearerToken() (string, error)
type HTTPMethod ¶
type HTTPMethod string
HTTPMethod is a string of a valid HTTP method (e.g "GET")
func (*HTTPMethod) UnmarshalYAML ¶
func (i *HTTPMethod) UnmarshalYAML(ctx context.Context, unmarshal func(interface{}) error) error
type Manifest ¶
type Manifest struct {
Description string `json:"description"`
Parameters []parameters.ParameterManifest `json:"parameters"`
AuthRequired []string `json:"authRequired"`
}
Manifest is the representation of tools sent to Client SDKs.
type McpManifest ¶
type McpManifest struct {
// The name of the tool.
Name string `json:"name"`
// A human-readable description of the tool.
Description string `json:"description,omitempty"`
Annotations *ToolAnnotations `json:"annotations,omitempty"`
// A JSON Schema object defining the expected parameters for the tool.
InputSchema parameters.McpToolsSchema `json:"inputSchema,omitempty"`
Metadata map[string]any `json:"_meta,omitempty"`
}
Definition for a tool the MCP client can call.
func GetMcpManifest ¶
func GetMcpManifest(name, desc string, authInvoke []string, params parameters.Parameters, annotations *ToolAnnotations) McpManifest
type SourceProvider ¶
SourceProvider defines the minimal view of the server.ResourceManager that the Tool package needs. This is implemented to prevent import cycles.
type Tool ¶
type Tool interface {
Invoke(context.Context, SourceProvider, parameters.ParamValues, AccessToken) (any, util.ToolboxError)
EmbedParams(context.Context, parameters.ParamValues, map[string]embeddingmodels.EmbeddingModel) (parameters.ParamValues, error)
Manifest() Manifest
McpManifest() McpManifest
Authorized([]string) bool
RequiresClientAuthorization(SourceProvider) (bool, error)
ToConfig() ToolConfig
GetAuthTokenHeaderName(SourceProvider) (string, error)
GetParameters() parameters.Parameters
}
type ToolAnnotations ¶
type ToolAnnotations struct {
DestructiveHint *bool `json:"destructiveHint,omitempty" yaml:"destructiveHint,omitempty"`
IdempotentHint *bool `json:"idempotentHint,omitempty" yaml:"idempotentHint,omitempty"`
OpenWorldHint *bool `json:"openWorldHint,omitempty" yaml:"openWorldHint,omitempty"`
ReadOnlyHint *bool `json:"readOnlyHint,omitempty" yaml:"readOnlyHint,omitempty"`
}
https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations
func GetAnnotationsOrDefault ¶
func GetAnnotationsOrDefault(annotations *ToolAnnotations, defaultFn func() *ToolAnnotations) *ToolAnnotations
GetAnnotationsOrDefault returns the provided annotations if non-nil, otherwise returns the result of calling defaultFn.
func NewDestructiveAnnotations ¶
func NewDestructiveAnnotations() *ToolAnnotations
NewDestructiveAnnotations creates default annotations for a destructive tool. Use this for tools that create, update, or delete data.
func NewReadOnlyAnnotations ¶
func NewReadOnlyAnnotations() *ToolAnnotations
NewReadOnlyAnnotations creates default annotations for a read-only tool. Use this for tools that only query/fetch data without side effects.
type ToolConfig ¶
type ToolConfig interface {
ToolConfigType() string
Initialize(map[string]sources.Source) (Tool, error)
}
func DecodeConfig ¶
func DecodeConfig(ctx context.Context, resourceType string, name string, decoder *yaml.Decoder) (ToolConfig, error)
DecodeConfig looks up the registered factory for the given type and uses it to decode the tool configuration.
type ToolConfigFactory ¶
type ToolConfigFactory func(ctx context.Context, name string, decoder *yaml.Decoder) (ToolConfig, error)
ToolConfigFactory defines the signature for a function that creates and decodes a specific tool's configuration. It takes the context, the tool's name, and a YAML decoder to parse the config.
type Toolset ¶
type Toolset struct {
ToolsetConfig
Tools []*Tool `yaml:",inline"`
Manifest ToolsetManifest `yaml:",inline"`
McpManifest []McpManifest `yaml:",inline"`
}
func (Toolset) ToConfig ¶
func (t Toolset) ToConfig() ToolsetConfig
type ToolsetConfig ¶
func (ToolsetConfig) Initialize ¶
type ToolsetManifest ¶
Directories
¶
| Path | Synopsis |
|---|---|
|
alloydb
|
|
|
bigquery
|
|
|
cassandra
|
|
|
clickhouse
|
|
|
cloudhealthcare
|
|
|
cloudloggingadmin
|
|
|
cloudsql
|
|
|
cloudsqlmssql
|
|
|
cloudsqlmysql
|
|
|
cloudsqlpg
|
|
|
cockroachdb
|
|
|
conversationalanalytics
|
|
|
dataform
|
|
|
dataplex
|
|
|
dataproc
|
|
|
elasticsearch
|
|
|
firebird
|
|
|
firestore
|
|
|
looker
|
|
|
mindsdb
|
|
|
mongodb
|
|
|
mssql
|
|
|
mysql
|
|
|
neo4j
|
|
|
neo4jexecutecypher/classifier
Package classifier provides tools to classify Cypher queries as either read-only or write operations.
|
Package classifier provides tools to classify Cypher queries as either read-only or write operations. |
|
neo4jschema/cache
Package cache provides a simple, thread-safe, in-memory key-value store.
|
Package cache provides a simple, thread-safe, in-memory key-value store. |
|
neo4jschema/helpers
Package helpers provides utility functions for transforming and processing Neo4j schema data.
|
Package helpers provides utility functions for transforming and processing Neo4j schema data. |
|
neo4jschema/types
Package types contains the shared data structures for Neo4j schema representation.
|
Package types contains the shared data structures for Neo4j schema representation. |
|
oceanbase
|
|
|
oracle
|
|
|
postgres
|
|
|
serverlessspark
|
|
|
singlestore
|
|
|
snowflake
|
|
|
spanner
|
|
|
sqlite
|
|
|
tidb
|
|
|
trino
|
|
|
utility
|
|