Documentation
¶
Overview ¶
Package naming turns operations into MCP tool names, IDs and descriptions (SPEC §3.5 rules 1 and 2). It is pure and deterministic: the same input always yields the same names, whatever order it arrives in.
Index ¶
- Constants
- func Assign(cands []Candidate, prefix string) map[model.OpKey]string
- func BaseName(operationID, method, path string) string
- func CleanText(s string, maxRunes int) string
- func Describe(summary, description, method, path string, maxRunes int) string
- func Hidden(s string) string
- func Sanitize(s string) string
- func ToolID(key model.OpKey) string
- type Candidate
Constants ¶
const DefaultMaxDescription = 1024
DefaultMaxDescription caps tool descriptions, in runes.
const MaxNameLen = 64
MaxNameLen is the longest MCP tool name PlugIt produces.
Variables ¶
This section is empty.
Functions ¶
func Assign ¶
Assign names every candidate: optional prefix, sanitize, truncate to MaxNameLen, then dedupe case-insensitively with _2, _3, ... suffixes (truncating the base so the suffix fits). Candidates are processed in sorted OpKey order, so results don't depend on input order. Duplicate keys are named once.
func BaseName ¶
BaseName is the unprefixed, sanitized name for an operation: its operationId, or "{method}_{path}" with braces removed.
func CleanText ¶
CleanText applies Describe's cleaning to arbitrary spec text (parameter and schema descriptions, titles, warnings) and caps it at maxRunes (DefaultMaxDescription when maxRunes <= 0). It may return "".
func Describe ¶
Describe picks a tool description: summary, then description, then "METHOD /path". Text is cleaned (HTML and markdown links stripped, control, bidi and other invisible format characters removed, whitespace collapsed) and capped at maxRunes (DefaultMaxDescription when maxRunes <= 0).
func Hidden ¶
Hidden says what cleaning would silently remove from s that a reader never sees but a model might act on: invisible or bidi format characters, control characters (other than line breaks and tabs) or an HTML comment. It returns "" when there is nothing of the sort.