toolNameMatchesPattern
toolNameMatchesPattern(
name,pattern):boolean
Defined in: _worktrees/docs-release/gaunt-sloth/packages/core/src/utils/toolMatching.ts:26
Match a single tool name against a single pattern.
- A pattern with no
*is an exact match (name === pattern), preserving the original exact-name allow-list behavior. - A pattern containing
*is treated glob-style: each*matches any run of characters (including none) and every other character is matched literally. The whole name must match — the pattern is anchored at both ends.
Regex metacharacters in the literal segments are escaped, so a . or + in a pattern
matches that character literally, never as a regex class.
Parameters
Section titled “Parameters”string
pattern
Section titled “pattern”string
Returns
Section titled “Returns”boolean
Examples
Section titled “Examples”toolNameMatchesPattern('mcp__unimarket__buy', 'mcp__unimarket__*') // truetoolNameMatchesPattern('read_file', '*_file') // truetoolNameMatchesPattern('abcde', 'a*c*e') // truetoolNameMatchesPattern('read_file', 'gh_pr') // false