MCPcopy Create free account
hub / github.com/diillson/chatcli / matchToolPattern

Function matchToolPattern

cli/hooks/manager.go:274–287  ·  view source on GitHub ↗

matchToolPattern checks if a tool name matches a glob-like pattern. Supports * as wildcard (e.g., "mcp_*", "@coder", "*").

(pattern, toolName string)

Source from the content-addressed store, hash-verified

272// matchToolPattern checks if a tool name matches a glob-like pattern.
273// Supports * as wildcard (e.g., "mcp_*", "@coder", "*").
274func matchToolPattern(pattern, toolName string) bool {
275 if pattern == "*" {
276 return true
277 }
278
279 // Simple prefix match for "prefix*" patterns
280 if strings.HasSuffix(pattern, "*") {
281 prefix := strings.TrimSuffix(pattern, "*")
282 return strings.HasPrefix(toolName, prefix)
283 }
284
285 // Exact match
286 return strings.EqualFold(pattern, toolName)
287}

Callers 2

TestMatchToolPatternFunction · 0.85
FireMethod · 0.85

Calls

no outgoing calls

Tested by 1

TestMatchToolPatternFunction · 0.68