Skip to content

feat(mcp): tool annotations + completions support - #3

Merged
EtanHey merged 1 commit into
mainfrom
feat/mcp-spec-modernize
Feb 19, 2026
Merged

EtanHey merged 1 commit into
mainfrom
feat/mcp-spec-modernize

Conversation

@EtanHey

@EtanHey EtanHey commented Feb 19, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Add ToolAnnotations to all 8 tools — readOnlyHint=true, idempotentHint=true (all tools are read-only search/analyze)
  • Add human-readable title to all tools for better UI display
  • Add completion handler for project, content_type, source, and intent arguments
  • Project completions pull normalized names from the DB dynamically

Test plan

  • python3 -c "from brainlayer.mcp import server" imports without error
  • MCP inspector shows annotations on tools
  • Completions return project names when typing in project field

🤖 Generated with Claude Code


Note

Low Risk
Low risk: changes are limited to MCP tool metadata and a new completion handler, with no writes or core search logic modifications.

Overview
Adds ToolAnnotations to all BrainLayer MCP tools (read-only, idempotent, non-destructive) and provides human-friendly title fields for improved client/UI display.

Introduces an @server.completion() handler that returns argument suggestions for project (derived from DB stats with normalization + prefix filtering) and for content_type, source, and intent (static lists).

Written by Cursor Bugbot for commit a449651. This will update automatically on new commits. Configure here.

- Add ToolAnnotations to all 8 tools (readOnlyHint, idempotentHint)
- Add human-readable titles to all tools
- Add completion handler for project, content_type, source, intent args
- Projects completion uses normalized names from DB
- Requires mcp>=1.26.0 (already installed)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@EtanHey
EtanHey force-pushed the feat/mcp-spec-modernize branch from bf3c0c8 to a449651 Compare February 19, 2026 18:41
@EtanHey
EtanHey merged commit 934355b into main Feb 19, 2026
3 of 4 checks passed
@EtanHey
EtanHey deleted the feat/mcp-spec-modernize branch February 19, 2026 20:22
EtanHey added a commit that referenced this pull request Feb 25, 2026
Add 5 knowledge graph tables to BrainLayer's sqlite DB:
- kg_entities: core entity storage (person, company, meeting, topic, project, golem, skill)
- kg_relations: explicit relationships between entities with confidence scoring
- kg_entity_chunks: bridge table linking entities to existing 270K chunks
- kg_vec_entities: sqlite-vec virtual table for semantic entity search (1024 dims)
- kg_entities_fts: FTS5 full-text search on entity names/metadata with sync triggers

Also adds:
- source_project_id column on chunks table (critical issue #3 from plan)
- KG CRUD methods on VectorStore (upsert_entity, add_relation, link_entity_chunk,
  search_entities, search_entities_semantic, kg_stats, etc.)
- Fix brain_search youtube bug: skip project auto-scope for non-claude_code sources
  (youtube, whatsapp, telegram) since those chunks have null/different project values

40 new tests covering schema creation, CRUD, FTS5 triggers, vector search,
idempotency, and source filter routing. 299 total tests pass.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
EtanHey added a commit that referenced this pull request Feb 25, 2026
* feat: Phase 1 — KG schema, entity CRUD, and youtube source filter fix

Add 5 knowledge graph tables to BrainLayer's sqlite DB:
- kg_entities: core entity storage (person, company, meeting, topic, project, golem, skill)
- kg_relations: explicit relationships between entities with confidence scoring
- kg_entity_chunks: bridge table linking entities to existing 270K chunks
- kg_vec_entities: sqlite-vec virtual table for semantic entity search (1024 dims)
- kg_entities_fts: FTS5 full-text search on entity names/metadata with sync triggers

Also adds:
- source_project_id column on chunks table (critical issue #3 from plan)
- KG CRUD methods on VectorStore (upsert_entity, add_relation, link_entity_chunk,
  search_entities, search_entities_semantic, kg_stats, etc.)
- Fix brain_search youtube bug: skip project auto-scope for non-claude_code sources
  (youtube, whatsapp, telegram) since those chunks have null/different project values

40 new tests covering schema creation, CRUD, FTS5 triggers, vector search,
idempotency, and source filter routing. 299 total tests pass.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* style: format KG schema code with ruff

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: address CodeRabbit review — stale IDs, FK refs, over-fetch, tests

- upsert_entity: return actual stored ID on conflict (not caller's ID)
- add_relation: same stale-ID fix
- search_entities_semantic: over-fetch with entity_type filter (vec0
  applies k before WHERE, so filtered results could be fewer than limit)
- Remove dead REFERENCES clauses from kg_relations and kg_entity_chunks
  (SQLite FK enforcement is off by default, not worth enabling)
- Test: assert original ID preserved on upsert conflict
- Test: fix FTS trigger test — use unique terms to avoid OR match overlap

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
cursor Bot pushed a commit that referenced this pull request Apr 30, 2026
Fixes:
- Removed merge conflict marker from BUGBOT_REVIEW_FTS_RECALL.md
- Added critical bug warning to exact chunk-ID bypass section

Final Status Report:
- 3 critical issues confirmed by Cursor Bugbot (independent verification)
- Issue #1 (P0): Cross-project data leakage via exact bypass
- Issue #2 (P2): Recall regression from phrase matching
- Issue #3 (P0): Trigram-only results bypass filters

Verdict: MERGE BLOCKED until critical issues fixed

Credit: Issues independently confirmed by Cursor's own Bugbot system
with actionable fix links provided

Co-authored-by: Etan Heyman <EtanHey@users.noreply.github.com>
EtanHey added a commit that referenced this pull request Apr 30, 2026
* fix: improve FTS recall across exact IDs and aliases

* docs: add Bugbot review for FTS recall hardening

- Comprehensive review of retrieval correctness across 3 layers
- Write safety analysis for schema migrations
- MCP stability verification
- Performance observations (storage +1.8GB, query latency)
- Edge case analysis and recommendations
- Approve with confidence for merge

Co-authored-by: Etan Heyman <EtanHey@users.noreply.github.com>

* fix: default exact chunk lookup project label

* fix: preserve search routing and trigram repair semantics

* docs: update Bugbot review - fix markdown issues and add re-review addendum

Fixes:
- Corrected chunk-id regex false positive examples (whitespace issue)
- Fixed markdown heading spacing (MD022, MD031 compliance)
- Added blank lines around headings and code blocks

Re-review addendum (commit bcddd14):
- Reviewed 6 additional fixes since initial review
- All fixes approved: KG error handling, trigram repair, lifecycle filtering, sender/language filters
- Critical correctness fixes: exact bypass lifecycle + FTS filter completeness
- Updated verdict: APPROVED with increased confidence
- Production-ready, ship with confidence

Co-authored-by: Etan Heyman <EtanHey@users.noreply.github.com>

* docs: add Bugbot re-review summary

Co-authored-by: Etan Heyman <EtanHey@users.noreply.github.com>

* fix: satisfy lint and review follow-ups

* docs: Bugbot critical issues - 3 bugs must be fixed before merge

Critical Issues Identified:
1. P0: Trigram-only results bypass post-RRF filters (search_repo.py:1141)
2. P1: Exact chunk-ID bypass ignores project/filter scope (search_handler.py:389)
3. P2: Alias expansion breaks FTS token-level semantics (search_handler.py:131)

All three issues represent real correctness bugs:
- Cross-project data leakage via exact bypass
- Filter contract violations for trigram hits
- Potential recall regression on multi-word queries

Verdict: APPROVE WITH MANDATORY FIXES
Fixes are straightforward (5-15 min each), must be completed before merge

Credit: Issues identified by Macroscope and Codex reviews

Co-authored-by: Etan Heyman <EtanHey@users.noreply.github.com>

* fix: harden scoped exact-id and alias expansion search

* docs: fix merge conflict and add final Bugbot status report

Fixes:
- Removed merge conflict marker from BUGBOT_REVIEW_FTS_RECALL.md
- Added critical bug warning to exact chunk-ID bypass section

Final Status Report:
- 3 critical issues confirmed by Cursor Bugbot (independent verification)
- Issue #1 (P0): Cross-project data leakage via exact bypass
- Issue #2 (P2): Recall regression from phrase matching
- Issue #3 (P0): Trigram-only results bypass filters

Verdict: MERGE BLOCKED until critical issues fixed

Credit: Issues independently confirmed by Cursor's own Bugbot system
with actionable fix links provided

Co-authored-by: Etan Heyman <EtanHey@users.noreply.github.com>

* style: format alias expansion regression test

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Etan Heyman <EtanHey@users.noreply.github.com>
EtanHey added a commit that referenced this pull request Jun 20, 2026
…n3.14 (#528)

On a Homebrew clone with no repo checkout, HybridSearchHelperClient.resolvePythonExecutable
fell through to the bare python3/python on PATH (e.g. python3.14) which lacks the
brainlayer module -> ModuleNotFoundError 'No module named brainlayer' at hybrid-helper
warmup ('notReady'). Probe the formula venv (<prefix>/opt/brainlayer/libexec/venv/bin/python,
from HOMEBREW_PREFIX then /opt/homebrew and /usr/local) BEFORE the bare-python fallback.

Fixes M1-clone friction #7b. Same class as the hook bug #3.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
EtanHey added a commit that referenced this pull request Nov 19, 2026
…min to go" and a real "stops shrinking"

BrainLayer #1827 (release 1.6.6) writes `catch_up` in watcher-health.json: state (none, behind, catching_up, stalled),
bytes_behind and, while the lag is at a new low over its window, eta_s; `offset_lag` is then not an alert reason, and it
comes back (state stalled) when the lag stops shrinking.

- Decoded part by part (WatcherCatchUp): the block absent is an older producer; a part missing or of another type is
  unknown and left out, and never makes the whole file unreadable. The live capture carries it.
- The lag line (CHANGES-R1.11 A2, approved words #3): "{size} left to read. It's catching up by itself, about {N min} to
  go." when eta_s is known; the size from bytes_behind, else max_offset_lag_bytes.
- "Stops shrinking" is BrainLayer's own measure: while catch_up.state is catching_up the lag is L55's calm notice (no
  count, no notification), a red reader included; when offset_lag comes back (stalled) it is A3, "Reading new
  conversations isn't catching up", a notice under R20/R31's 30-minute clock (never R02's "catching up") and "needs you",
  with the report, past it or with the reader red; the reader stopped needs him. L55's one-alert approximation stays for
  a producer without catch_up. The escalation is still decided only in appEscalationCauses (the R31 guard, unchanged).
- The window's Read station and its panel take the same facts, words and severity: the station says "catching up"
  while it drains and "{size} behind" once it stopped (never "not being read" for a reader that reads), and the stalled
  item carries A3's "An agent needs to look at this."
- Fixtures: lag-behind is the 1.6.6 shape (catching up, about 25 min); lag-stalled is new.

Tests: BrainBarNewDesignR113Tests (each state; decoding with each part missing; the window); the invariant oracle's own
conditions for A2 and A3, and the enumeration reaches both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant