Documentation
¶
Index ¶
- Variables
- type Argument
- type ItemState
- type Prompt
- type RegistryStatus
- type Server
- func (s *Server) CallTool(ctx context.Context, name string, arguments map[string]any) (*mcp.ToolCallResult, error)
- func (s *Server) GetPrompt(name string) (*Prompt, error)
- func (s *Server) GetPromptData(name string) (*mcp.PromptData, error)
- func (s *Server) HasContent() bool
- func (s *Server) Initialize(ctx context.Context) error
- func (s *Server) IsInitialized() bool
- func (s *Server) ListPromptData() []mcp.PromptData
- func (s *Server) Name() string
- func (s *Server) Prompts() []*Prompt
- func (s *Server) RefreshTools(ctx context.Context) error
- func (s *Server) ServerInfo() mcp.ServerInfo
- func (s *Server) Store() *Store
- func (s *Server) Tools() []mcp.Tool
- type Skill
- type Step
- type Store
- func (s *Store) ActivePrompts() []*Prompt
- func (s *Store) ActiveSkills() []*Skill
- func (s *Store) DeletePrompt(name string) error
- func (s *Store) DeleteSkill(name string) error
- func (s *Store) GetPrompt(name string) (*Prompt, error)
- func (s *Store) GetSkill(name string) (*Skill, error)
- func (s *Store) HasContent() bool
- func (s *Store) ListPrompts() []*Prompt
- func (s *Store) ListSkills() []*Skill
- func (s *Store) Load() error
- func (s *Store) SavePrompt(p *Prompt) error
- func (s *Store) SaveSkill(sk *Skill) error
- func (s *Store) Status() RegistryStatus
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("not found")
ErrNotFound is returned when a prompt or skill does not exist in the store.
Functions ¶
This section is empty.
Types ¶
type Argument ¶
type Argument struct {
Name string `yaml:"name" json:"name"`
Description string `yaml:"description" json:"description"`
Required bool `yaml:"required" json:"required"`
Default string `yaml:"default,omitempty" json:"default,omitempty"`
}
Argument represents a parameter in a prompt template.
type ItemState ¶
type ItemState string
ItemState represents the lifecycle state of a prompt or skill.
type Prompt ¶
type Prompt struct {
Name string `yaml:"name" json:"name"`
Description string `yaml:"description" json:"description"`
Content string `yaml:"content" json:"content"`
Arguments []Argument `yaml:"arguments,omitempty" json:"arguments,omitempty"`
Tags []string `yaml:"tags,omitempty" json:"tags,omitempty"`
State ItemState `yaml:"state" json:"state"`
}
Prompt represents a reusable prompt template.
type RegistryStatus ¶
type RegistryStatus struct {
TotalPrompts int `json:"totalPrompts"`
ActivePrompts int `json:"activePrompts"`
TotalSkills int `json:"totalSkills"`
ActiveSkills int `json:"activeSkills"`
}
RegistryStatus contains summary statistics.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is an in-process MCP server that provides prompt and skill management. It implements mcp.AgentClient so it can be registered with the gateway router.
func New ¶
func New(store *Store, toolCaller mcp.ToolCaller) *Server
New creates a registry server. The toolCaller parameter allows the registry to execute tools from other MCP servers when running skill chains. Pass nil if skill execution is not needed (e.g., prompts-only mode).
func (*Server) CallTool ¶
func (s *Server) CallTool(ctx context.Context, name string, arguments map[string]any) (*mcp.ToolCallResult, error)
CallTool looks up a skill by name and executes its tool chain.
func (*Server) GetPromptData ¶
func (s *Server) GetPromptData(name string) (*mcp.PromptData, error)
GetPromptData returns a prompt by name as MCP PromptData (implements mcp.PromptProvider).
func (*Server) HasContent ¶
HasContent returns true if the registry has any prompts or skills.
func (*Server) Initialize ¶
Initialize loads the store and builds the MCP tool list from active skills.
func (*Server) IsInitialized ¶
IsInitialized returns whether the server has been initialized.
func (*Server) ListPromptData ¶
func (s *Server) ListPromptData() []mcp.PromptData
ListPromptData returns all active prompts as MCP PromptData (implements mcp.PromptProvider).
func (*Server) RefreshTools ¶
RefreshTools re-scans the store and rebuilds the tools list.
func (*Server) ServerInfo ¶
func (s *Server) ServerInfo() mcp.ServerInfo
ServerInfo returns server information.
type Skill ¶
type Skill struct {
Name string `yaml:"name" json:"name"`
Description string `yaml:"description" json:"description"`
Steps []Step `yaml:"steps" json:"steps"`
Input []Argument `yaml:"input,omitempty" json:"input,omitempty"`
Timeout string `yaml:"timeout,omitempty" json:"timeout,omitempty"`
Tags []string `yaml:"tags,omitempty" json:"tags,omitempty"`
State ItemState `yaml:"state" json:"state"`
}
Skill represents a composed tool workflow.
type Step ¶
type Step struct {
Tool string `yaml:"tool" json:"tool"`
Arguments map[string]string `yaml:"arguments,omitempty" json:"arguments,omitempty"`
}
Step represents a single step in a skill's tool chain.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store manages prompt and skill YAML files on disk.
func (*Store) ActivePrompts ¶
ActivePrompts returns only prompts with State == "active". Returned pointers are copies.
func (*Store) ActiveSkills ¶
ActiveSkills returns only skills with State == "active". Returned pointers are copies.
func (*Store) DeletePrompt ¶
DeletePrompt removes a prompt file and cache entry.
func (*Store) DeleteSkill ¶
DeleteSkill removes a skill file and cache entry.
func (*Store) HasContent ¶
HasContent returns true if there is at least one prompt or skill.
func (*Store) ListPrompts ¶
ListPrompts returns all prompts (all states). Returned pointers are copies.
func (*Store) ListSkills ¶
ListSkills returns all skills (all states). Returned pointers are copies.
func (*Store) Load ¶
Load scans the prompts/ and skills/ subdirectories for YAML files. Call this once at initialization. Individual file parse errors are logged and skipped.
func (*Store) SavePrompt ¶
SavePrompt creates or updates a prompt (validates, writes YAML, updates cache).
func (*Store) SaveSkill ¶
SaveSkill creates or updates a skill (validates, writes YAML, updates cache).
func (*Store) Status ¶
func (s *Store) Status() RegistryStatus
Status returns registry summary counts.