Documentation
¶
Index ¶
- Constants
- type ChannelServerStatus
- type HeaderFunc
- type Invoker
- type MCPConnection
- type Registry
- func (r *Registry) AddServer(ctx context.Context, server *mcps.ServerBasic) error
- func (r *Registry) ApplyToolDescriptions(descriptions map[string]string)
- func (r *Registry) ChannelServerStatuses(channel string) []ChannelServerStatus
- func (r *Registry) Invoke(ctx context.Context, name string, params map[string]any) (map[string]any, error)
- func (r *Registry) LoadServers(ctx context.Context, sto stores.Storage) error
- func (r *Registry) RemoveChannelTools(channel string)
- func (r *Registry) RemoveServer(name string) error
- func (r *Registry) ToolsFor(ctx context.Context) []mcps.ToolDescriptor
- type RegistryOption
- type ResultLogs
Constants ¶
View Source
const ( ToolNameKBSearch = "kb_search" // 知识库搜索工具 ToolNameKBCreate = "kb_create" // 知识库创建工具 ToolNameFetch = "fetch" // 网页抓取工具 ToolNameMemoryList = "memory_list" // 记忆列表工具 ToolNameMemoryRecall = "memory_recall" // 记忆召回工具 ToolNameMemoryStore = "memory_store" // 记忆存储工具 ToolNameMemoryForget = "memory_forget" // 记忆删除工具 ToolNameCapabilityMatch = "capability_match" // API 能力匹配工具 ToolNameCapabilityInvoke = "capability_invoke" // API 能力调用工具 ToolNameStrataExec = "strata_exec" )
View Source
const (
DEFAULT_USER_AGENT_AUTONOMOUS = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChannelServerStatus ¶ added in v0.7.0
type ChannelServerStatus struct {
Name string `json:"name"`
URL string `json:"url"`
Tools []string `json:"tools"`
}
ChannelServerStatus 表示频道 MCP Server 的状态
type HeaderFunc ¶ added in v0.2.4
type HeaderFunc = transport.HTTPHeaderFunc
type MCPConnection ¶
type MCPConnection struct {
Channel string
Name string
URL string
TransType mcps.TransType
// contains filtered or unexported fields
}
MCPConnection represents a connection to an MCP server
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶
func NewRegistry(sto stores.Storage, opts ...RegistryOption) *Registry
NewRegistry 创建工具注册表
func (*Registry) ApplyToolDescriptions ¶ added in v0.2.3
ApplyToolDescriptions 应用 preset 中的自定义工具描述 descriptions: toolName -> description
func (*Registry) ChannelServerStatuses ¶ added in v0.7.0
func (r *Registry) ChannelServerStatuses(channel string) []ChannelServerStatus
ChannelServerStatuses 返回指定频道的 MCP Server 状态列表
func (*Registry) Invoke ¶
func (r *Registry) Invoke(ctx context.Context, name string, params map[string]any) (map[string]any, error)
Invoke 调用指定名称的工具,频道工具优先
func (*Registry) LoadServers ¶
LoadServers 加载所有 Running 状态的 MCP Server
func (*Registry) RemoveChannelTools ¶ added in v0.7.0
RemoveChannelTools 移除指定频道的所有专属工具
func (*Registry) RemoveServer ¶
RemoveServer 移除 MCP Server 连接
type RegistryOption ¶
type RegistryOption func(*Registry)
RegistryOption 用于配置 Registry 的可选参数
func WithClientInfo ¶
func WithClientInfo(name, version string) RegistryOption
WithClientInfo 设置 MCP 客户端信息
func WithHeaderFunc ¶ added in v0.2.4
func WithHeaderFunc(hf HeaderFunc) RegistryOption
type ResultLogs ¶
ResultLogs 是工具调用结果的日志类型别名
func (ResultLogs) String ¶
func (rl ResultLogs) String() string
String 实现 fmt.Stringer 接口,返回格式化的结果日志 格式为 {key: val[0:min(30,len(val)},如果值不是 string/slice/map,则为 key: ""
Click to show internal directories.
Click to hide internal directories.