Documentation
¶
Index ¶
- type Builder
- func (b *Builder) BuildLLMContextUserRequest(bot *bots.Bot, requestingUser *model.User, channel *model.Channel, ...) *llm.Context
- func (b *Builder) SetMCPDynamicToolTelemetry(telemetry llm.MCPDynamicToolTelemetry)
- func (b *Builder) WithLLMContextBot(bot *bots.Bot) llm.ContextOption
- func (b *Builder) WithLLMContextChannel(channel *model.Channel) llm.ContextOption
- func (b *Builder) WithLLMContextConcreteTools(ctx stdcontext.Context, bot *bots.Bot) llm.ContextOption
- func (b *Builder) WithLLMContextDefaultTools(ctx stdcontext.Context, bot *bots.Bot) llm.ContextOption
- func (b *Builder) WithLLMContextDisabledMCPServers(origins []string) llm.ContextOption
- func (b *Builder) WithLLMContextInteractive() llm.ContextOption
- func (b *Builder) WithLLMContextMCPToolFilter(keep func(llm.Tool) bool) llm.ContextOption
- func (b *Builder) WithLLMContextNoTools() llm.ContextOption
- func (b *Builder) WithLLMContextParameters(params map[string]interface{}) llm.ContextOption
- func (b *Builder) WithLLMContextPreloadedMCPTools(tools []llm.EnabledMCPTool) llm.ContextOption
- func (b *Builder) WithLLMContextRequestingUser(user *model.User) llm.ContextOption
- func (b *Builder) WithLLMContextServerInfo() llm.ContextOption
- func (b *Builder) WithLLMContextTools(ctx stdcontext.Context, bot *bots.Bot) llm.ContextOption
- type ConfigProvider
- type MCPToolProvider
- type MCPToolRetrievalOverrideProvider
- type ToolProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder builds contexts for LLM requests
func NewLLMContextBuilder ¶
func NewLLMContextBuilder( pluginAPI *pluginapi.Client, toolProvider ToolProvider, mcpToolProvider MCPToolProvider, configProvider ConfigProvider, ) *Builder
NewLLMContextBuilder creates a new LLM context builder
func (*Builder) BuildLLMContextUserRequest ¶
func (b *Builder) BuildLLMContextUserRequest(bot *bots.Bot, requestingUser *model.User, channel *model.Channel, opts ...llm.ContextOption) *llm.Context
BuildLLMContextUserRequest is a helper function to collect the required context for a user request.
func (*Builder) SetMCPDynamicToolTelemetry ¶
func (b *Builder) SetMCPDynamicToolTelemetry(telemetry llm.MCPDynamicToolTelemetry)
func (*Builder) WithLLMContextBot ¶
func (b *Builder) WithLLMContextBot(bot *bots.Bot) llm.ContextOption
func (*Builder) WithLLMContextChannel ¶
func (b *Builder) WithLLMContextChannel(channel *model.Channel) llm.ContextOption
func (*Builder) WithLLMContextConcreteTools ¶
func (b *Builder) WithLLMContextConcreteTools(ctx stdcontext.Context, bot *bots.Bot) llm.ContextOption
WithLLMContextConcreteTools adds the requester's tools but forces concrete MCP tools instead of dynamic-loading meta-tools. Bridge catalog APIs need the full concrete MCP tool list regardless of the bot's dynamic-loading setting.
func (*Builder) WithLLMContextDefaultTools ¶
func (b *Builder) WithLLMContextDefaultTools(ctx stdcontext.Context, bot *bots.Bot) llm.ContextOption
WithLLMContextDefaultTools adds default tools to the LLM context for the requesting user
func (*Builder) WithLLMContextDisabledMCPServers ¶
func (b *Builder) WithLLMContextDisabledMCPServers(origins []string) llm.ContextOption
func (*Builder) WithLLMContextInteractive ¶
func (b *Builder) WithLLMContextInteractive() llm.ContextOption
WithLLMContextInteractive marks the requesting user as interactively present and able to answer pending tool approvals. User-interaction tools (llm.Tool.UserInteraction) are only cataloged when this is applied, so it must be configured before default tools are built. Automated invokers (bots, webhooks, bridge API, evals) must never set this.
func (*Builder) WithLLMContextMCPToolFilter ¶
func (*Builder) WithLLMContextNoTools ¶
func (b *Builder) WithLLMContextNoTools() llm.ContextOption
WithLLMContextNoTools explicitly disables tools for this context session only, overriding the bot's DisableTools configuration. This allows inter-plugin requests to work with tool-enabled bots by bypassing tools for non-streaming calls.
func (*Builder) WithLLMContextParameters ¶
func (b *Builder) WithLLMContextParameters(params map[string]interface{}) llm.ContextOption
func (*Builder) WithLLMContextPreloadedMCPTools ¶
func (b *Builder) WithLLMContextPreloadedMCPTools(tools []llm.EnabledMCPTool) llm.ContextOption
WithLLMContextPreloadedMCPTools requests exact-or-bare MCP tools for internal predefined flows. The selected tools are still constrained by the normal authorized MCP catalog and must be configured before default tools are built.
func (*Builder) WithLLMContextRequestingUser ¶
func (b *Builder) WithLLMContextRequestingUser(user *model.User) llm.ContextOption
func (*Builder) WithLLMContextServerInfo ¶
func (b *Builder) WithLLMContextServerInfo() llm.ContextOption
func (*Builder) WithLLMContextTools ¶
func (b *Builder) WithLLMContextTools(ctx stdcontext.Context, bot *bots.Bot) llm.ContextOption
WithLLMContextTools adds tools to the LLM context the requester can access. Tools are always added for LLM awareness; execution is controlled via WithToolsDisabled() based on the context (e.g., DM vs channel).
type ConfigProvider ¶
type ConfigProvider interface {
GetServiceByID(id string) (llm.ServiceConfig, bool)
}
ConfigProvider provides configuration access
type MCPToolProvider ¶
type MCPToolProvider interface {
GetToolsForUser(ctx stdcontext.Context, userID string) ([]llm.Tool, *mcp.Errors)
}
MCPToolProvider provides MCP tools for a user
type MCPToolRetrievalOverrideProvider ¶
type MCPToolRetrievalOverrideProvider interface {
GetToolRetrievalOverrides() map[string]mcp.ToolRetrievalOverride
}