Documentation
¶
Index ¶
- Variables
- func RenderSkillMD(skill *AgentSkill) ([]byte, error)
- func ValidateSkill(s *AgentSkill) error
- func ValidateSkillName(name string) error
- type AgentSkill
- type ItemState
- type RegistryStatus
- type Server
- func (s *Server) CallTool(ctx context.Context, name string, arguments map[string]any) (*mcp.ToolCallResult, 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) RefreshTools(ctx context.Context) error
- func (s *Server) ServerInfo() mcp.ServerInfo
- func (s *Server) Store() *Store
- func (s *Server) Tools() []mcp.Tool
- type SkillFile
- type Store
- func (s *Store) ActiveSkills() []*AgentSkill
- func (s *Store) DeleteFile(skillName, filePath string) error
- func (s *Store) DeleteSkill(name string) error
- func (s *Store) GetSkill(name string) (*AgentSkill, error)
- func (s *Store) HasContent() bool
- func (s *Store) ListFiles(skillName string) ([]SkillFile, error)
- func (s *Store) ListSkills() []*AgentSkill
- func (s *Store) Load() error
- func (s *Store) ReadFile(skillName, filePath string) ([]byte, error)
- func (s *Store) RenameSkill(oldName, newName string) error
- func (s *Store) SaveSkill(sk *AgentSkill) error
- func (s *Store) Status() RegistryStatus
- func (s *Store) WriteFile(skillName, filePath string, data []byte) error
- type ValidationResult
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("not found")
ErrNotFound is returned when a skill does not exist in the store.
Functions ¶
func RenderSkillMD ¶
func RenderSkillMD(skill *AgentSkill) ([]byte, error)
RenderSkillMD serializes an AgentSkill back to SKILL.md format.
func ValidateSkill ¶
func ValidateSkill(s *AgentSkill) error
ValidateSkill validates an AgentSkill and returns just the error (convenience wrapper).
func ValidateSkillName ¶
ValidateSkillName validates a skill name against the agentskills.io spec.
Types ¶
type AgentSkill ¶
type AgentSkill struct {
// --- Frontmatter fields (from YAML between --- delimiters) ---
Name string `yaml:"name" json:"name"`
Description string `yaml:"description" json:"description"`
License string `yaml:"license,omitempty" json:"license,omitempty"`
Compatibility string `yaml:"compatibility,omitempty" json:"compatibility,omitempty"`
Metadata map[string]string `yaml:"metadata,omitempty" json:"metadata,omitempty"`
AllowedTools string `yaml:"allowed-tools,omitempty" json:"allowedTools,omitempty"`
// --- Gridctl extensions (not in agentskills.io spec) ---
State ItemState `yaml:"state,omitempty" json:"state"`
// --- Parsed from file content (not in frontmatter YAML) ---
Body string `yaml:"-" json:"body"` // Markdown content after frontmatter
// --- Computed fields (not serialized to YAML) ---
FileCount int `yaml:"-" json:"fileCount"` // Number of supporting files (scripts/, references/, assets/)
Dir string `yaml:"-" json:"-"` // Relative path from skills/ root (e.g., "git-workflow/branch-fork")
}
AgentSkill represents an Agent Skills standard SKILL.md file. See https://agentskills.io/specification for the full spec.
func ParseSkillMD ¶
func ParseSkillMD(data []byte) (*AgentSkill, error)
ParseSkillMD parses a SKILL.md file into an AgentSkill. The file format is YAML frontmatter between --- delimiters followed by a markdown body.
func (*AgentSkill) Validate ¶
func (s *AgentSkill) Validate() error
Validate checks the skill against the agentskills.io specification.
type ItemState ¶
type ItemState string
ItemState represents the lifecycle state of a skill. Note: state is a gridctl extension, not part of the agentskills.io spec.
type RegistryStatus ¶
type RegistryStatus struct {
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 serves Agent Skills as prompts. It implements mcp.AgentClient so it can be registered with the gateway router, and mcp.PromptProvider so the gateway can serve skills via MCP prompts and resources.
Agent Skills are knowledge documents, not executable tools. The server exposes them as MCP prompts (prompts/list, prompts/get) and resources (resources/list, resources/read) rather than as MCP tools.
func New ¶
New creates a registry server. Unlike the previous version, no ToolCaller is needed — Agent Skills are knowledge documents served to clients, not executable operations.
func (*Server) CallTool ¶
func (s *Server) CallTool(ctx context.Context, name string, arguments map[string]any) (*mcp.ToolCallResult, error)
CallTool returns an error — Agent Skills are knowledge documents, not executable tools.
func (*Server) GetPromptData ¶
func (s *Server) GetPromptData(name string) (*mcp.PromptData, error)
GetPromptData returns a specific active skill's content as MCP PromptData.
func (*Server) HasContent ¶
HasContent returns true if the registry has any skills.
func (*Server) Initialize ¶
Initialize loads the store.
func (*Server) IsInitialized ¶
IsInitialized returns whether the server has been initialized.
func (*Server) ListPromptData ¶
func (s *Server) ListPromptData() []mcp.PromptData
ListPromptData returns active Agent Skills as MCP PromptData. Each skill gets a single optional "context" argument for clients to pass additional context when requesting the skill via prompts/get.
func (*Server) RefreshTools ¶
RefreshTools reloads the store from disk.
func (*Server) ServerInfo ¶
func (s *Server) ServerInfo() mcp.ServerInfo
ServerInfo returns server information.
type SkillFile ¶
type SkillFile struct {
Path string `json:"path"` // Relative path within the skill dir (e.g., "scripts/lint.sh")
Size int64 `json:"size"` // File size in bytes
IsDir bool `json:"isDir"` // True for directories
}
SkillFile represents a file within a skill directory.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store manages skill directories on disk. Each skill is a directory containing a required SKILL.md and optional supporting files (scripts/, references/, assets/).
func (*Store) ActiveSkills ¶
func (s *Store) ActiveSkills() []*AgentSkill
ActiveSkills returns only skills with State == "active". Returned pointers are copies.
func (*Store) DeleteFile ¶
DeleteFile removes a file from a skill directory.
func (*Store) DeleteSkill ¶
DeleteSkill removes a skill directory and cache entry.
func (*Store) GetSkill ¶
func (s *Store) GetSkill(name string) (*AgentSkill, error)
GetSkill returns a skill by name.
func (*Store) HasContent ¶
HasContent returns true if there is at least one skill.
func (*Store) ListSkills ¶
func (s *Store) ListSkills() []*AgentSkill
ListSkills returns all skills (all states). Returned pointers are copies.
func (*Store) Load ¶
Load scans the skills/ subdirectory for SKILL.md files and checks for legacy YAML registry files.
func (*Store) RenameSkill ¶
RenameSkill renames a skill directory and updates its frontmatter.
func (*Store) SaveSkill ¶
func (s *Store) SaveSkill(sk *AgentSkill) error
SaveSkill creates or updates a skill (validates, writes SKILL.md, updates cache).
func (*Store) Status ¶
func (s *Store) Status() RegistryStatus
Status returns registry summary counts.
type ValidationResult ¶
type ValidationResult struct {
Errors []string // Fatal validation failures
Warnings []string // Non-fatal advisories (e.g., body too long)
}
ValidationResult contains errors and warnings from skill validation.
func ValidateSkillFull ¶
func ValidateSkillFull(s *AgentSkill) *ValidationResult
ValidateSkillFull validates an AgentSkill and returns both errors and warnings.
func (*ValidationResult) Error ¶
func (v *ValidationResult) Error() error
Error returns the first error as a Go error, or nil if valid.
func (*ValidationResult) Valid ¶
func (v *ValidationResult) Valid() bool
Valid returns true if there are no errors (warnings are OK).