tools

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package tools holds the brainjar MCP tool implementations. Each file groups the tools for one resource; shared helpers live here.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterAPIKey added in v0.3.1

func RegisterAPIKey(s *mcp.Server, b Backend)

RegisterAPIKey mounts apikey_create / apikey_list / apikey_revoke.

func RegisterAdmin added in v0.3.1

func RegisterAdmin(s *mcp.Server, b Backend)

RegisterAdmin mounts admin_export / admin_import.

func RegisterBrain

func RegisterBrain(s *mcp.Server, b Backend)

func RegisterCompose

func RegisterCompose(s *mcp.Server, b Backend)

func RegisterPersona

func RegisterPersona(s *mcp.Server, b Backend)

func RegisterRule

func RegisterRule(s *mcp.Server, b Backend)

func RegisterSoul

func RegisterSoul(s *mcp.Server, b Backend)

RegisterSoul mounts soul_list / soul_show / soul_save / soul_delete on the server, bound to the given backend.

func RegisterState

func RegisterState(s *mcp.Server, b Backend)

func RegisterStatus

func RegisterStatus(s *mcp.Server, b Backend)

func RegisterVersion added in v0.3.1

func RegisterVersion(s *mcp.Server, b Backend)

RegisterVersion mounts version_list / version_show on the server.

func RegisterWorkspace added in v0.3.1

func RegisterWorkspace(s *mcp.Server, b Backend)

RegisterWorkspace mounts workspace_{create,list,get_by_name,rename,delete}.

Types

type Backend added in v0.3.1

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, prefs *models.ModelPrefs) (*models.Brain, error)
	BrainsDelete(ctx context.Context, slug 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL