agent

package
v1.782.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetIdFromServerNameAndToolName

func GetIdFromServerNameAndToolName(ServerName, toolName string) string

func GetMCPClientMap

func GetMCPClientMap(config string, toolsMap map[string]bool) (map[string]*client.Client, error)

func GetServerNameAndToolNameFromId

func GetServerNameAndToolNameFromId(id string) (string, string)

func ResolveMcpToolTarget

func ResolveMcpToolTarget(mcpTools []*McpTools, toolKey string) (serverName, nativeToolName string, err error)

ResolveMcpToolTarget resolves MCP server name and native tool name. toolKey may be "serverName__toolName" (see GetIdFromServerNameAndToolName) or a bare tool name that appears in exactly one enabled server's tool list.

func TestMcpToolCall

func TestMcpToolCall(mcpServers string, mcpTools []*McpTools, toolKey string, arguments map[string]interface{}) (string, error)

TestMcpToolCall connects to the configured MCP server and invokes tools/call once.

Types

type AgentClients

type AgentClients struct {
	Clients          map[string]*client.Client
	Tools            []*protocol.Tool
	BuiltinToolReg   *builtin_tool.ToolRegistry
	WebSearchEnabled bool
}

type AgentProvider

type AgentProvider interface {
	GetAgentClients() (*AgentClients, error)
}

func GetAgentProvider

func GetAgentProvider(typ string, subType string, text string, mcpTools []*McpTools, lang string) (AgentProvider, error)

type McpAgentProvider

type McpAgentProvider struct {
	Typ        string
	SubType    string
	McpServers string
	McpTools   []*McpTools
}

func NewMcpAgentProvider

func NewMcpAgentProvider(typ string, subType string, mcpServers string, mcpTools []*McpTools) (*McpAgentProvider, error)

func (*McpAgentProvider) GetAgentClients

func (p *McpAgentProvider) GetAgentClients() (*AgentClients, error)

type McpTools

type McpTools struct {
	ServerName string `json:"serverName"`
	Tools      string `json:"tools"`
	IsEnabled  bool   `json:"isEnabled"`
}

func GetToolsList

func GetToolsList(config string) ([]*McpTools, error)

type ServerConfig

type ServerConfig struct {
	// Stdio config
	Command string            `json:"command"`
	Args    []string          `json:"args"`
	Env     map[string]string `json:"env"`

	// SSE config
	URL string `json:"url"`

	// Transport type: "sse", "stdio", "streamablehttp"
	// If not specified, auto-detected based on URL field:
	// - URL not empty -> SSE
	// - URL empty -> Stdio
	Type string `json:"type,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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