MCPcopy Create free account
hub / github.com/Chat2AnyLLM/code-agent-manager / matchPredicate

Function matchPredicate

internal/metadata/store.go:174–189  ·  view source on GitHub ↗

matchPredicate builds the WHERE clause (without the leading "WHERE") for a search, optionally narrowed by kind. Pass the raw kind string ("" = any kind).

(kind string)

Source from the content-addressed store, hash-verified

172// matchPredicate builds the WHERE clause (without the leading "WHERE") for a
173// search, optionally narrowed by kind. Pass the raw kind string ("" = any kind).
174func matchPredicate(kind string) string {
175 pred := "(name LIKE ? OR description LIKE ? OR repo_owner LIKE ? OR repo_name LIKE ? OR install_key LIKE ?)"
176 lead := ""
177 if kind != "" {
178 lead = "kind = ? AND "
179 }
180 // A subagent is a markdown file beneath an `agents/` folder. Rows whose
181 // in-repo path has no `agents` segment (commands/, docs/, README, …) are
182 // not subagents and must never appear on the SubAgents page. This mirrors
183 // DiscoverResources' underAgentsFolder at query time, so index entries left
184 // by an older binary (before that filter existed) can't leak through.
185 if kind == "agent" {
186 lead += "(item_path LIKE 'agents/%' OR item_path LIKE '%/agents/%') AND "
187 }
188 return lead + pred
189}
190
191// Search queries the metadata_items table with LIKE matching. Results are
192// deduplicated by name (case-insensitive): when the same name exists in

Callers 2

SearchMethod · 0.85
CountMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected