Documentation
¶
Index ¶
- Constants
- func IsTractTool(name string) bool
- func PostgresToolDefinitions() []domain.McpToolDef
- func TractToolDefinitions() []domain.McpToolDef
- func VaultToolDefinitions() []domain.McpToolDef
- type EmailExecutor
- type HttpExecutor
- type PostgresExecutor
- type TractExecutor
- type TractService
- type VaultExecutor
Constants ¶
const ( ToolPgListTables = "pg_list_tables" ToolPgDescribeTable = "pg_describe_table" ToolPgQuery = "pg_query" ToolPgExecute = "pg_execute" )
const ( ToolListTractActions = "list_tract_actions" ToolCreateTract = "create_tract" ToolUpdateTract = "update_tract" ToolCreateTrigger = "create_trigger" ToolLinkTrigger = "link_trigger" ToolListTracts = "list_tracts" ToolGetTract = "get_tract" ToolGetTractRuns = "get_tract_runs" ToolRunTract = "run_tract" )
const ( ToolListFiles = "list_files" ToolReadFile = "read_file" ToolWriteFile = "write_file" ToolDeleteFile = "delete_file" ToolMoveFile = "move_file" ToolListFolders = "list_folders" ToolListTags = "list_tags" ToolGetFileMetadata = "get_file_metadata" )
Variables ¶
This section is empty.
Functions ¶
func IsTractTool ¶
IsTractTool reports whether name is one of the tract-authoring builtin tools.
func PostgresToolDefinitions ¶ added in v1.0.15
func PostgresToolDefinitions() []domain.McpToolDef
func TractToolDefinitions ¶
func TractToolDefinitions() []domain.McpToolDef
func VaultToolDefinitions ¶
func VaultToolDefinitions() []domain.McpToolDef
Types ¶
type EmailExecutor ¶
type EmailExecutor struct{}
func NewEmailExecutor ¶
func NewEmailExecutor() *EmailExecutor
func (*EmailExecutor) Execute ¶
func (e *EmailExecutor) Execute( ctx context.Context, action domain.ToolAction, creds domain.EmailCredentials, params map[string]interface{}, ) (string, error)
type HttpExecutor ¶
type HttpExecutor struct {
// contains filtered or unexported fields
}
func NewHttpExecutor ¶
func NewHttpExecutor() *HttpExecutor
type PostgresExecutor ¶ added in v1.0.15
type PostgresExecutor struct{}
PostgresExecutor implements the pg_list_tables/pg_describe_table/pg_query/pg_execute builtin tools. It holds no state of its own — the vault's tenant *sql.DB connection is resolved by internal/service/v1/mcp.ExecuteTool (via the shared vaultpg.ConnPool) and passed in per call, mirroring how VaultExecutor receives its couchdb/S3 clients per call.
func NewPostgresExecutor ¶ added in v1.0.15
func NewPostgresExecutor() *PostgresExecutor
func (*PostgresExecutor) Execute ¶ added in v1.0.15
func (e *PostgresExecutor) Execute( ctx context.Context, toolName string, db *sql.DB, params map[string]interface{}, ) (domain.ToolExecResult, error)
Execute dispatches a postgres tool call against db, the caller vault's dedicated tenant database connection.
type TractExecutor ¶
type TractExecutor struct{}
TractExecutor implements the tract-authoring builtin tools (list_tract_actions, create_tract, ...) that let an agent build and run tracts over MCP. It holds no state of its own — the tract service, the server-lifecycle context for run_tract's async StartRun call, and the caller's user_context are all supplied per call by internal/service/v1/mcp, which owns the service.TractService dependency (wired via McpService.SetTractService).
func NewTractExecutor ¶
func NewTractExecutor() *TractExecutor
func (*TractExecutor) Execute ¶
func (e *TractExecutor) Execute( ctx context.Context, baseCtx context.Context, ts TractService, toolName string, params map[string]interface{}, ) (domain.ToolExecResult, error)
Execute dispatches one tract-authoring builtin tool call. ctx must already carry the caller's user_context (the tract service's CreateTract/GetTract/... all require it for ownership checks). baseCtx is the server-lifecycle context run_tract spawns StartRun against, since the per-request ctx is cancelled once the MCP handler's response is written.
type TractService ¶
type TractService interface {
CreateTract(
ctx context.Context,
name string,
description string,
def domain.TractDefinition,
) (domain.Tract, []string, error)
UpdateTract(
ctx context.Context,
id uuid.UUID,
name string,
description string,
def domain.TractDefinition,
) (domain.Tract, []string, error)
GetTract(ctx context.Context, id uuid.UUID) (domain.Tract, error)
ListTracts(ctx context.Context) ([]domain.Tract, error)
CreateTrigger(
ctx context.Context,
name string,
kind string,
source string,
config json.RawMessage,
payloadSchema domain.ToolSchema,
) (domain.Trigger, string, error)
LinkTrigger(ctx context.Context, triggerUuid uuid.UUID, tractUuid uuid.UUID, filters []domain.TractCondition) error
ListLinksByTract(ctx context.Context, tractUuid uuid.UUID) ([]repository.TractTriggerLink, error)
StartRun(
ctx context.Context,
tract domain.Tract,
payload json.RawMessage,
startedBy string,
triggerUuid uuid.UUID,
) (domain.TractRun, error)
ListRuns(ctx context.Context, tractUuid uuid.UUID, limit int32) ([]domain.TractRun, error)
GetRun(ctx context.Context, id uuid.UUID) (domain.TractRun, []domain.TractRunStep, error)
ListTractTools(ctx context.Context) ([]domain.McpToolRef, error)
ListTriggerSources(ctx context.Context) ([]domain.TriggerPreset, error)
}
TractService is the narrow slice of service.TractService the tract-authoring builtin tools need. Defined here — not imported from internal/service — so this package never depends on the top-level service interfaces package; internal/service/v1/mcp passes its concrete service.TractService value in per call, which satisfies this interface structurally.
type VaultExecutor ¶
type VaultExecutor struct{}
func NewVaultExecutor ¶
func NewVaultExecutor() *VaultExecutor
func (*VaultExecutor) Execute ¶
func (e *VaultExecutor) Execute( ctx context.Context, toolName string, client *couchdb.LiveSyncClient, bucket storage.BinaryStore, params map[string]interface{}, ) (domain.ToolExecResult, error)
Execute dispatches a vault tool call. client serves the markdown half of the vault (CouchDB livesync); bucket serves the non-markdown half (S3-compatible object storage) and may be nil if the vault has no linked bucket — handlers that need it then return user_errors.NoS3BucketLinked for non-markdown paths.