Documentation
¶
Index ¶
- Variables
- type CurrentNovel
- type CurrentNovelFunc
- type Endpoint
- type LocalView
- type Repository
- type Server
- func (s *Server) AvailableTools() []string
- func (s *Server) SetAllowedTools(names []string) error
- func (s *Server) SetPort(port int) error
- func (s *Server) SetToolContextProvider(provider ToolContextProvider) error
- func (s *Server) Start(token string) (Endpoint, error)
- func (s *Server) Status() Status
- func (s *Server) Stop(ctx context.Context) error
- type Service
- func (s *Service) Close(ctx context.Context) error
- func (s *Service) LocalSettings() LocalView
- func (s *Service) Restore() error
- func (s *Service) RevokeCredential(ctx context.Context) error
- func (s *Service) RotateCredential(ctx context.Context) (LocalView, error)
- func (s *Service) SaveLocal(ctx context.Context, config servercfg.Local) (LocalView, error)
- type Status
- type ToolContextProvider
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoCurrentNovel = errors.New("当前没有打开的小说")
ErrNoCurrentNovel 表示 Goink 界面当前没有打开的小说。
Functions ¶
This section is empty.
Types ¶
type CurrentNovel ¶
CurrentNovel 是每次 MCP 调用看到的当前小说快照。
type CurrentNovelFunc ¶
type CurrentNovelFunc func(context.Context) (CurrentNovel, error)
CurrentNovelFunc 在请求开始时读取当前小说,不使用上次打开的历史设置。
type Repository ¶ added in v1.7.0
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server 将明确选中的 Goink 工具提供为本地 MCP 协议端点。
func New ¶
func New(registry *mcp_tools.Registry, db *gorm.DB, current CurrentNovelFunc, logger *slog.Logger) *Server
New 构建默认不监听的服务,工具权限通过 SetAllowedTools 设置。
func (*Server) AvailableTools ¶ added in v1.7.0
AvailableTools 返回 Registry 中全部可选工具;内置工具由 Server 单独提供。
func (*Server) SetAllowedTools ¶ added in v1.7.0
SetAllowedTools 只在旧请求排空后替换策略,运行中的请求始终使用原来的不可变白名单。
func (*Server) SetToolContextProvider ¶ added in v1.7.0
func (s *Server) SetToolContextProvider(provider ToolContextProvider) error
SetToolContextProvider 在启动前注入依赖,运行中不允许更换。
type Service ¶ added in v1.7.0
type Service struct {
// contains filtered or unexported fields
}
Service 编排本地 Server 配置、令牌与运行状态。
func NewService ¶ added in v1.7.0
func NewService(store Repository, server *Server) (*Service, error)
New 加载失败时仍返回停用的 Service,供应用展示错误并统一关闭;异常配置不会被覆盖。
func (*Service) LocalSettings ¶ added in v1.7.0
func (*Service) RevokeCredential ¶ added in v1.7.0
RevokeCredential 同时持久化关闭状态,重启应用也不能使旧凭据重新生效。
func (*Service) RotateCredential ¶ added in v1.7.0
type ToolContextProvider ¶ added in v1.7.0
ToolContextProvider 注入工具依赖及桌面上下文;返回的上下文须保留请求的取消和截止时间。
Click to show internal directories.
Click to hide internal directories.