Documentation
¶
Overview ¶
Package tools registers the MCP tools. A handler validates its input, calls the service and returns the model; register decides everything every tool shares — annotations, gating, decoding, errors, the two halves of the reply and the log line — once.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FullSurface ¶
FullSurface is the configuration under which every tool registers: the schema dump and the schema diff compare the whole registrable surface, so a gated tool is neither reported as new on every run nor lost without notice. It names every gate gate() consults, which TestFullSurfaceRegistersEverything holds.
func Register ¶
func Register(s *mcp.Server, d Deps) []service.Registered
Register adds every tool the configuration allows and returns what it registered, which it also tells the service, so get_me and resolve_url report the surface that exists.
func RegisterResources ¶
RegisterResources adds the resource templates. Every one is a read, so every configuration has them.
Types ¶
type Deps ¶
type Deps struct {
Service *service.Service
Config config.Config
// Granted are the token's scopes, empty when unknown. A tool whose kind
// needs a scope the token lacks is not registered: a read_api token
// never gets a write tool, whatever the flags say (§9.4).
Granted []string
Logger *slog.Logger
}
Deps are what the tools need.
type Kind ¶
type Kind int
Kind is what a tool does (docs/architecture.md §4.3). It is one field per tool rather than three, because it decides the annotations, whether the tool is registered at all and the scope it needs, and three rules kept by hand at sixty call sites is three ways to be quietly wrong at one of them (CLAUDE.md rule 14).
const ( // Read is every GET. Always registered. Read Kind = iota // Write changes something a person can edit back. Registered unless // read-only. Write // Ship is where a persuaded call becomes an effect: a merge, an // approval, a pipeline run. Registered only with // GITLAB_MCP_ENABLE_SHIP=true. Ship // Destructive deletes. Registered only with // GITLAB_MCP_ENABLE_DESTRUCTIVE=true, and refused per call without // confirm: true. Destructive )
The kinds.