tools

package
v0.7.2 Latest Latest
Warning

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

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

Documentation

Overview

Package tools defines the MCP tools exposed by abs-mcp, split by the resource they act on (server.go, libraries.go, items.go, ...). Tools are named resource-first (library_*, item_*, me_*) so they group by what they act on.

Every tool is registered through add with a kind: read tools never change server state, write tools do (and are dropped under --read-only), and delete tools remove library records or files (and are only registered with --enable-delete). --toolsets and --allow-tools ask for tools, and --deny-tools takes tools out of what they asked for. Which tools a session gets from all that, and what each tells a client about itself, is go-kt's registry's work.

Index

Constants

This section is empty.

Variables

View Source
var AuditRules = map[string]string{
	// contains filtered or unexported fields
}

AuditRules are the audit rules a server can leave out (Options.AuditSkip), each with what it reports. The audits hold a library to one collector's way of keeping it, and every rule is on unless it is named: the ones here are that collector's taste, where the rest find mistakes.

View Source
var EssentialTools = []string{
	"library_list",
	"library_search",
	"library_items",
	"item_get",
	"user_in_progress",
	"user_progress_get",
	"user_progress_set",
}

EssentialTools is the curated preset selected by --allow-tools essential: enough to find things, read them, and keep listening progress in sync.

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

	"core": {
		"server_info", "library_list", "library_search", "library_items", "item_get",
	},

	"listening": {
		"user_get", "user_in_progress", "user_progress_get", "user_progress_set",
		"user_bookmarks", "user_bookmark_edit",
		"user_history", "user_history_remove", "user_stats", "item_send_ebook",
	},

	"curation": {
		"audit_all", "audit_missing", "audit_unmatched", "audit_issues", "audit_no_audio",
		"audit_podcasts", "audit_chapters", "audit_authors",
		"audit_path", "audit_covers",
		"audit_duplicates", "audit_series", "audit_spelling", "audit_narrators", "audit_genres", "audit_unembedded", "audit_matched", "audit_abridged", "audit_whitespace", "audit_unplayable", "metadata_rename",
		"item_edit", "item_match", "item_match_apply", "item_match_batch", "item_match_apply_batch", "item_match_tag", "item_compare_audio",
		"item_cover_search", "item_cover_edit", "item_cover_upgrade", "item_chapters_set",
		"author_list", "author_get", "author_edit", "author_match", "author_match_apply",
		"narrator_list", "series_list", "series_get", "series_edit", "series_merge",
		"library_get", "library_filters", "library_recent", "server_tags",
	},

	"podcasts": {
		"podcast_search", "podcast_add", "podcast_episodes", "podcast_episode_get",
		"podcast_episode_edit", "podcast_feed_episodes", "podcast_episode_download",
		"podcast_check_new", "podcast_downloads", "podcast_edit", "podcast_episode_delete",
	},

	"organise": {
		"collection_list", "collection_get", "collection_create", "collection_edit",
		"collection_delete",
		"playlist_list", "playlist_get", "playlist_create", "playlist_edit",
		"playlist_delete", "feed_list", "feed_edit",
	},

	"admin": {
		"server_sessions", "server_tasks", "server_backups", "server_backup_create",
		"library_create", "library_edit", "library_scan", "library_issues_remove", "library_issues_merge",
		"item_rescan", "item_embed_metadata", "item_delete", "author_delete", "user_list",
		"user_create", "user_edit",
	},
}

Toolsets group the tools by the job someone is doing, so a client can load a working subset instead of all of them. The whole surface is around 29,000 tokens of tool definitions (name, description, input schema) before anyone has asked a question; core alone is about 1,200.

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

--toolsets also takes a resource family - item, podcast, library, user, audit, author, series, narrator, collection, playlist, feed, server - 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 library or open an item on their own.

Functions

func FamilyNames added in v0.2.0

func FamilyNames() []string

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

func RegisterAll

func RegisterAll(server *mcp.Server, gen *abs.Client, 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 added in v0.2.0

func ToolsetNames() []string

ToolsetNames lists the curated toolsets, for help output.

Types

type Options

type Options struct {
	// ReadOnly registers only tools that never change server state.
	ReadOnly bool
	// EnableDelete registers the tools that delete library items, podcast
	// episodes and authors. Off unless the operator opts in.
	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.
	Toolsets []string
	// Allow asks for tools by name: exact names, prefix/suffix globs
	// (library_*, *_delete) or the "essential" preset. Beside Toolsets it
	// adds to them, "these sets and these tools as well"; on its own it is
	// only the tools it names. It lets nothing past ReadOnly or EnableDelete.
	Allow []string
	// Deny removes matching tools from whatever Toolsets and Allow asked for:
	// it is how a toolset is narrowed.
	Deny []string
	// ProviderTag is the prefix of the tag that records which store a match
	// came from, "zz-provider:" by default; "off" writes and reads none.
	ProviderTag string
	// Providers is the default order of metadata providers to ask when a call
	// names none: the store the books were bought from first, then the rest,
	// [audible.ca, audible]. Empty means the library's own provider alone.
	Providers []string
	// AuditSkip names the audit rules to leave out (see AuditRules). Every
	// rule is on by default; one that is a way of filing rather than a
	// mistake can be switched off for a library kept another way.
	AuditSkip []string
}

Options controls which tools are registered.

type ToolInfo added in v0.2.0

type ToolInfo = mcpregistry.Info

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

func Describe added in v0.2.0

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

Describe lists the tools opts would register, for `abs-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