feat: add brain_query and brain_write MCP tools
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>
This commit is contained in:
55
internal/skills/brain/skill.go
Normal file
55
internal/skills/brain/skill.go
Normal file
@@ -0,0 +1,55 @@
|
||||
// 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,
|
||||
}),
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user