feat(ingestion): implement brain_query MCP tool

Wraps the existing search.Query function. Same BM25 over
brain/knowledge/ and brain/wiki/ that the HTTP /query endpoint serves.
Plan note: handleCall switch replaces the single-line stub from Task 1
— no unknownToolError type to remove since Task 1 inlined the error.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Mathias Bergqvist
2026-05-01 09:56:40 +02:00
parent 63c8d114e8
commit 7dcb5610fe
3 changed files with 89 additions and 3 deletions

View File

@@ -113,7 +113,12 @@ func writeError(w http.ResponseWriter, id any, code int, msg string) {
})
}
// handleCall dispatches a tools/call. Stub for Task 1; expanded in later tasks.
// handleCall dispatches a tools/call to the appropriate tool handler.
func (s *Server) handleCall(ctx context.Context, name string, args json.RawMessage) (json.RawMessage, error) {
return nil, fmt.Errorf("unknown tool: %s", name)
switch name {
case "brain_query":
return s.brainQuery(ctx, args)
default:
return nil, fmt.Errorf("unknown tool: %s", name)
}
}