Adds the brain skill that proxies HTTP calls to the ingestion server, exposing brain_query (/query) and brain_write (/write) as MCP tools. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
56 lines
1.5 KiB
Go
56 lines
1.5 KiB
Go
// internal/skills/brain/skill.go
|
|
package brain
|
|
|
|
import (
|
|
"encoding/json"
|
|
|
|
"github.com/mathiasbq/supervisor/internal/registry"
|
|
)
|
|
|
|
// Config holds brain skill configuration.
|
|
type Config struct {
|
|
IngestBaseURL string // base URL of the ingestion HTTP server, e.g. http://localhost:3300
|
|
}
|
|
|
|
// Skill implements registry.Skill for brain_query and brain_write.
|
|
type Skill struct {
|
|
cfg Config
|
|
}
|
|
|
|
// New constructs a brain Skill.
|
|
func New(cfg Config) *Skill { return &Skill{cfg: cfg} }
|
|
|
|
// Name returns the skill name used for routing.
|
|
func (s *Skill) Name() string { return "brain" }
|
|
|
|
// Tools returns the MCP tool definitions for brain_query and brain_write.
|
|
func (s *Skill) Tools() []registry.ToolDef {
|
|
schema := func(required []string, props map[string]any) json.RawMessage {
|
|
b, _ := json.Marshal(map[string]any{"type": "object", "required": required, "properties": props})
|
|
return b
|
|
}
|
|
str := map[string]any{"type": "string"}
|
|
num := map[string]any{"type": "integer"}
|
|
|
|
return []registry.ToolDef{
|
|
{
|
|
Name: "brain_query",
|
|
Description: "Search the hyperguild brain wiki for relevant knowledge. Call this before starting any significant task.",
|
|
InputSchema: schema([]string{"query"}, map[string]any{
|
|
"query": str,
|
|
"limit": num,
|
|
}),
|
|
},
|
|
{
|
|
Name: "brain_write",
|
|
Description: "Write a raw knowledge note to the brain for later ingestion into the wiki.",
|
|
InputSchema: schema([]string{"content"}, map[string]any{
|
|
"content": str,
|
|
"type": str,
|
|
"domain": str,
|
|
"filename": str,
|
|
}),
|
|
},
|
|
}
|
|
}
|