prompt

package
v1.51.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package prompt provides prompt management for the MCP data platform. It defines the Store interface for prompt persistence and the Prompt type that represents a user-managed MCP prompt.

Index

Constants

View Source
const (
	ScopeGlobal   = "global"
	ScopePersona  = "persona"
	ScopePersonal = "personal"
)

Scope constants define prompt visibility levels.

View Source
const (
	SourceOperator = "operator"
	SourceAgent    = "agent"
	SourceSystem   = "system"
)

Source constants define prompt origins.

Variables

This section is empty.

Functions

func ValidateName

func ValidateName(name string) error

ValidateName checks that a prompt name is well-formed.

func ValidateScope

func ValidateScope(scope string) error

ValidateScope checks that a scope value is allowed for database-stored prompts.

Types

type Argument

type Argument struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Required    bool   `json:"required"`
}

Argument describes a prompt argument.

type ListFilter

type ListFilter struct {
	Scope      string   // "global", "persona", "personal", or "" for all
	Personas   []string // filter by persona membership (OR match)
	OwnerEmail string   // filter by owner
	Enabled    *bool    // filter by enabled state
	Search     string   // free-text search on name, display_name, description
}

ListFilter controls which prompts are returned by List.

type Prompt

type Prompt struct {
	ID          string     `json:"id"`
	Name        string     `json:"name"`
	DisplayName string     `json:"display_name"`
	Description string     `json:"description"`
	Content     string     `json:"content"`
	Arguments   []Argument `json:"arguments"`
	Category    string     `json:"category"`
	Scope       string     `json:"scope"`
	Personas    []string   `json:"personas"`
	OwnerEmail  string     `json:"owner_email"`
	Source      string     `json:"source"`
	Enabled     bool       `json:"enabled"`
	CreatedAt   time.Time  `json:"created_at"`
	UpdatedAt   time.Time  `json:"updated_at"`
}

Prompt represents a user-managed MCP prompt.

type Store

type Store interface {
	// Create persists a new prompt.
	Create(ctx context.Context, p *Prompt) error

	// Get retrieves a prompt by name. Returns nil, nil if not found.
	Get(ctx context.Context, name string) (*Prompt, error)

	// GetByID retrieves a prompt by ID. Returns nil, nil if not found.
	GetByID(ctx context.Context, id string) (*Prompt, error)

	// Update modifies an existing prompt.
	Update(ctx context.Context, p *Prompt) error

	// Delete removes a prompt by name.
	Delete(ctx context.Context, name string) error

	// DeleteByID removes a prompt by ID.
	DeleteByID(ctx context.Context, id string) error

	// List returns prompts matching the filter.
	List(ctx context.Context, filter ListFilter) ([]Prompt, error)

	// Count returns the number of prompts matching the filter.
	Count(ctx context.Context, filter ListFilter) (int, error)
}

Store defines the interface for prompt persistence.

Directories

Path Synopsis
Package postgres provides PostgreSQL storage for prompts.
Package postgres provides PostgreSQL storage for prompts.

Jump to

Keyboard shortcuts

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