sitetool

package
v1.158.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package sitetool is the manage_site MCP tool (#2518): a site's record, its environments, publishing a release, promoting and rolling back, mapping hostnames and the migration crawl, over the one service.

Index

Constants

View Source
const (
	CmdCreate       = "create"
	CmdGet          = "get"
	CmdList         = "list"
	CmdUpdate       = "update"
	CmdDelete       = "delete"
	CmdEnvironment  = "set_environment"
	CmdPublish      = "publish"
	CmdPromote      = "promote"
	CmdRollback     = "rollback"
	CmdReleases     = "releases"
	CmdDeployments  = "deployments"
	CmdAddDomain    = "add_domain"
	CmdRemoveDomain = "remove_domain"
	CmdDomains      = "domains"
	CmdCrawl        = "crawl"
	CmdGrant        = "grant"
	CmdRevoke       = "revoke"
)

The commands.

View Source
const ToolName = "manage_site"

ToolName is the tool's name.

Variables

Commands is every command, in the order the schema lists them.

Reads is the commands that change nothing.

Functions

This section is empty.

Types

type Content added in v1.157.0

type Content struct {
	Service *sitesvc.Service
	// ToolAllowed reports whether a persona holds manage_site: a change to a
	// site through manage_asset must not reach further than manage_site does.
	ToolAllowed func(persona string) bool
}

Content answers manage_asset's content actions for a site reference (#2588), through the same service manage_site uses.

func (*Content) Handle added in v1.157.0

Handle runs one content action.

type Crawler

type Crawler interface {
	Crawl(ctx context.Context, req sitecrawl.Request) (*sitecrawl.Result, error)
}

Crawler copies a site into a release's files.

type File

type File struct {
	Path string `json:"path"`
	// Content is a pointer so an entry with none can be told from an empty
	// file: a forgotten content must not blank a page.
	Content *string `json:"content,omitempty"`
	// Encoding is utf-8 (default) or base64.
	Encoding string `json:"encoding,omitempty"`
	// Delete removes the path from the base.
	Delete bool `json:"delete,omitempty"`
}

File is one file handed to publish.

type Input

type Input struct {
	Command     string `json:"command"`
	Site        string `json:"site,omitempty"`
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
	OwnerEmail  string `json:"owner_email,omitempty"`
	// InternalView, Public and Main are pointers so false can be told from
	// unset.
	InternalView *bool `json:"internal_view,omitempty"`
	Public       *bool `json:"public,omitempty"`
	Main         *bool `json:"main,omitempty"`
	// MainEnvironment moves the main address on update; "" gives it to none.
	MainEnvironment *string  `json:"main_environment,omitempty"`
	Email           string   `json:"email,omitempty"`
	Persona         string   `json:"persona,omitempty"`
	Environments    []string `json:"environments,omitempty"`
	Level           string   `json:"level,omitempty"`
	Environment     string   `json:"environment,omitempty"`
	// RequiresApproval is a pointer so false can be told from unset.
	RequiresApproval *bool  `json:"requires_approval,omitempty"`
	From             string `json:"from,omitempty"`
	To               string `json:"to,omitempty"`
	Release          int    `json:"release,omitempty"`
	// Base makes the files an overlay on that release.
	Base   int    `json:"base,omitempty"`
	Note   string `json:"note,omitempty"`
	Reason string `json:"reason,omitempty"`
	Files  []File `json:"files,omitempty"`
	// Archive is a zip or gzipped tar managed resource, by id or URI.
	Archive string `json:"archive,omitempty"`
	// Folder is a managed-resource folder, in the library Scope and ScopeID
	// name.
	Folder      string            `json:"folder,omitempty"`
	Scope       string            `json:"scope,omitempty"`
	ScopeID     string            `json:"scope_id,omitempty"`
	Hostname    string            `json:"hostname,omitempty"`
	Application string            `json:"application,omitempty"`
	URL         string            `json:"url,omitempty"`
	FormMap     map[string]string `json:"form_map,omitempty"`
}

Input is the tool's arguments.

type Sources

type Sources interface {
	Archive(ctx context.Context, ref string) ([]sitesvc.InputFile, error)
	Folder(ctx context.Context, scope, scopeID, path string) ([]sitesvc.InputFile, error)
}

Sources reads the files a publish names by reference.

type Tool

type Tool struct {
	Service   *sitesvc.Service
	Sources   Sources
	Crawler   Crawler
	PortalURL string
}

Tool is the registered tool.

func (*Tool) Handle

func (t *Tool) Handle(ctx context.Context, in Input) (*mcp.CallToolResult, any, error)

Handle runs one command.

func (*Tool) Register

func (t *Tool) Register(server *mcp.Server)

Register adds manage_site to the server.

Jump to

Keyboard shortcuts

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