Documentation
¶
Overview ¶
Package tools holds the brainjar MCP tool implementations. Each file groups the tools for one resource; shared helpers live here.
Index ¶
- func RegisterAPIKey(s *mcp.Server, b Backend)
- func RegisterAdmin(s *mcp.Server, b Backend)
- func RegisterBrain(s *mcp.Server, b Backend)
- func RegisterCompose(s *mcp.Server, b Backend, defaultCat platform.ModelCatalog)
- func RegisterGuide(s *mcp.Server, reg *guides.Registry)
- func RegisterPersona(s *mcp.Server, b Backend)
- func RegisterProcedure(s *mcp.Server, b Backend)
- func RegisterRule(s *mcp.Server, b Backend)
- func RegisterSkill(s *mcp.Server, b Backend)
- func RegisterSoul(s *mcp.Server, b Backend)
- func RegisterState(s *mcp.Server, b Backend)
- func RegisterStatus(s *mcp.Server, b Backend)
- func RegisterVersion(s *mcp.Server, b Backend)
- func RegisterWorkspace(s *mcp.Server, b Backend)
- type Backend
- type SkillSummary
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterAPIKey ¶
RegisterAPIKey mounts apikey_create / apikey_list / apikey_revoke.
func RegisterAdmin ¶
RegisterAdmin mounts admin_export / admin_import.
func RegisterBrain ¶
func RegisterCompose ¶
func RegisterCompose(s *mcp.Server, b Backend, defaultCat platform.ModelCatalog)
RegisterCompose registers the `compose` tool. defaultCat is the active platform's model catalog used when a brain has no platform pin; pass nil in multi-tenant transports (HTTP serve) where there is no single active platform — resolution then falls back to whatever catalog the brain's pinned platform exposes, or skips silently when neither resolves.
func RegisterGuide ¶ added in v0.6.0
RegisterGuide wires the read-only guide tools onto s. Guides are brainjar-shipped operational docs about how to use brainjar's MCP tools correctly; they are read from the binary's embed, not from the SQLite store, so this registration takes a *guides.Registry directly rather than a Backend.
func RegisterPersona ¶
func RegisterProcedure ¶ added in v0.6.0
func RegisterRule ¶
func RegisterSkill ¶ added in v0.6.0
func RegisterSoul ¶
RegisterSoul mounts soul_list / soul_show / soul_save / soul_delete on the server, bound to the given backend.
func RegisterState ¶
func RegisterStatus ¶
func RegisterVersion ¶
RegisterVersion mounts version_list / version_show on the server.
func RegisterWorkspace ¶
RegisterWorkspace mounts workspace_{create,list,get_by_name,rename,delete}.
Types ¶
type Backend ¶
type Backend interface {
WorkspaceID() models.WorkspaceID
SoulList(ctx context.Context) ([]models.Soul, error)
SoulGet(ctx context.Context, slug models.Slug) (*models.Soul, error)
SoulUpsert(ctx context.Context, slug models.Slug, content string) (*models.Soul, error)
SoulDelete(ctx context.Context, slug models.Slug) error
PersonaList(ctx context.Context) ([]models.Persona, error)
PersonaGet(ctx context.Context, slug models.Slug) (*models.Persona, error)
PersonaUpsert(ctx context.Context, slug models.Slug, content string, bundledRules []models.Slug) (*models.Persona, error)
PersonaDelete(ctx context.Context, slug models.Slug) error
RuleList(ctx context.Context) ([]models.Rule, error)
RuleGet(ctx context.Context, slug models.Slug) (*models.Rule, error)
RuleUpsert(ctx context.Context, slug models.Slug, entries []models.RuleEntry) (*models.Rule, error)
RuleDelete(ctx context.Context, slug models.Slug) error
BrainList(ctx context.Context) ([]models.Brain, error)
BrainGet(ctx context.Context, slug models.Slug) (*models.Brain, error)
BrainUpsert(ctx context.Context, slug, soulSlug, personaSlug models.Slug, ruleSlugs []models.Slug, procedureSlug models.Slug, skillSlugs []models.Slug, prefs *models.ModelPrefs) (*models.Brain, error)
BrainDelete(ctx context.Context, slug models.Slug) error
ProcedureList(ctx context.Context) ([]models.Procedure, error)
ProcedureGet(ctx context.Context, slug models.Slug) (*models.Procedure, error)
ProcedureUpsert(ctx context.Context, slug models.Slug, content string) (*models.Procedure, error)
ProcedureDelete(ctx context.Context, slug models.Slug) error
SkillList(ctx context.Context) ([]models.Skill, error)
SkillGet(ctx context.Context, slug models.Slug) (*models.Skill, error)
SkillUpsert(ctx context.Context, slug models.Slug, description, body string, triggers []string, version int, scope models.SkillScope) (*models.Skill, error)
SkillDelete(ctx context.Context, slug models.Slug) error
SkillAttach(ctx context.Context, brainSlug, skillSlug models.Slug, position int) error
SkillDetach(ctx context.Context, brainSlug, skillSlug models.Slug) error
StateFindLayers(ctx context.Context, projectSlug string) ([]models.LayerOverride, error)
StateResolveForScope(ctx context.Context, projectSlug string) (*models.EffectiveState, error)
StateSet(ctx context.Context, scopeType models.ScopeType, referenceID string, partial *models.LayerOverride) error
StateDelete(ctx context.Context, scopeType models.ScopeType, referenceID string) error
ComposePrompt(ctx context.Context, req models.ComposeRequest) (*models.ComposeResponse, error)
VersionList(ctx context.Context, contentType models.ContentType, slug models.Slug) ([]models.VersionSummary, error)
VersionGet(ctx context.Context, contentType models.ContentType, slug models.Slug, version int) (*models.ContentVersion, error)
WorkspaceCreate(ctx context.Context, name string) (*models.Workspace, error)
WorkspaceList(ctx context.Context) ([]models.Workspace, error)
WorkspaceGetByName(ctx context.Context, name string) (*models.Workspace, error)
WorkspaceRename(ctx context.Context, id models.WorkspaceID, newName string) (*models.Workspace, error)
WorkspaceDelete(ctx context.Context, id models.WorkspaceID) error
WorkspacePurge(ctx context.Context, id models.WorkspaceID) error
APIKeyCreate(ctx context.Context, label string) (plaintext string, record *models.APIKey, err error)
APIKeyList(ctx context.Context) ([]models.APIKeySummary, error)
APIKeyRevoke(ctx context.Context, id models.APIKeyID) error
AdminExport(ctx context.Context) (*bundle.ContentBundle, error)
AdminImport(ctx context.Context, cb *bundle.ContentBundle) (*bundle.ImportResult, error)
}
Backend mirrors internal/backend.Backend without io.Closer (MCP handlers never close the backend) so this package can stay outside internal/backend's import cycle. Both LocalBackend and RemoteBackend satisfy this interface; the contract must stay in lockstep with internal/backend.Backend — when adding a method to one, add it to the other.
type SkillSummary ¶ added in v0.6.0
type SkillSummary struct {
Slug models.Slug `json:"slug"`
Description string `json:"description"`
Triggers []string `json:"triggers"`
Version int `json:"version"`
Scope models.SkillScope `json:"scope"`
}
SkillSummary is the per-row payload of skill_list. Bodies are heavy — clients call skill_show when they need the markdown.