Help us shape the future of Go! Take the 2026 Go Developer Survey

prompt

package
v1.61.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 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" example:"date"`
	Description string `json:"description" example:"The date to analyze (YYYY-MM-DD)"`
	Required    bool   `json:"required" example:"true"`
}

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" example:"prompt_a1b2c3d4"`
	Name        string     `json:"name" example:"daily-sales-report"`
	DisplayName string     `json:"display_name" example:"Daily Sales Report"`
	Description string     `json:"description" example:"Generate a daily sales summary by region"`
	Content     string     `json:"content" example:"Analyze sales data for {date} grouped by region."`
	Arguments   []Argument `json:"arguments"`
	Category    string     `json:"category" example:"analysis"`
	Scope       string     `json:"scope" example:"persona"`
	Personas    []string   `json:"personas" example:"analyst,data-engineer"`
	OwnerEmail  string     `json:"owner_email" example:"admin@example.com"`
	Source      string     `json:"source" example:"database"`
	Enabled     bool       `json:"enabled" example:"true"`
	CreatedAt   time.Time  `json:"created_at" example:"2026-01-15T14:30:00Z"`
	UpdatedAt   time.Time  `json:"updated_at" example:"2026-01-15T14:30:00Z"`
}

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