Skip to content

feat: knowledge base tools (search, ask, write, spaces) - #147

Open
ar2rsawseen wants to merge 3 commits into
mainfrom
feat/knowledge-base-tools
Open

feat: knowledge base tools (search, ask, write, spaces)#147
ar2rsawseen wants to merge 3 commits into
mainfrom
feat/knowledge-base-tools

Conversation

@ar2rsawseen

Copy link
Copy Markdown
Member

What

Adds a knowledge_base tool category (4 tools) backed by the server-side knowledge-base plugin, so any MCP client can search organizational documentation and record decisions from Markdown.

Tool Endpoint CRUD
knowledge_base_spaces GET /o/kb/spaces R
knowledge_base_search GET /o/kb/rag-search R
knowledge_base_ask GET /o/kb/ask R
knowledge_base_write POST /i/kb/page-write C

Details

  • knowledge_base_spaces — lists spaces the token's user can read; the discovery step for the other tools.
  • knowledge_base_search — semantic search returning ranked doc sections with deep-link citations (title, heading, url, snippet, score). Results are permission-scoped server-side to spaces the user may read.
  • knowledge_base_ask — question answering with cited sources: LLM-synthesized when the Countly server has an LLM configured (mode: llm), otherwise top passages verbatim (mode: extractive).
  • knowledge_base_write — writes a page from Markdown. A stable external_ref (feature id / branch / ticket) makes repeated calls an idempotent upsert of the same page — the intended flow for AI agents documenting decisions while they work.

Plugin gating

The category is registered with requiresPlugin: 'knowledge-base' / availableByDefault: false, so the tools are hidden on servers without the plugin — same mechanism as journeys and content. CRUD filtering works via COUNTLY_TOOLS_KNOWLEDGE_BASE as with every other category.

Testing

  • 12 new unit tests in tests/knowledge-base.test.ts (param passing, auth spreading, created-vs-updated reporting).
  • Updated category/count assertions in tests/tools-config.test.ts (151 → 155 tools, 33 → 34 categories).
  • Full suite: 891 passed, 9 skipped. npm run build clean. New files lint clean (existing repo lint errors untouched).

Docs

README tool list + counts and TOOLS_CONFIGURATION.md (plugin requirement + usage examples) updated.

Server-side counterpart: the knowledge-base plugin's docs/MCP_INTEGRATION.md documents this exact contract.

🤖 Generated with Claude Code

Adds a knowledge_base tool category backed by the server-side
knowledge-base plugin:

- knowledge_base_spaces — list readable spaces (id discovery)
- knowledge_base_search — semantic search via /o/kb/rag-search with
  deep-link citations, permission-scoped to the auth token
- knowledge_base_ask — cited answer via /o/kb/ask (LLM-synthesized when
  the server has an LLM configured, extractive otherwise)
- knowledge_base_write — create/update pages from Markdown via
  /i/kb/page-write; a stable external_ref makes repeated calls an
  idempotent upsert (for agents logging decisions per feature/ticket)

The category requires the knowledge-base plugin and is hidden when the
plugin is not installed, following the same gating as journeys/content.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 23, 2026 08:04

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

ar2rsawseen and others added 2 commits July 23, 2026 11:04
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…o build

Search and ask are removed from this PR. Retrieval across every knowledge
source — documentation, support tickets, work sessions — is being moved into a
neutral Countly `build` plugin so that no domain plugin depends on another for
search, and it will be exposed here as build_recall / build_ask against
/o/build/*.

What stays is genuinely knowledge-base-specific: discovering spaces and
authoring pages from Markdown (idempotent via external_ref).

153 tools / 34 categories; suite 881 passing, build clean.

Co-Authored-By: Claude Opus 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.

2 participants