Documentation
¶
Overview ¶
Package toolset is what an agent can do with the application's connections, whatever carries the call.
The MCP server offers these tools to an agent outside the window, and the window's own assistant will offer the same ones to a model it calls itself. Neither re-implements an operation. Each adapts these to its caller - how a call arrives, how far it may go, who is asked before anything is destroyed - and everything about the operation itself, from the capability check to the words an answer is given in, is decided here once.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Arguments ¶
func Arguments(input any) json.RawMessage
Arguments is what a write was called with, as an audit log keeps it.
Types ¶
type Caller ¶
type Caller struct {
// Confirms is whether the caller can put a question to a person before a
// destructive call. A tool it cannot use is not one to point it at.
Confirms bool
}
Caller is who a call comes from, as far as a tool's answer depends on it.
type Confirmable ¶
type Confirmable interface{ Destination() model.DestinationRef }
Confirmable is the input of a tool a person confirms. It names the destination that would be destroyed, which is what the question is about.
type Env ¶
type Env struct {
Services *app.Services
// Translate resolves the i18n keys the capability model carries into the
// language the application is set to. Injected because the translations
// live with the renderer's, and only the composition root can reach them.
Translate func(string) string
// Open resolves the connection a call names. Nil uses only the connections
// this process already holds, which is what the window needs: a dial from
// there records no status, and queues the user's own connects behind it.
// The MCP server dials what its own process has not opened yet.
Open func(id int) (driver.Conn, error)
// Allow is how far calls may go on a connection. Nil is read only.
Allow func(id int) catalog.Blast
// Offered names the tool that performs each catalogue operation, among the
// tools the transport registered.
Offered map[string]string
}
Env is what the tools run against: the application's services, and the choices a transport makes about the connections a call names.
func (*Env) ChangedSince ¶
func (e *Env) ChangedSince(id int, agreed model.ConnectionProfile) error
ChangedSince refuses a write whose connection was pointed elsewhere after the person agreed to it: what they agreed to is the broker they were shown.
func (*Env) Consequence ¶
Consequence is what a write would leave behind on the connection it names, as the connection declares it, for a person approving it to read. A write that could not be made there at all is refused here instead, before anybody is asked about it.
func (*Env) Question ¶
func (e *Env) Question(ctx context.Context, tool Tool, input any) (string, model.ConnectionProfile, error)
* Question is what a destructive call puts to a person, and the connection as * it stands while they read it - what ChangedSince holds the write to once * they have answered. Whatever would be refused anyway is refused here * instead: there is no point in a question whose yes leads nowhere.
type Targeted ¶
type Targeted interface{ Target() int }
Targeted is an input that names the connection it acts on. Every write's is one, so a write is checked and recorded against the connection it reaches.
type Tool ¶
type Tool struct {
// Name is what a caller calls it by.
Name string
// Title is a short name for a person reading a list of them.
Title string
Description string
// Operation is the catalogue operation it performs. The two tools about
// the installation itself reach no driver, and have none.
Operation string
// Blast is how much one call can do. It comes from the catalogue: two
// descriptions of the damage a call can do would eventually disagree.
Blast catalog.Blast
InputSchema *jsonschema.Schema
OutputSchema *jsonschema.Schema
// contains filtered or unexported fields
}
Tool is one operation as an agent is offered it.
func (Tool) Check ¶
func (t Tool) Check(arguments json.RawMessage) (any, error)
* Check reads arguments as a model sent them into the tool's input: defaults * applied, then the whole value validated, the way the MCP SDK checks them * before a handler there sees a call. Every input schema is closed, so a * property the input does not declare is refused rather than decoded into * nothing. * * It is separate from running so a caller can look at what a write would do, * and ask a person about it, before anything is done.
type Withholding ¶
type Withholding interface{ Logged() any }
Withholding is an input carrying content an audit log does not copy. What Logged returns is kept in its place.