feat: knowledge base tools (search, ask, write, spaces) - #147
Open
ar2rsawseen wants to merge 3 commits into
Open
feat: knowledge base tools (search, ask, write, spaces)#147ar2rsawseen wants to merge 3 commits into
ar2rsawseen wants to merge 3 commits into
Conversation
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>
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a
knowledge_basetool category (4 tools) backed by the server-side knowledge-base plugin, so any MCP client can search organizational documentation and record decisions from Markdown.knowledge_base_spacesGET /o/kb/spacesknowledge_base_searchGET /o/kb/rag-searchknowledge_base_askGET /o/kb/askknowledge_base_writePOST /i/kb/page-writeDetails
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 stableexternal_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 asjourneysandcontent. CRUD filtering works viaCOUNTLY_TOOLS_KNOWLEDGE_BASEas with every other category.Testing
tests/knowledge-base.test.ts(param passing, auth spreading, created-vs-updated reporting).tests/tools-config.test.ts(151 → 155 tools, 33 → 34 categories).npm run buildclean. 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.mddocuments this exact contract.🤖 Generated with Claude Code