apprtool

package
v1.164.0 Latest Latest
Warning

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

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

Documentation

Overview

Package apprtool is the manage_approval MCP tool (#2437, #2494): submitting a request, listing requests and deciding one are commands of one tool, over the service the portal's Approvals page uses.

Index

Constants

View Source
const (
	CmdSubmit = "submit"
	CmdList   = "list"
	CmdGet    = "get"
	CmdDecide = "decide"
)

The commands.

View Source
const ToolName = "manage_approval"

ToolName is the tool's name.

Variables

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

View Source
var Reads = []string{CmdList, CmdGet}

Reads is the commands that change nothing.

Functions

This section is empty.

Types

type CallHolder added in v1.161.0

type CallHolder interface {
	HeldRequest(ctx context.Context, held approval.HeldCall) (approval.CallRequest, error)
}

CallHolder asks a held call's policies again for the request submit files (callrun.Evaluator).

type Input

type Input struct {
	Command  string `json:"command"`
	Script   string `json:"script,omitempty"`
	Version  int    `json:"version,omitempty"`
	Purpose  string `json:"purpose,omitempty"`
	Reason   string `json:"reason,omitempty"`
	ID       string `json:"id,omitempty"`
	Decision string `json:"decision,omitempty"`
	Comment  string `json:"comment,omitempty"`
	Status   string `json:"status,omitempty"`
	Limit    int    `json:"limit,omitempty"`
	// Kind is submit's subject (a script version, or a held call) and
	// list's filter; Tool, Arguments and Calls are a held call's (#2437).
	Kind      string         `json:"kind,omitempty"`
	Tool      string         `json:"tool,omitempty"`
	Arguments map[string]any `json:"arguments,omitempty"`
	Calls     int            `json:"calls,omitempty"`
	// Until is decide's deadline for an allowance, in RFC 3339.
	Until string `json:"until,omitempty"`
}

Input is the tool's arguments.

type Tool

type Tool struct {
	Service *approval.Service
	// Calls asks a held call's policies again; nil refuses kind=call.
	Calls CallHolder
	// Persona resolves the persona a caller's roles resolve to, recorded on
	// a request; nil records none.
	Persona func(roles []string) 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_approval to the server.

Jump to

Keyboard shortcuts

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