integrationtools

package
v0.2.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 30, 2026 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveWebSearchProviderName added in v0.2.8

func ResolveWebSearchProviderName(opts WebSearchToolOptions, query string) (string, error)

func ToolAgentID

func ToolAgentID(ctx context.Context) string

func ToolChannel

func ToolChannel(ctx context.Context) string

func ToolChatID

func ToolChatID(ctx context.Context) string

func ToolMessageID

func ToolMessageID(ctx context.Context) string

func ToolSessionKey

func ToolSessionKey(ctx context.Context) string

func ToolSessionScope

func ToolSessionScope(ctx context.Context) *session.SessionScope

func WebSearchProviderReady added in v0.2.8

func WebSearchProviderReady(opts WebSearchToolOptions, name string) bool

func WithToolContext

func WithToolContext(ctx context.Context, channel, chatID string) context.Context

func WithToolInboundContext

func WithToolInboundContext(
	ctx context.Context,
	channel, chatID, messageID, replyToMessageID string,
) context.Context

func WithToolSessionContext

func WithToolSessionContext(
	ctx context.Context,
	agentID, sessionKey string,
	scope *session.SessionScope,
) context.Context

Types

type APIKeyIterator

type APIKeyIterator struct {
	// contains filtered or unexported fields
}

func (*APIKeyIterator) Next

func (it *APIKeyIterator) Next() (string, bool)

type APIKeyPool

type APIKeyPool struct {
	// contains filtered or unexported fields
}

func NewAPIKeyPool

func NewAPIKeyPool(keys []string) *APIKeyPool

func (*APIKeyPool) NewIterator

func (p *APIKeyPool) NewIterator() *APIKeyIterator

type AsyncCallback

type AsyncCallback = toolshared.AsyncCallback

type BaiduSearchProvider

type BaiduSearchProvider struct {
	// contains filtered or unexported fields
}

func (*BaiduSearchProvider) Search

func (p *BaiduSearchProvider) Search(
	ctx context.Context,
	query string,
	count int,
	rangeCode string,
) (string, error)

type BraveSearchProvider

type BraveSearchProvider struct {
	// contains filtered or unexported fields
}

func (*BraveSearchProvider) Search

func (p *BraveSearchProvider) Search(
	ctx context.Context,
	query string,
	count int,
	rangeCode string,
) (string, error)

type DuckDuckGoSearchProvider

type DuckDuckGoSearchProvider struct {
	// contains filtered or unexported fields
}

func (*DuckDuckGoSearchProvider) Search

func (p *DuckDuckGoSearchProvider) Search(
	ctx context.Context,
	query string,
	count int,
	rangeCode string,
) (string, error)

type FindSkillsTool

type FindSkillsTool struct {
	// contains filtered or unexported fields
}

FindSkillsTool allows the LLM agent to search for installable skills from registries.

func NewFindSkillsTool

func NewFindSkillsTool(registryMgr *skills.RegistryManager, cache *skills.SearchCache) *FindSkillsTool

NewFindSkillsTool creates a new FindSkillsTool. registryMgr is the shared registry manager (built from config in createToolRegistry). cache is the search cache for deduplicating similar queries.

func (*FindSkillsTool) Description

func (t *FindSkillsTool) Description() string

func (*FindSkillsTool) Execute

func (t *FindSkillsTool) Execute(ctx context.Context, args map[string]any) *ToolResult

func (*FindSkillsTool) Name

func (t *FindSkillsTool) Name() string

func (*FindSkillsTool) Parameters

func (t *FindSkillsTool) Parameters() map[string]any

type GLMSearchProvider

type GLMSearchProvider struct {
	// contains filtered or unexported fields
}

func (*GLMSearchProvider) Search

func (p *GLMSearchProvider) Search(
	ctx context.Context,
	query string,
	count int,
	rangeCode string,
) (string, error)

type InstallSkillTool

type InstallSkillTool struct {
	// contains filtered or unexported fields
}

InstallSkillTool allows the LLM agent to install skills from registries. It shares the same RegistryManager that FindSkillsTool uses, so all registries configured in config are available for installation.

func NewInstallSkillTool

func NewInstallSkillTool(registryMgr *skills.RegistryManager, workspace string) *InstallSkillTool

NewInstallSkillTool creates a new InstallSkillTool. registryMgr is the shared registry manager (same instance as FindSkillsTool). workspace is the root workspace directory; skills install to {workspace}/skills/{slug}/.

func (*InstallSkillTool) Description

func (t *InstallSkillTool) Description() string

func (*InstallSkillTool) Execute

func (t *InstallSkillTool) Execute(ctx context.Context, args map[string]any) *ToolResult

func (*InstallSkillTool) Name

func (t *InstallSkillTool) Name() string

func (*InstallSkillTool) Parameters

func (t *InstallSkillTool) Parameters() map[string]any

type MCPManager

type MCPManager interface {
	CallTool(
		ctx context.Context,
		serverName, toolName string,
		arguments map[string]any,
	) (*mcp.CallToolResult, error)
}

MCPManager defines the interface for MCP manager operations This allows for easier testing with mock implementations

type MCPTool

type MCPTool struct {
	// contains filtered or unexported fields
}

MCPTool wraps an MCP tool to implement the Tool interface

func NewMCPTool

func NewMCPTool(manager MCPManager, serverName string, tool *mcp.Tool) *MCPTool

NewMCPTool creates a new MCP tool wrapper

func (*MCPTool) Description

func (t *MCPTool) Description() string

Description returns the tool description

func (*MCPTool) Execute

func (t *MCPTool) Execute(ctx context.Context, args map[string]any) *ToolResult

Execute executes the MCP tool

func (*MCPTool) Name

func (t *MCPTool) Name() string

Name returns the tool name, prefixed with the server name. The total length is capped at 64 characters (OpenAI-compatible API limit). A short hash of the original (unsanitized) server and tool names is appended whenever sanitization is lossy or the name is truncated, ensuring that two names which differ only in disallowed characters remain distinct after sanitization.

func (*MCPTool) Parameters

func (t *MCPTool) Parameters() map[string]any

Parameters returns the tool parameters schema

func (*MCPTool) PromptMetadata added in v0.2.8

func (t *MCPTool) PromptMetadata() toolshared.PromptMetadata

func (*MCPTool) SetMaxInlineTextRunes

func (t *MCPTool) SetMaxInlineTextRunes(limit int)

func (*MCPTool) SetMediaStore

func (t *MCPTool) SetMediaStore(store media.MediaStore)

func (*MCPTool) SetWorkspace

func (t *MCPTool) SetWorkspace(workspace string)

type MessageTool

type MessageTool struct {
	// contains filtered or unexported fields
}

func NewMessageTool

func NewMessageTool() *MessageTool

func (*MessageTool) Description

func (t *MessageTool) Description() string

func (*MessageTool) Execute

func (t *MessageTool) Execute(ctx context.Context, args map[string]any) *ToolResult

func (*MessageTool) HasSentInRound

func (t *MessageTool) HasSentInRound(sessionKey string) bool

HasSentInRound returns true if the message tool sent a message during the current round.

func (*MessageTool) HasSentTo

func (t *MessageTool) HasSentTo(sessionKey, channel, chatID string) bool

HasSentTo returns true if the message tool sent to the specific channel+chatID during the current round. Used by PublishResponseIfNeeded to avoid suppressing the final response when the message tool only sent to a different conversation.

func (*MessageTool) Name

func (t *MessageTool) Name() string

func (*MessageTool) Parameters

func (t *MessageTool) Parameters() map[string]any

func (*MessageTool) ResetSentInRound

func (t *MessageTool) ResetSentInRound(sessionKey string)

ResetSentInRound resets the per-round send tracker for the given session key. Called by the agent loop at the start of each inbound message processing round.

func (*MessageTool) SetSendCallback

func (t *MessageTool) SetSendCallback(callback SendCallbackWithContext)

type PerplexitySearchProvider

type PerplexitySearchProvider struct {
	// contains filtered or unexported fields
}

func (*PerplexitySearchProvider) Search

func (p *PerplexitySearchProvider) Search(
	ctx context.Context,
	query string,
	count int,
	rangeCode string,
) (string, error)

type ReactionCallback

type ReactionCallback func(ctx context.Context, channel, chatID, messageID string) error

type ReactionTool

type ReactionTool struct {
	// contains filtered or unexported fields
}

func NewReactionTool

func NewReactionTool() *ReactionTool

func (*ReactionTool) Description

func (t *ReactionTool) Description() string

func (*ReactionTool) Execute

func (t *ReactionTool) Execute(ctx context.Context, args map[string]any) *ToolResult

func (*ReactionTool) Name

func (t *ReactionTool) Name() string

func (*ReactionTool) Parameters

func (t *ReactionTool) Parameters() map[string]any

func (*ReactionTool) SetReactionCallback

func (t *ReactionTool) SetReactionCallback(callback ReactionCallback)

type SearXNGSearchProvider

type SearXNGSearchProvider struct {
	// contains filtered or unexported fields
}

func (*SearXNGSearchProvider) Search

func (p *SearXNGSearchProvider) Search(
	ctx context.Context,
	query string,
	count int,
	rangeCode string,
) (string, error)

type SearchProvider

type SearchProvider interface {
	Search(ctx context.Context, query string, count int, rangeCode string) (string, error)
}

type SearchResultItem

type SearchResultItem struct {
	Title   string
	URL     string
	Snippet string
}

type SendCallbackWithContext

type SendCallbackWithContext func(ctx context.Context, channel, chatID, content, replyToMessageID string) error

type SendTTSTool

type SendTTSTool struct {
	// contains filtered or unexported fields
}

func NewSendTTSTool

func NewSendTTSTool(provider tts.TTSProvider, store media.MediaStore) *SendTTSTool

func (*SendTTSTool) Description

func (t *SendTTSTool) Description() string

func (*SendTTSTool) Execute

func (t *SendTTSTool) Execute(ctx context.Context, args map[string]any) *ToolResult

func (*SendTTSTool) Name

func (t *SendTTSTool) Name() string

func (*SendTTSTool) Parameters

func (t *SendTTSTool) Parameters() map[string]any

func (*SendTTSTool) SetMediaStore

func (t *SendTTSTool) SetMediaStore(store media.MediaStore)

type SogouSearchProvider

type SogouSearchProvider struct {
	// contains filtered or unexported fields
}

func (*SogouSearchProvider) Search

func (p *SogouSearchProvider) Search(
	ctx context.Context,
	query string,
	count int,
	rangeCode string,
) (string, error)

type TavilySearchProvider

type TavilySearchProvider struct {
	// contains filtered or unexported fields
}

func (*TavilySearchProvider) Search

func (p *TavilySearchProvider) Search(
	ctx context.Context,
	query string,
	count int,
	rangeCode string,
) (string, error)

type Tool

type Tool = toolshared.Tool

type ToolResult

type ToolResult = toolshared.ToolResult

func ErrorResult

func ErrorResult(message string) *ToolResult

func MediaResult

func MediaResult(forLLM string, mediaRefs []string) *ToolResult

func NewToolResult

func NewToolResult(forLLM string) *ToolResult

func SilentResult

func SilentResult(forLLM string) *ToolResult

func UserResult

func UserResult(content string) *ToolResult

type WebFetchTool

type WebFetchTool struct {
	// contains filtered or unexported fields
}

func NewWebFetchTool

func NewWebFetchTool(maxChars int, format string, fetchLimitBytes int64) (*WebFetchTool, error)

func NewWebFetchToolWithConfig

func NewWebFetchToolWithConfig(
	maxChars int,
	proxy string,
	format string,
	fetchLimitBytes int64,
	privateHostWhitelist []string,
) (*WebFetchTool, error)

func NewWebFetchToolWithProxy

func NewWebFetchToolWithProxy(
	maxChars int,
	proxy string,
	format string,
	fetchLimitBytes int64,
	privateHostWhitelist []string,
) (*WebFetchTool, error)

func (*WebFetchTool) Description

func (t *WebFetchTool) Description() string

func (*WebFetchTool) Execute

func (t *WebFetchTool) Execute(ctx context.Context, args map[string]any) *ToolResult

func (*WebFetchTool) Name

func (t *WebFetchTool) Name() string

func (*WebFetchTool) Parameters

func (t *WebFetchTool) Parameters() map[string]any

type WebSearchTool

type WebSearchTool struct {
	// contains filtered or unexported fields
}

func NewWebSearchTool

func NewWebSearchTool(opts WebSearchToolOptions) (*WebSearchTool, error)

func (*WebSearchTool) Description

func (t *WebSearchTool) Description() string

func (*WebSearchTool) Execute

func (t *WebSearchTool) Execute(ctx context.Context, args map[string]any) *ToolResult

func (*WebSearchTool) Name

func (t *WebSearchTool) Name() string

func (*WebSearchTool) Parameters

func (t *WebSearchTool) Parameters() map[string]any

type WebSearchToolOptions

type WebSearchToolOptions struct {
	Provider              string
	BraveAPIKeys          []string
	BraveMaxResults       int
	BraveEnabled          bool
	TavilyAPIKeys         []string
	TavilyBaseURL         string
	TavilyMaxResults      int
	TavilyEnabled         bool
	SogouMaxResults       int
	SogouEnabled          bool
	DuckDuckGoMaxResults  int
	DuckDuckGoEnabled     bool
	PerplexityAPIKeys     []string
	PerplexityMaxResults  int
	PerplexityEnabled     bool
	SearXNGBaseURL        string
	SearXNGMaxResults     int
	SearXNGEnabled        bool
	GLMSearchAPIKey       string
	GLMSearchBaseURL      string
	GLMSearchEngine       string
	GLMSearchMaxResults   int
	GLMSearchEnabled      bool
	BaiduSearchAPIKey     string
	BaiduSearchBaseURL    string
	BaiduSearchMaxResults int
	BaiduSearchEnabled    bool
	Proxy                 string
}

func WebSearchToolOptionsFromConfig added in v0.2.8

func WebSearchToolOptionsFromConfig(cfg *config.Config) WebSearchToolOptions

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL