rag-debug-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| RAG_TABLE | Yes | The table containing the knowledge vectors to inspect. Must match /^[a-zA-Z_][a-zA-Z0-9_]*$/ (identifier whitelist validation), e.g. t_knowledge_vector. | |
| DATABASE_URL | Yes | PostgreSQL / PgVector connection URL, e.g. postgres://postgres:<your-password>@127.0.0.1:5432/xwagent. All tools run their queries in read-only transactions against this database. | |
| EMBEDDING_MODEL | No | Embedding model name, e.g. text-embedding-v4. | |
| EMBEDDING_API_KEY | No | API key for the embedding endpoint. If not set, the server automatically switches to deterministic_fallback mode to generate normalized vectors for offline structural diagnosis and EXPLAIN index validation. | |
| EMBEDDING_API_URL | No | Embedding API endpoint used to embed queries, e.g. https://dashscope.aliyuncs.com/compatible-mode/v1/embeddings. | |
| EMBEDDING_DIMENSIONS | No | Embedding vector dimensions, e.g. 1536. | |
| RAG_MAX_SNIPPET_CHARS | No | Maximum characters of long text snippets returned in context windows; longer text is truncated (original length metadata is preserved). Default is 280. | 280 |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server publishes no instructions, or was last inspected before Glama recorded them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| inspect_retrievalA | 只读排查 PostgreSQL/PgVector 企业级 RAG 检索链路:对比单路向量检索分数与关键词/FTS 分数、展示 RRF 融合排名及多租户 Pre-filtering 结果和耗时,定位漏召回或排序偏低问题。 |
| view_chunk_contextB | 根据 chunk_id 只读查看同一文档版本号内前后相邻窗口切片,并自动诊断 Markdown 表格跨块劈断、段落截断或标题层级缺失等切片边界问题。 |
| explain_vector_queryA | 在只读事务中对带 Pre-filtering 条件的向量检索 SQL 执行 EXPLAIN ANALYZE(FORMAT JSON),解析是否命中 HNSW 索引、过滤淘汰行数与缓存块命中,给出针对性索引调优建议。 |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 3 tools
Each tool targets a clearly distinct concern: retrieval scoring/fusion diagnostics, chunk-boundary context inspection, and SQL query-plan analysis. An agent can easily choose between them based on whether the problem is recall/ranking, chunking, or index performance.
All three names follow a consistent snake_case verb_object pattern (inspect_retrieval, view_chunk_context, explain_vector_query). No convention mixing or vague verbs.
Three tools is on the lean side but each covers a distinct, necessary step in a focused read-only RAG debugging workflow. The scope is narrow enough that this is reasonable rather than padding.
The core debugging loop is covered: diagnose retrieval scores, inspect chunk boundaries, and analyze the query plan. Minor gaps exist (e.g., no way to list documents or discover chunk_ids without another tool), but agents can work around these via inspect_retrieval output.