Documentation
¶
Index ¶
- type Config
- type Tool
- func (t Tool) Authorized(verifiedAuthServices []string) bool
- func (t Tool) Invoke(ctx context.Context, params parameters.ParamValues, ...) (any, error)
- func (t Tool) Manifest() tools.Manifest
- func (t Tool) McpManifest() tools.McpManifest
- func (t Tool) ParseParams(data map[string]any, claims map[string]map[string]any) (parameters.ParamValues, error)
- func (t Tool) RequiresClientAuthorization() bool
- func (t Tool) ToConfig() tools.ToolConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Name string `yaml:"name" validate:"required"`
Kind string `yaml:"kind" validate:"required"`
Source string `yaml:"source" validate:"required"`
Description string `yaml:"description" validate:"required"`
Statement string `yaml:"statement" validate:"required"`
AuthRequired []string `yaml:"authRequired"`
Parameters parameters.Parameters `yaml:"parameters"`
TemplateParameters parameters.Parameters `yaml:"templateParameters"`
}
Config defines the configuration for a SingleStore SQL tool.
func (Config) Initialize ¶
Initialize sets up and returns a new Tool instance based on the provided configuration and available sources. It verifies that the specified source exists and is compatible, processes tool parameters, and constructs the necessary manifests for tool operation. Returns an initialized Tool or an error if setup fails.
Parameters:
srcs - a map of available sources, keyed by source name.
Returns:
tools.Tool - the initialized tool instance. error - an error if the source is missing, incompatible, or setup fails.
func (Config) ToolConfigKind ¶
ToolConfigKind returns the kind of the tool configuration.
type Tool ¶
type Tool struct {
Config
AllParams parameters.Parameters `yaml:"allParams"`
Pool *sql.DB
// contains filtered or unexported fields
}
Tool represents a SingleStore SQL tool instance with its configuration, parameters, and database connection.
func (Tool) Authorized ¶
func (Tool) Invoke ¶
func (t Tool) Invoke(ctx context.Context, params parameters.ParamValues, accessToken tools.AccessToken) (any, error)
Invoke executes the SQL statement defined in the Tool using the provided context and parameter values. It resolves template parameters and standard parameters, executes the query, and processes the result rows. Each row is returned as a map with column names as keys and their corresponding values, handling special cases for JSON and string types. Returns a slice of maps representing the result set, or an error if any step fails.
Parameters:
ctx - The context for controlling cancellation and timeouts. params - The parameter values to be used for the SQL statement.
Returns:
- A slice of maps, where each map represents a row with column names as keys.
- An error if template resolution, parameter extraction, query execution, or result processing fails.
func (Tool) McpManifest ¶
func (t Tool) McpManifest() tools.McpManifest
func (Tool) ParseParams ¶
func (t Tool) ParseParams(data map[string]any, claims map[string]map[string]any) (parameters.ParamValues, error)
func (Tool) RequiresClientAuthorization ¶
func (Tool) ToConfig ¶ added in v0.20.0
func (t Tool) ToConfig() tools.ToolConfig