tools

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: GPL-3.0 Imports: 31 Imported by: 0

Documentation

Overview

Package tools defines the MCP tools exposed by technitium-mcp, split by the resource they act on (server.go, zones.go, ...). Tools are named resource-first (server_*, zone_*, record_*, audit_*) so they group by what they act on.

Every tool is about one or more of the configured servers, named by its server argument: a read asks every server unless one is named and sets the answers side by side, and a change is made on one named server at a time.

Every tool is registered through add with a kind: read tools never change a server, write tools do and are only registered with --enable-write, and delete tools remove what cannot be put back and are only registered with --enable-delete as well. A session reads until it is told it may do more: these are DNS servers, and a wrong change takes a network's names away. --toolsets picks the groups a session needs, --allow-tools adds tools to them by name, and --deny-tools takes tools away.

Index

Constants

This section is empty.

Variables

View Source
var EssentialTools = []string{
	"server_info",
	"zone_list",
	"zone_records",
}

EssentialTools is the curated preset selected by --allow-tools essential: enough to see what the servers are and read what they hold.

View Source
var ToolsetOrder = []string{mcpregistry.Core, "audit", "ops", "block", "dhcp", "edit", "dnssec", "cluster", "admin", "apps"}

ToolsetOrder is the order a listing shows the sets in: the base first.

View Source
var Toolsets = map[string][]string{

	mcpregistry.Core: {
		"server_info", "zone_list", "zone_records", "record_find", "dns_resolve", "cache_get",

		"audit_names",
	},

	"audit": {
		"audit_all", "audit_servers", "audit_targets", "audit_reverse", "audit_overlaps", "audit_naming", "audit_state", "audit_dhcp", "audit_blocking", "audit_zones", "audit_security", "audit_split", "audit_cluster", "audit_access", "audit_dnssec", "audit_queries", "audit_apps",
	},

	"ops": {
		"server_settings", "server_stats", "log_search", "zone_get", "zone_export", "server_metrics", "settings_get", "log_files", "log_read", "log_export",

		"settings_set", "tsig_key_set", "tsig_key_delete", "settings_backup", "settings_restore", "stats_delete", "log_delete",
	},

	"block": {
		"block_check", "block_list", "block_set", "block_delete", "block_switch", "block_lists_set", "block_tree", "block_import", "block_flush",
	},

	"dhcp": {
		"dhcp_scopes", "dhcp_leases", "dhcp_reservation_set", "dhcp_reservation_delete", "dhcp_lease_delete", "dhcp_scope_set", "dhcp_lease_reserve", "dhcp_scope_delete",
	},

	"edit": {
		"record_set", "record_delete", "record_repoint", "cache_flush", "zone_create", "zone_edit", "zone_resync", "zone_clone", "zone_convert", "zone_import", "zone_delete", "dns_import",
	},

	"dnssec": {
		"dnssec_get", "dnssec_sign", "dnssec_unsign", "dnssec_edit", "dnssec_key_add", "dnssec_key_edit", "dnssec_key_delete",
	},

	"cluster": {
		"cluster_get", "cluster_create", "cluster_join", "cluster_edit", "cluster_promote", "cluster_node_delete", "cluster_leave", "cluster_delete",
	},

	"admin": {
		"user_list", "user_get", "user_set", "user_delete", "group_list", "group_set", "group_delete", "session_list", "session_delete", "token_create", "access_get", "access_set", "sso_get", "sso_set", "account_get", "account_edit",
	},

	"apps": {
		"app_list", "app_config_get", "app_install", "app_config_set", "app_delete",
	},
}

Toolsets group the tools by the job someone is doing, so a client can load a working subset instead of all of them: every tool's definition (name, description, input schema) is spent from a client's context before anyone has asked a question.

"all" is every tool, which is what the library does when no toolset is asked for; the technitium-mcp binary defaults to core instead (see cli.FlagData.ToolOptions).

--toolsets also takes a resource family - zone, record, dhcp, user, app and so on - which is every tool with that prefix. Those are derived from the registered names rather than listed here, so they cannot go stale.

Every tool belongs to exactly one set (TestToolsetsPartition proves it), and core is added to whatever else is asked for, because none of the other sets can find a zone or read a record on their own.

Functions

func FamilyNames

func FamilyNames() []string

FamilyNames lists the resource prefixes accepted by --toolsets, for help output.

func RegisterAll

func RegisterAll(server *mcp.Server, set *servers.Set, opts Options) ([]string, error)

RegisterAll adds every tool permitted by opts to the MCP server and returns the names registered. It fails when an allow/deny pattern matches no tool, so a typo cannot silently hide one.

func ToolsetNames

func ToolsetNames() []string

ToolsetNames lists the curated toolsets, for help output.

Types

type Options

type Options struct {
	// EnableWrite registers the tools that change a server. Off unless the
	// operator opts in: with nothing said, a session can only read.
	EnableWrite bool
	// EnableDelete registers the tools that delete. A delete is a change, so
	// it needs EnableWrite too, and is refused without it rather than
	// quietly registering nothing.
	EnableDelete bool
	// Toolsets, when set, restricts registration to the named groups (see
	// Toolsets). "core" is always included, so a set can be asked for on its
	// own. Allow adds to them and Deny takes away.
	Toolsets []string
	// Allow names tools to register: exact names, prefix/suffix globs
	// (zone_*, *_delete) or the "essential" preset. Beside Toolsets it adds
	// those tools to the sets, wherever they belong: the sets plus these.
	// With no Toolsets it is the whole choice, and only the tools it names
	// are registered, core not among them unless named. A name or pattern
	// that matches no tool is refused rather than registering nothing.
	Allow []string
	// Deny removes matching tools from whatever the two above chose: it is
	// how a set is narrowed.
	Deny []string
}

Options controls which tools are registered.

type ToolInfo

type ToolInfo = mcpregistry.Info

ToolInfo describes a registered tool without a server to register it on.

func Describe

func Describe(opts Options) ([]ToolInfo, error)

Describe lists the tools opts would register, for `technitium-mcp tools`. It needs no connectivity, and makes the same choice RegisterAll does.

Jump to

Keyboard shortcuts

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