Documentation
¶
Overview ¶
Package toolmeta describes generated model-facing tools: the name, the family it belongs to, and the exact input schema bound to one action.
It deliberately depends on nothing but pkg/tools. The runner, the delegate preset resolver and every generated tool_gen.go import it, so any dependency on a domain package would close an import cycle. It lives in internal/core for exactly that reason; see internal/core/doc.go for the admission rule.
Index ¶
- func HandWritten(name string) bool
- func Match(selector string, tool ActionTool) bool
- func MatchAny(selectors []string, tool ActionTool) bool
- type ActionTool
- type Registry
- func (r *Registry) Action(name string) string
- func (r *Registry) Family(name string) string
- func (r *Registry) Lookup(name string) (ActionTool, bool)
- func (r *Registry) MatchAnyName(selectors []string, name string) bool
- func (r *Registry) MatchName(selector, name string) bool
- func (r *Registry) Names() []string
- func (r *Registry) SelectsNothing(selector string, names []string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandWritten ¶
HandWritten reports whether a tool name is an accepted exception to "every model-facing tool is generated". The list is closed: memory was the last union awaiting a split, so the pendingSplit map that held it is gone rather than kept empty — an empty second mechanism only invites a third entry.
func Match ¶
func Match(selector string, tool ActionTool) bool
Match reports whether a selector from a delegate preset's tools: list or from excluded_tools refers to this tool. A selector is either an exact tool name or a family name; family membership comes from the declaration, so a plugin named "goal_helper" is never swept in by the family "goal".
func MatchAny ¶
func MatchAny(selectors []string, tool ActionTool) bool
MatchAny reports whether any selector matches the tool.
Types ¶
type ActionTool ¶
type ActionTool struct {
// Name is the model-facing tool name, e.g. "recally_feed_add".
Name string
// Family groups tools that share a domain, e.g. "recally".
Family string
// Resource is the family's sub-resource, e.g. "feed". Empty when the
// family owns the action directly.
Resource string
// Action is the dispatch key inside the family, e.g. "feed_add".
Action string
// Description is the declared model-facing description. Operation-backed
// tools leave it empty and pass prose in from their hand-written adapter.
Description string
// InputSchemaJSON is the generated JSON Schema for this tool's arguments.
InputSchemaJSON string
}
ActionTool is one generated tool: an exact schema bound to one action. Family and Resource are carried, not inferred — a plugin free to call itself "goal_helper" must never be mistaken for a member of the goal family.
func (ActionTool) Definition ¶
func (a ActionTool) Definition(description string) tools.Definition
Definition builds the model-facing definition. description wins when non-empty: operation-backed tools keep their prose in the hand-written adapter next to the handler, declaration-backed tools carry it in the spec.
func (ActionTool) InputSchema ¶
func (a ActionTool) InputSchema() map[string]any
InputSchema decodes the generated schema. It panics on malformed JSON because the input is a compile-time constant produced by toolgen.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry is a lookup over the generated tools a build actually registered. Family answers from this metadata rather than by splitting a name on "_", which would misread every plugin and MCP tool that happens to contain one.
func NewRegistry ¶
func NewRegistry(all ...ActionTool) *Registry
NewRegistry indexes tools by name. A duplicate name is a build-time bug in toolgen's uniqueness check; last one wins here rather than panicking at startup.
func (*Registry) Action ¶
Action returns the action a registered tool performs, or "" for a name this registry does not know. A split tool carries its action in its name, so an observability attribute can read it here instead of from an argument that no longer exists.
func (*Registry) Family ¶
Family returns the family a registered tool belongs to, or "" when the name is not a generated tool (plugins, MCP, hand-written core tools).
func (*Registry) Lookup ¶
func (r *Registry) Lookup(name string) (ActionTool, bool)
Lookup returns the declaration for a tool name.
func (*Registry) MatchAnyName ¶
MatchAnyName reports whether any selector matches the named tool.
func (*Registry) MatchName ¶
MatchName is Match for a call site that only has a tool name: the runner's excluded_tools filter and the delegate preset whitelist both work off tools.Definition, which carries no family.
A name this registry does not know matches only itself, so a plugin called "goal_helper" is not swept up by the family selector "goal".