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

tools

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2026 License: Apache-2.0 Imports: 23 Imported by: 0

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

func FullSurface(cfg config.Config) config.Config

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

func RegisterResources(s *mcp.Server, d Deps)

RegisterResources adds the resource templates. Every one is a read, so every configuration has them.

func Surface

func Surface(cfg config.Config, granted []string) []service.Registered

Surface is what Register would register under a configuration, without building a server. The server instructions are written from it, and from what a flag would add to it.

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 four, because it decides the annotations, whether the tool is registered at all, the scope it needs and whether a client is asked to put a person in the loop, and four rules kept by hand at sixty call sites is four 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.

func (Kind) Scope

func (k Kind) Scope() scopes.Kind

Scope is the scopes package's view of the kind.

Jump to

Keyboard shortcuts

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