Documentation
¶
Index ¶
- func FormatResponse(response interface{}, err error) (interface{}, error)
- func FromError(err error) (interface{}, error)
- func RegisterTimescaleDBTools(registry interface{}) error
- type BaseToolType
- type CompletionItem
- type CompressionConfig
- type ExecuteTool
- type HypertableColumnInfo
- type HypertableSchemaInfo
- type HypertableSchemaProvider
- type ListDatabasesTool
- type PerformanceTool
- type QuerySuggestion
- type QueryTool
- type Response
- type SchemaTool
- type ServerWrapper
- type TextContent
- type TimescaleDBCompletionProvider
- func (p *TimescaleDBCompletionProvider) GetAllFunctionCompletions(ctx context.Context, dbID string, useCase UseCaseProvider) ([]CompletionItem, error)
- func (p *TimescaleDBCompletionProvider) GetAnalyticsFunctionCompletions(ctx context.Context, dbID string, useCase UseCaseProvider) ([]CompletionItem, error)
- func (p *TimescaleDBCompletionProvider) GetContinuousAggregateFunctionCompletions(ctx context.Context, dbID string, useCase UseCaseProvider) ([]CompletionItem, error)
- func (p *TimescaleDBCompletionProvider) GetHypertableFunctionCompletions(ctx context.Context, dbID string, useCase UseCaseProvider) ([]CompletionItem, error)
- func (p *TimescaleDBCompletionProvider) GetQuerySuggestions(ctx context.Context, dbID string, useCase UseCaseProvider) ([]QuerySuggestion, error)
- func (p *TimescaleDBCompletionProvider) GetTimeBucketCompletions(ctx context.Context, dbID string, useCase UseCaseProvider) ([]CompletionItem, error)
- type TimescaleDBContextInfo
- type TimescaleDBContextProvider
- type TimescaleDBHypertableInfo
- type TimescaleDBTool
- func (t *TimescaleDBTool) CreateCompressionDisableTool(name string, dbID string) interface{}
- func (t *TimescaleDBTool) CreateCompressionEnableTool(name string, dbID string) interface{}
- func (t *TimescaleDBTool) CreateCompressionPolicyAddTool(name string, dbID string) interface{}
- func (t *TimescaleDBTool) CreateCompressionPolicyRemoveTool(name string, dbID string) interface{}
- func (t *TimescaleDBTool) CreateCompressionSettingsTool(name string, dbID string) interface{}
- func (t *TimescaleDBTool) CreateContinuousAggregateDropTool(name string, dbID string) interface{}
- func (t *TimescaleDBTool) CreateContinuousAggregateInfoTool(name string, dbID string) interface{}
- func (t *TimescaleDBTool) CreateContinuousAggregateListTool(name string, dbID string) interface{}
- func (t *TimescaleDBTool) CreateContinuousAggregatePolicyAddTool(name string, dbID string) interface{}
- func (t *TimescaleDBTool) CreateContinuousAggregatePolicyRemoveTool(name string, dbID string) interface{}
- func (t *TimescaleDBTool) CreateContinuousAggregateRefreshTool(name string, dbID string) interface{}
- func (t *TimescaleDBTool) CreateContinuousAggregateTool(name string, dbID string) interface{}
- func (t *TimescaleDBTool) CreateHypertableTool(name string, dbID string) interface{}
- func (t *TimescaleDBTool) CreateListHypertablesTool(name string, dbID string) interface{}
- func (t *TimescaleDBTool) CreateRetentionPolicyTool(name string, dbID string) interface{}
- func (t *TimescaleDBTool) CreateTimeSeriesAnalyzeTool(name string, dbID string) interface{}
- func (t *TimescaleDBTool) CreateTimeSeriesQueryTool(name string, dbID string) interface{}
- func (t *TimescaleDBTool) CreateTool(name string, dbID string) interface{}
- func (t *TimescaleDBTool) GetDescription(dbID string) string
- func (t *TimescaleDBTool) GetName() string
- func (t *TimescaleDBTool) HandleRequest(ctx context.Context, request server.ToolCallRequest, dbID string, ...) (interface{}, error)
- type ToolRegistry
- type ToolType
- type ToolTypeFactory
- type TransactionTool
- type UseCaseProvider
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatResponse ¶ added in v1.5.0
FormatResponse converts any response type to a properly formatted MCP response
func RegisterTimescaleDBTools ¶ added in v1.8.0
func RegisterTimescaleDBTools(registry interface{}) error
RegisterTimescaleDBTools registers TimescaleDB tools
Types ¶
type BaseToolType ¶ added in v1.5.0
type BaseToolType struct {
// contains filtered or unexported fields
}
BaseToolType provides common functionality for tool types
func (*BaseToolType) GetDescription ¶ added in v1.5.0
func (b *BaseToolType) GetDescription(dbID string) string
GetDescription returns a description for the tool type
func (*BaseToolType) GetName ¶ added in v1.5.0
func (b *BaseToolType) GetName() string
GetName returns the name of the tool type
type CompletionItem ¶ added in v1.8.0
type CompletionItem struct { Name string `json:"name"` Type string `json:"type"` Documentation string `json:"documentation"` InsertText string `json:"insertText"` Parameters []string `json:"parameters,omitempty"` ReturnType string `json:"returnType,omitempty"` Category string `json:"category,omitempty"` SortText string `json:"sortText,omitempty"` FilterText string `json:"filterText,omitempty"` CommitCharacters []string `json:"commitCharacters,omitempty"` }
CompletionItem represents a code completion item
type CompressionConfig ¶ added in v1.8.0
type CompressionConfig struct { SegmentBy string `json:"segmentBy,omitempty"` OrderBy string `json:"orderBy,omitempty"` Interval string `json:"interval,omitempty"` }
CompressionConfig represents compression configuration for a hypertable
type ExecuteTool ¶ added in v1.5.0
type ExecuteTool struct {
BaseToolType
}
ExecuteTool handles SQL statement execution
func NewExecuteTool ¶ added in v1.5.0
func NewExecuteTool() *ExecuteTool
NewExecuteTool creates a new execute tool type
func (*ExecuteTool) CreateTool ¶ added in v1.5.0
func (t *ExecuteTool) CreateTool(name string, dbID string) interface{}
CreateTool creates an execute tool
func (*ExecuteTool) HandleRequest ¶ added in v1.5.0
func (t *ExecuteTool) HandleRequest(ctx context.Context, request server.ToolCallRequest, dbID string, useCase UseCaseProvider) (interface{}, error)
HandleRequest handles execute tool requests
type HypertableColumnInfo ¶ added in v1.8.0
type HypertableColumnInfo struct { Name string `json:"name"` Type string `json:"type"` Nullable bool `json:"nullable"` PrimaryKey bool `json:"primaryKey"` Indexed bool `json:"indexed"` Description string `json:"description,omitempty"` }
HypertableColumnInfo represents column information for a hypertable
type HypertableSchemaInfo ¶ added in v1.8.0
type HypertableSchemaInfo struct { TableName string `json:"tableName"` SchemaName string `json:"schemaName"` TimeColumn string `json:"timeColumn"` ChunkTimeInterval string `json:"chunkTimeInterval"` Size string `json:"size"` ChunkCount int `json:"chunkCount"` RowCount int64 `json:"rowCount"` SpacePartitioning []string `json:"spacePartitioning,omitempty"` CompressionEnabled bool `json:"compressionEnabled"` CompressionConfig CompressionConfig `json:"compressionConfig,omitempty"` RetentionEnabled bool `json:"retentionEnabled"` RetentionInterval string `json:"retentionInterval,omitempty"` Columns []HypertableColumnInfo `json:"columns"` }
HypertableSchemaInfo represents schema information for a TimescaleDB hypertable
type HypertableSchemaProvider ¶ added in v1.8.0
type HypertableSchemaProvider struct {
// contains filtered or unexported fields
}
HypertableSchemaProvider provides schema information for hypertables
func NewHypertableSchemaProvider ¶ added in v1.8.0
func NewHypertableSchemaProvider() *HypertableSchemaProvider
NewHypertableSchemaProvider creates a new hypertable schema provider
func (*HypertableSchemaProvider) GetHypertableSchema ¶ added in v1.8.0
func (p *HypertableSchemaProvider) GetHypertableSchema( ctx context.Context, dbID string, tableName string, useCase UseCaseProvider, ) (*HypertableSchemaInfo, error)
GetHypertableSchema gets schema information for a specific hypertable
type ListDatabasesTool ¶ added in v1.5.0
type ListDatabasesTool struct {
BaseToolType
}
ListDatabasesTool handles listing available databases
func NewListDatabasesTool ¶ added in v1.5.0
func NewListDatabasesTool() *ListDatabasesTool
NewListDatabasesTool creates a new list databases tool type
func (*ListDatabasesTool) CreateTool ¶ added in v1.5.0
func (t *ListDatabasesTool) CreateTool(name string, dbID string) interface{}
CreateTool creates a list databases tool
func (*ListDatabasesTool) HandleRequest ¶ added in v1.5.0
func (t *ListDatabasesTool) HandleRequest(ctx context.Context, request server.ToolCallRequest, dbID string, useCase UseCaseProvider) (interface{}, error)
HandleRequest handles list databases tool requests
type PerformanceTool ¶ added in v1.5.0
type PerformanceTool struct {
BaseToolType
}
PerformanceTool handles query performance analysis
func NewPerformanceTool ¶ added in v1.5.0
func NewPerformanceTool() *PerformanceTool
NewPerformanceTool creates a new performance tool type
func (*PerformanceTool) CreateTool ¶ added in v1.5.0
func (t *PerformanceTool) CreateTool(name string, dbID string) interface{}
CreateTool creates a performance analysis tool
func (*PerformanceTool) HandleRequest ¶ added in v1.5.0
func (t *PerformanceTool) HandleRequest(ctx context.Context, request server.ToolCallRequest, dbID string, useCase UseCaseProvider) (interface{}, error)
HandleRequest handles performance tool requests
type QuerySuggestion ¶ added in v1.8.0
type QuerySuggestion struct { Title string `json:"title"` Description string `json:"description"` Query string `json:"query"` Category string `json:"category"` }
QuerySuggestion represents a suggested query template for TimescaleDB
type QueryTool ¶ added in v1.5.0
type QueryTool struct {
BaseToolType
}
QueryTool handles SQL query operations
func NewQueryTool ¶ added in v1.5.0
func NewQueryTool() *QueryTool
NewQueryTool creates a new query tool type
func (*QueryTool) CreateTool ¶ added in v1.5.0
CreateTool creates a query tool
func (*QueryTool) HandleRequest ¶ added in v1.5.0
func (t *QueryTool) HandleRequest(ctx context.Context, request server.ToolCallRequest, dbID string, useCase UseCaseProvider) (interface{}, error)
HandleRequest handles query tool requests
type Response ¶ added in v1.5.0
type Response struct { Content []TextContent `json:"content"` Metadata map[string]interface{} `json:"metadata,omitempty"` }
Response is a standardized response format for MCP tools
func FromString ¶ added in v1.5.0
FromString creates a response from a string
func NewResponse ¶ added in v1.5.0
func NewResponse() *Response
NewResponse creates a new empty Response
Example ¶
// Create a new response with text content resp := NewResponse().WithText("Hello, world!") // Add metadata resp.WithMetadata("source", "example") // Convert to map for JSON serialization output, err := json.Marshal(resp) if err != nil { // This is an example, but we should still check fmt.Println("Error marshaling:", err) return } fmt.Println(string(output))
Output: {"content":[{"type":"text","text":"Hello, world!"}],"metadata":{"source":"example"}}
func (*Response) WithMetadata ¶ added in v1.5.0
WithMetadata adds metadata to the response
type SchemaTool ¶ added in v1.5.0
type SchemaTool struct {
BaseToolType
}
SchemaTool handles database schema exploration
func NewSchemaTool ¶ added in v1.5.0
func NewSchemaTool() *SchemaTool
NewSchemaTool creates a new schema tool type
func (*SchemaTool) CreateTool ¶ added in v1.5.0
func (t *SchemaTool) CreateTool(name string, dbID string) interface{}
CreateTool creates a schema tool
func (*SchemaTool) HandleRequest ¶ added in v1.5.0
func (t *SchemaTool) HandleRequest(ctx context.Context, request server.ToolCallRequest, dbID string, useCase UseCaseProvider) (interface{}, error)
HandleRequest handles schema tool requests
type ServerWrapper ¶ added in v1.5.0
type ServerWrapper struct {
// contains filtered or unexported fields
}
ServerWrapper provides a wrapper around server.MCPServer to handle type assertions
func NewServerWrapper ¶ added in v1.5.0
func NewServerWrapper(mcpServer *server.MCPServer) *ServerWrapper
NewServerWrapper creates a new ServerWrapper
type TextContent ¶ added in v1.5.0
TextContent represents a text content item in a response
type TimescaleDBCompletionProvider ¶ added in v1.8.0
type TimescaleDBCompletionProvider struct {
// contains filtered or unexported fields
}
TimescaleDBCompletionProvider provides code completion for TimescaleDB functions
func NewTimescaleDBCompletionProvider ¶ added in v1.8.0
func NewTimescaleDBCompletionProvider() *TimescaleDBCompletionProvider
NewTimescaleDBCompletionProvider creates a new TimescaleDB completion provider
func (*TimescaleDBCompletionProvider) GetAllFunctionCompletions ¶ added in v1.8.0
func (p *TimescaleDBCompletionProvider) GetAllFunctionCompletions(ctx context.Context, dbID string, useCase UseCaseProvider) ([]CompletionItem, error)
GetAllFunctionCompletions returns completions for all TimescaleDB functions
func (*TimescaleDBCompletionProvider) GetAnalyticsFunctionCompletions ¶ added in v1.8.0
func (p *TimescaleDBCompletionProvider) GetAnalyticsFunctionCompletions(ctx context.Context, dbID string, useCase UseCaseProvider) ([]CompletionItem, error)
GetAnalyticsFunctionCompletions returns completions for TimescaleDB's analytics functions
func (*TimescaleDBCompletionProvider) GetContinuousAggregateFunctionCompletions ¶ added in v1.8.0
func (p *TimescaleDBCompletionProvider) GetContinuousAggregateFunctionCompletions(ctx context.Context, dbID string, useCase UseCaseProvider) ([]CompletionItem, error)
GetContinuousAggregateFunctionCompletions returns completions for continuous aggregate functions
func (*TimescaleDBCompletionProvider) GetHypertableFunctionCompletions ¶ added in v1.8.0
func (p *TimescaleDBCompletionProvider) GetHypertableFunctionCompletions(ctx context.Context, dbID string, useCase UseCaseProvider) ([]CompletionItem, error)
GetHypertableFunctionCompletions returns completions for hypertable management functions
func (*TimescaleDBCompletionProvider) GetQuerySuggestions ¶ added in v1.8.0
func (p *TimescaleDBCompletionProvider) GetQuerySuggestions(ctx context.Context, dbID string, useCase UseCaseProvider) ([]QuerySuggestion, error)
GetQuerySuggestions returns TimescaleDB query suggestions based on the database schema
func (*TimescaleDBCompletionProvider) GetTimeBucketCompletions ¶ added in v1.8.0
func (p *TimescaleDBCompletionProvider) GetTimeBucketCompletions(ctx context.Context, dbID string, useCase UseCaseProvider) ([]CompletionItem, error)
GetTimeBucketCompletions returns completions for time_bucket functions
type TimescaleDBContextInfo ¶ added in v1.8.0
type TimescaleDBContextInfo struct { IsTimescaleDB bool `json:"isTimescaleDB"` Version string `json:"version,omitempty"` Hypertables []TimescaleDBHypertableInfo `json:"hypertables,omitempty"` }
TimescaleDBContextInfo represents information about TimescaleDB for editor context
type TimescaleDBContextProvider ¶ added in v1.8.0
type TimescaleDBContextProvider struct{}
TimescaleDBContextProvider provides TimescaleDB information for editor context
func NewTimescaleDBContextProvider ¶ added in v1.8.0
func NewTimescaleDBContextProvider() *TimescaleDBContextProvider
NewTimescaleDBContextProvider creates a new TimescaleDB context provider
func (*TimescaleDBContextProvider) DetectTimescaleDB ¶ added in v1.8.0
func (p *TimescaleDBContextProvider) DetectTimescaleDB(ctx context.Context, dbID string, useCase UseCaseProvider) (*TimescaleDBContextInfo, error)
DetectTimescaleDB detects if TimescaleDB is installed in the given database
func (*TimescaleDBContextProvider) GetTimescaleDBContext ¶ added in v1.8.0
func (p *TimescaleDBContextProvider) GetTimescaleDBContext(ctx context.Context, dbID string, useCase UseCaseProvider) (*TimescaleDBContextInfo, error)
GetTimescaleDBContext gets comprehensive TimescaleDB context information
type TimescaleDBHypertableInfo ¶ added in v1.8.0
type TimescaleDBHypertableInfo struct { TableName string `json:"tableName"` TimeColumn string `json:"timeColumn"` ChunkInterval string `json:"chunkInterval"` }
TimescaleDBHypertableInfo contains information about a hypertable
type TimescaleDBTool ¶ added in v1.8.0
type TimescaleDBTool struct {
// contains filtered or unexported fields
}
TimescaleDBTool implements a tool for TimescaleDB operations
func NewTimescaleDBTool ¶ added in v1.8.0
func NewTimescaleDBTool() *TimescaleDBTool
NewTimescaleDBTool creates a new TimescaleDB tool
func (*TimescaleDBTool) CreateCompressionDisableTool ¶ added in v1.8.0
func (t *TimescaleDBTool) CreateCompressionDisableTool(name string, dbID string) interface{}
CreateCompressionDisableTool creates a tool for disabling compression on a hypertable
func (*TimescaleDBTool) CreateCompressionEnableTool ¶ added in v1.8.0
func (t *TimescaleDBTool) CreateCompressionEnableTool(name string, dbID string) interface{}
CreateCompressionEnableTool creates a tool for enabling compression on a hypertable
func (*TimescaleDBTool) CreateCompressionPolicyAddTool ¶ added in v1.8.0
func (t *TimescaleDBTool) CreateCompressionPolicyAddTool(name string, dbID string) interface{}
CreateCompressionPolicyAddTool creates a tool for adding a compression policy
func (*TimescaleDBTool) CreateCompressionPolicyRemoveTool ¶ added in v1.8.0
func (t *TimescaleDBTool) CreateCompressionPolicyRemoveTool(name string, dbID string) interface{}
CreateCompressionPolicyRemoveTool creates a tool for removing a compression policy
func (*TimescaleDBTool) CreateCompressionSettingsTool ¶ added in v1.8.0
func (t *TimescaleDBTool) CreateCompressionSettingsTool(name string, dbID string) interface{}
CreateCompressionSettingsTool creates a tool for retrieving compression settings
func (*TimescaleDBTool) CreateContinuousAggregateDropTool ¶ added in v1.8.0
func (t *TimescaleDBTool) CreateContinuousAggregateDropTool(name string, dbID string) interface{}
CreateContinuousAggregateDropTool creates a specific tool for dropping continuous aggregates
func (*TimescaleDBTool) CreateContinuousAggregateInfoTool ¶ added in v1.8.0
func (t *TimescaleDBTool) CreateContinuousAggregateInfoTool(name string, dbID string) interface{}
CreateContinuousAggregateInfoTool creates a specific tool for getting continuous aggregate information
func (*TimescaleDBTool) CreateContinuousAggregateListTool ¶ added in v1.8.0
func (t *TimescaleDBTool) CreateContinuousAggregateListTool(name string, dbID string) interface{}
CreateContinuousAggregateListTool creates a specific tool for listing continuous aggregates
func (*TimescaleDBTool) CreateContinuousAggregatePolicyAddTool ¶ added in v1.8.0
func (t *TimescaleDBTool) CreateContinuousAggregatePolicyAddTool(name string, dbID string) interface{}
CreateContinuousAggregatePolicyAddTool creates a specific tool for adding a refresh policy
func (*TimescaleDBTool) CreateContinuousAggregatePolicyRemoveTool ¶ added in v1.8.0
func (t *TimescaleDBTool) CreateContinuousAggregatePolicyRemoveTool(name string, dbID string) interface{}
CreateContinuousAggregatePolicyRemoveTool creates a specific tool for removing a refresh policy
func (*TimescaleDBTool) CreateContinuousAggregateRefreshTool ¶ added in v1.8.0
func (t *TimescaleDBTool) CreateContinuousAggregateRefreshTool(name string, dbID string) interface{}
CreateContinuousAggregateRefreshTool creates a specific tool for refreshing continuous aggregates
func (*TimescaleDBTool) CreateContinuousAggregateTool ¶ added in v1.8.0
func (t *TimescaleDBTool) CreateContinuousAggregateTool(name string, dbID string) interface{}
CreateContinuousAggregateTool creates a specific tool for creating continuous aggregates
func (*TimescaleDBTool) CreateHypertableTool ¶ added in v1.8.0
func (t *TimescaleDBTool) CreateHypertableTool(name string, dbID string) interface{}
CreateHypertableTool creates a specific tool for hypertable creation
func (*TimescaleDBTool) CreateListHypertablesTool ¶ added in v1.8.0
func (t *TimescaleDBTool) CreateListHypertablesTool(name string, dbID string) interface{}
CreateListHypertablesTool creates a specific tool for listing hypertables
func (*TimescaleDBTool) CreateRetentionPolicyTool ¶ added in v1.8.0
func (t *TimescaleDBTool) CreateRetentionPolicyTool(name string, dbID string) interface{}
CreateRetentionPolicyTool creates a specific tool for managing retention policies
func (*TimescaleDBTool) CreateTimeSeriesAnalyzeTool ¶ added in v1.8.0
func (t *TimescaleDBTool) CreateTimeSeriesAnalyzeTool(name string, dbID string) interface{}
CreateTimeSeriesAnalyzeTool creates a specific tool for analyzing time-series data
func (*TimescaleDBTool) CreateTimeSeriesQueryTool ¶ added in v1.8.0
func (t *TimescaleDBTool) CreateTimeSeriesQueryTool(name string, dbID string) interface{}
CreateTimeSeriesQueryTool creates a specific tool for time-series queries
func (*TimescaleDBTool) CreateTool ¶ added in v1.8.0
func (t *TimescaleDBTool) CreateTool(name string, dbID string) interface{}
CreateTool creates the TimescaleDB tool
func (*TimescaleDBTool) GetDescription ¶ added in v1.8.0
func (t *TimescaleDBTool) GetDescription(dbID string) string
GetDescription returns the description of the tool
func (*TimescaleDBTool) GetName ¶ added in v1.8.0
func (t *TimescaleDBTool) GetName() string
GetName returns the name of the tool
func (*TimescaleDBTool) HandleRequest ¶ added in v1.8.0
func (t *TimescaleDBTool) HandleRequest(ctx context.Context, request server.ToolCallRequest, dbID string, useCase UseCaseProvider) (interface{}, error)
HandleRequest handles a tool request
type ToolRegistry ¶
type ToolRegistry struct {
// contains filtered or unexported fields
}
ToolRegistry structure to handle tool registration
func NewToolRegistry ¶
func NewToolRegistry(mcpServer *server.MCPServer) *ToolRegistry
NewToolRegistry creates a new tool registry
func (*ToolRegistry) RegisterAllTools ¶
func (tr *ToolRegistry) RegisterAllTools(ctx context.Context, useCase UseCaseProvider) error
RegisterAllTools registers all tools with the server
func (*ToolRegistry) RegisterCursorCompatibleTools ¶ added in v1.5.0
func (tr *ToolRegistry) RegisterCursorCompatibleTools(ctx context.Context) error
RegisterCursorCompatibleTools is kept for backward compatibility but does nothing as we now register tools with simple names directly
func (*ToolRegistry) RegisterMockTools ¶ added in v1.4.1
func (tr *ToolRegistry) RegisterMockTools(ctx context.Context) error
RegisterMockTools registers mock tools with the server when no db connections available
type ToolType ¶ added in v1.5.0
type ToolType interface { // GetName returns the base name of the tool type (e.g., "query", "execute") GetName() string // GetDescription returns a description for this tool type GetDescription(dbID string) string // CreateTool creates a tool with the specified name // The returned tool must be compatible with server.MCPServer.AddTool's first parameter CreateTool(name string, dbID string) interface{} // HandleRequest handles tool requests for this tool type HandleRequest(ctx context.Context, request server.ToolCallRequest, dbID string, useCase UseCaseProvider) (interface{}, error) }
ToolType interface defines the structure for different types of database tools
type ToolTypeFactory ¶ added in v1.5.0
type ToolTypeFactory struct {
// contains filtered or unexported fields
}
ToolTypeFactory creates and manages tool types
func NewToolTypeFactory ¶ added in v1.5.0
func NewToolTypeFactory() *ToolTypeFactory
NewToolTypeFactory creates a new tool type factory with all registered tool types
func (*ToolTypeFactory) GetAllToolTypes ¶ added in v1.5.0
func (f *ToolTypeFactory) GetAllToolTypes() []ToolType
GetAllToolTypes returns all registered tool types
func (*ToolTypeFactory) GetToolType ¶ added in v1.5.0
func (f *ToolTypeFactory) GetToolType(name string) (ToolType, bool)
GetToolType returns a tool type by name
func (*ToolTypeFactory) GetToolTypeForSourceName ¶ added in v1.5.0
func (f *ToolTypeFactory) GetToolTypeForSourceName(sourceName string) (ToolType, string, bool)
GetToolTypeForSourceName finds the appropriate tool type for a source name
func (*ToolTypeFactory) Register ¶ added in v1.5.0
func (f *ToolTypeFactory) Register(toolType ToolType)
Register adds a tool type to the factory
type TransactionTool ¶ added in v1.5.0
type TransactionTool struct {
BaseToolType
}
TransactionTool handles database transactions
func NewTransactionTool ¶ added in v1.5.0
func NewTransactionTool() *TransactionTool
NewTransactionTool creates a new transaction tool type
func (*TransactionTool) CreateTool ¶ added in v1.5.0
func (t *TransactionTool) CreateTool(name string, dbID string) interface{}
CreateTool creates a transaction tool
func (*TransactionTool) HandleRequest ¶ added in v1.5.0
func (t *TransactionTool) HandleRequest(ctx context.Context, request server.ToolCallRequest, dbID string, useCase UseCaseProvider) (interface{}, error)
HandleRequest handles transaction tool requests
type UseCaseProvider ¶ added in v1.5.0
type UseCaseProvider interface { ExecuteQuery(ctx context.Context, dbID, query string, params []interface{}) (string, error) ExecuteStatement(ctx context.Context, dbID, statement string, params []interface{}) (string, error) ExecuteTransaction(ctx context.Context, dbID, action string, txID string, statement string, params []interface{}, readOnly bool) (string, map[string]interface{}, error) GetDatabaseInfo(dbID string) (map[string]interface{}, error) ListDatabases() []string GetDatabaseType(dbID string) (string, error) }
UseCaseProvider interface abstracts database use case operations