You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(query): add symbolExists — exact-match boolean oracle for LLM grounding
Adds a new MCP tool and query engine method that answers "does this bare
symbol name exist in the index?" using a direct WHERE-clause query against
symbols_fts_content, bypassing FTS5 tokenisation entirely. This makes
class methods (saveReport, trackUsage) and object-property declarations
(setApiKey: t.procedure…) reliably findable by bare leaf name — the cases
that caused ~20–30% false-rejection rates in ArchReview's persona-swarm
validator when it used searchSymbols + client-side exact comparison.
Returns { exists, matches, kinds, receivers?, staleIndex? } — a cheap
boolean payload with no locations or ranking noise. Adds a note to the
searchSymbols description pointing callers to symbolExists for
authoritative lookups. Wire into all presets (core + review, refactor,
federation, docs, ops).
Acceptance criteria from the backlog spec all pass (11 tests).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: internal/mcp/tools.go
+30-1Lines changed: 30 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -107,7 +107,7 @@ func (s *MCPServer) GetToolDefinitions() []Tool {
107
107
},
108
108
{
109
109
Name: "searchSymbols",
110
-
Description: "Semantic code search returning symbol types, locations, and relationships—more accurate than text-based grep/find.",
110
+
Description: "Semantic code search returning symbol types, locations, and relationships—more accurate than text-based grep/find. Note: may not match class methods or record properties by bare name — use symbolExists for authoritative boolean lookups.",
111
111
InputSchema: map[string]interface{}{
112
112
"type": "object",
113
113
"properties": map[string]interface{}{
@@ -148,6 +148,34 @@ func (s *MCPServer) GetToolDefinitions() []Tool {
148
148
"required": []string{"query"},
149
149
},
150
150
},
151
+
{
152
+
Name: "symbolExists",
153
+
Description: "Boolean oracle for LLM grounding: answers whether a bare symbol name has any declaration in the index. Uses exact-match (not FTS ranking) so class methods and object-property declarations are found reliably. Returns exists, matches count, distinct kinds, and receiver names for methods/properties. Cheaper than searchSymbols — no locations, no ranking.",
154
+
InputSchema: map[string]interface{}{
155
+
"type": "object",
156
+
"properties": map[string]interface{}{
157
+
"name": map[string]interface{}{
158
+
"type": "string",
159
+
"description": "Bare symbol name to look up (e.g. \"saveReport\", \"ENV_PATH\")",
"description": "Optional file-path prefix to restrict search (e.g. \"packages/server/src/\")",
169
+
},
170
+
"includeExternal": map[string]interface{}{
171
+
"type": "boolean",
172
+
"default": false,
173
+
"description": "Include symbols from node_modules (default false)",
174
+
},
175
+
},
176
+
"required": []string{"name"},
177
+
},
178
+
},
151
179
{
152
180
Name: "listSymbols",
153
181
Description: "Bulk list symbols in a scope without search query. Returns functions, types, and classes with body ranges and complexity metrics (lines, endLine, cyclomatic, cognitive). Use for complete symbol inventory — no search query needed.",
@@ -2731,6 +2759,7 @@ func (s *MCPServer) RegisterTools() {
0 commit comments