Docs search tools
search_docs, ask_docs, and read_doc MCP tools plus memtrace://docs/* resources — query the Memtrace documentation from your coding agent without leaving the conversation.
Overview#
Memtrace exposes its documentation to coding agents through three MCP tools and a set of memtrace://docs/* resources. The tools call the same hosted backend that powers the Ask AI widget on memtrace.io/docs — semantic search over the full docs corpus, grounded answers with citations, and strict guardrails that keep responses on-topic.
Core code-graph tools remain fully offline. Docs tools degrade gracefully when the hosted API is unreachable — they return a clear error instead of blocking the rest of the MCP server.
Four agent skills route documentation questions to these tools: memtrace-docs (umbrella), memtrace-docs-ask, memtrace-docs-search, and memtrace-docs-read — installed with Agent skills.
Tools#
| Tool | Purpose |
|---|---|
search_docs | Semantic search — returns ranked doc chunks with slug, title, H2, and excerpt |
ask_docs | RAG Q&A — returns {answer, citations[], refused} grounded in docs only |
read_doc | Full plain-text content of a docs page by slug |
# In your agent conversation: search_docs(query="how do I set up fleet coordination", limit=5) # Returns ranked chunks like: # { ok: true, results: [{ slug: "features/fleet", pageTitle: "...", excerpt: "..." }] }
ask_docs(question="What ports does memtrace start use?") # Returns: # { ok: true, answer: "...", citations: ["cli/start"], refused: false }
read_doc(slug="getting-started") # Returns: # { ok: true, slug: "getting-started", title: "Getting started", body: "..." }
MCP resources#
The MCP server advertises every public docs page as a resource at memtrace://docs/<slug>. Agents that support MCP resources can browse the catalog via list_resources and read any page with read_resource — useful when you want the full page text without a tool round-trip.
Examples: memtrace://docs/getting-started, memtrace://docs/cli/start, memtrace://docs/mcp/overview.
Web Ask AI widget#
On memtrace.io/docs, a floating Ask AI button opens a chat panel powered by the same RAG backend. Answers stream in with markdown rendering (code blocks, diagrams) and inline citations back to source pages. The docs search overlay also includes semantic results and an Ask AI about this query shortcut.
No Memtrace install is required to use the web widget — it is available to every docs visitor.
Configuration#
Docs tools call the hosted API at https://memtrace.io by default. Override with:
MEMTRACE_DOCS_API_URL=https://memtrace.io
The hosted API endpoints are:
POST /api/docs-search— semantic searchPOST /api/docs-chat— RAG chat (streaming for web,stream: falsefor MCP)GET /api/docs/index— list all doc pages (for resource enumeration)GET /api/docs/<slug>— full page text
See also MCP server overview for transport and client setup.