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
SoulsList(ctx context.Context) ([]models.Soul, error)
SoulsGet(ctx context.Context, slug models.Slug) (*models.Soul, error)
SoulsUpsert(ctx context.Context, slug models.Slug, content string) (*models.Soul, error)
SoulsDelete(ctx context.Context, slug models.Slug) error
PersonasList(ctx context.Context) ([]models.Persona, error)
PersonasGet(ctx context.Context, slug models.Slug) (*models.Persona, error)
PersonasUpsert(ctx context.Context, slug models.Slug, content string, bundledRules []models.Slug) (*models.Persona, error)
PersonasDelete(ctx context.Context, slug models.Slug) error
RulesList(ctx context.Context) ([]models.Rule, error)
RulesGet(ctx context.Context, slug models.Slug) (*models.Rule, error)
RulesUpsert(ctx context.Context, slug models.Slug, entries []models.RuleEntry) (*models.Rule, error)
RulesDelete(ctx context.Context, slug models.Slug) error
BrainsList(ctx context.Context) ([]models.Brain, error)
BrainsGet(ctx context.Context, slug models.Slug) (*models.Brain, error)
BrainsUpsert(ctx context.Context, slug, soulSlug, personaSlug models.Slug, ruleSlugs []models.Slug, procedureSlug models.Slug, skillSlugs []models.Slug, prefs *models.ModelPrefs) (*models.Brain, error)
BrainsDelete(ctx context.Context, slug models.Slug) error
ProceduresList(ctx context.Context) ([]models.Procedure, error)
ProceduresGet(ctx context.Context, slug models.Slug) (*models.Procedure, error)
ProceduresUpsert(ctx context.Context, slug models.Slug, content string) (*models.Procedure, error)
ProceduresDelete(ctx context.Context, slug models.Slug) error
SkillsList(ctx context.Context) ([]models.Skill, error)
SkillsGet(ctx context.Context, slug models.Slug) (*models.Skill, error)
SkillsUpsert(ctx context.Context, slug models.Slug, description, body string, triggers []string, version int, scope models.SkillScope) (*models.Skill, error)
SkillsDelete(ctx context.Context, slug models.Slug) error
SkillsAttach(ctx context.Context, brainSlug, skillSlug models.Slug, position int) error
SkillsDetach(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)
VersionsList(ctx context.Context, contentType models.ContentType, slug models.Slug) ([]models.VersionSummary, error)
VersionsGet(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 is the subset of brainjar's Backend the MCP tools depend on. Both LocalBackend and RemoteBackend satisfy it — the same stdio server can target a local SQLite or a remote HTTPS endpoint.
Workspace is bound to the backend at construction, so tools never pass a workspace argument. The state-scoping arg (project) stays on the calls that take it, matching the HTTP API shape.
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.