Skip to main content
Glama

MCP-RAG

✨100% written by AI

A service-oriented RAG service for AI clients, currently focused on FastAPI HTTP services and Streamable HTTP MCP endpoints.

The code currently provides a unified backend shell:

  • FastAPI HTTP service

  • Streamable HTTP MCP

  • Shared runtime, configuration hot-reloading, authentication, rate limiting, quotas, and observability

  • Retrieval and document management based on a knowledge base registry

Current Capabilities

  • Document Import: Supports direct text addition, as well as uploading txt, md, pdf, docx

  • Retrieval: Hybrid search (vector retrieval + keyword retrieval)

  • Q&A: /search, /chat, MCP rag_ask

  • Multi-Knowledge Base: Supports single knowledge base and kb_ids multi-knowledge base aggregated retrieval/dialogue

  • Knowledge Base Scope: public and agent_private

  • Tenant Context: base_collection + user_id + agent_id

  • Runtime Governance: API key, memory rate limiting, upload/indexing quotas, request-level retrieval cache

  • Provider Governance: Provider budget, circuit breaking, fallback

  • Observability: /health, /ready, /metrics

  • Frontend: Built-in single-page management panel /app

Related MCP server: FastGPT Knowledge Base MCP

Architecture

Main link:

HTTP / MCP
  -> app_factory.py
  -> http_server.py / mcp_server.py
  -> context.py
  -> service_facade.py
  -> services/
       - runtime.py
       - indexing_service.py
       - retrieval_service.py
       - chat_service.py
  -> knowledge_bases.py
  -> core/indexing/
  -> retrieval/

Key files:

  • src/mcp_rag/cli.py: CLI entry point, provides serve and init

  • src/mcp_rag/main.py: HTTP service startup entry point

  • src/mcp_rag/http_server.py: HTTP API, SPA entry point, Streamable HTTP MCP mounting

  • src/mcp_rag/mcp_server.py: MCP tool definition and rag_ask

  • src/mcp_rag/app_factory.py: Unified assembly of app context, runtime, and guardrails

  • src/mcp_rag/knowledge_bases.py: Knowledge base registry and default knowledge base resolution

  • src/mcp_rag/config.py: Configuration model, JSON/SQLite persistence, hot-reloading

Environment Requirements

  • Python >= 3.13

  • uv

Installation

Install CLI:

uv tool install mcp-rag

Run directly after installation:

mcp-rag serve

Develop in the repository:

uv sync

If local embedding is required:

uv sync --extra local-embeddings

Boundary Notes:

  • Users installing via uv tool install mcp-rag do not need Node.js or pnpm

  • pnpm is only used for maintaining frontend builds and is not a service runtime dependency

Startup and Initialization

Start the service:

uv run mcp-rag serve

Initialize data directory:

uv run mcp-rag init --data-dir ./data

The default port is 8060, and the service listens on 0.0.0.0:8060 by default.

Common entry points:

  • Management Panel: http://127.0.0.1:8060/app

  • API Documentation: http://127.0.0.1:8060/docs

  • MCP Endpoint: http://127.0.0.1:8060/mcp

Compatible entry points:

  • / redirects to /app

  • /doc redirects to /docs

  • /documents-page redirects to /app/documents

  • /config-page redirects to /app/config

First-time startup behavior:

  • If ./data/config.json does not exist, default values are used when reading the configuration

  • The service calls ensure_config_file() on startup to write the default configuration to disk

  • ./data/chroma and related SQLite files in the data directory are created on demand

Frontend and Static Assets

The release package bundles src/mcp_rag/static/ into the wheel / sdist.

This means:

  • Users running uv tool install mcp-rag can access /app directly

  • No separate frontend build or Node.js is required

  • Frontend maintainers need to generate the latest static assets before releasing

Frontend source code is in frontend/, and build output goes to src/mcp_rag/static/app.

Typical workflow:

cd frontend
pnpm install
pnpm build

Knowledge Base Model

The current project no longer relies solely on raw collection to organize data, but instead uses a knowledge base registry.

Knowledge base features:

  • Persistent registry in the SQLite file pointed to by knowledge_base_db_path

  • Ensures a public knowledge base exists by default

  • Ensures the corresponding default agent_private knowledge base exists when user_id + agent_id is passed

  • Assigns stable internal collection names after creating a new knowledge base, e.g., kb_<id>

The interface layer still retains the collection parameter for compatibility with old calling methods. The current actual behavior is:

  • You can explicitly pass kb_id

  • You can continue to pass the old collection

  • The service resolves the request to a specific knowledge base and actual collection name

HTTP Interface

System interfaces:

  • GET /health

  • GET /ready

  • GET /metrics

Configuration interfaces:

  • GET /config

  • POST /config

  • POST /config/bulk

  • POST /config/reset

  • POST /config/reload

Provider interfaces:

  • GET /providers/{provider}/models

Knowledge base interfaces:

  • GET /collections

  • GET /knowledge-bases

  • POST /knowledge-bases

Document interfaces:

  • POST /add-document

  • POST /upload-files

  • GET /list-documents

  • DELETE /delete-document

  • GET /list-files

  • DELETE /delete-file

Retrieval and Q&A:

  • GET /search

  • POST /chat

MCP debugging interfaces:

  • GET /debug/mcp/tools

  • POST /debug/mcp/call

Points to clarify:

  • /search and /chat support kb_id

  • /search and /chat also support kb_ids for multi-knowledge base aggregation

  • /upload-files uses multipart/form-data

  • /delete-document and /delete-file pass deletion parameters via the request body

If security policies are enabled, the API key can be passed in the following ways:

  • HTTP Header: x-api-key

  • Header: Authorization: Bearer <token>

  • api_key in query parameters, JSON body, or form

MCP

The current primary form is Streamable HTTP MCP:

{
  "mcpServers": {
    "rag": {
      "url": "http://127.0.0.1:8060/mcp"
    }
  }
}

Implemented MCP tools:

  • rag_ask

rag_ask main parameters:

  • query

  • mode: raw or summary

  • collection

  • kb_id

  • scope

  • limit

  • threshold

  • tenant

  • user_id / agent_id

  • _user_id / _agent_id

  • api_key

  • request_id

  • trace_id

Example:

{
  "name": "rag_ask",
  "arguments": {
    "query": "FastAPI 是什么",
    "kb_id": 1,
    "mode": "summary",
    "limit": 5
  }
}

Configuration

Default configuration file:

./data/config.json

Default knowledge base database:

./data/knowledge_bases.sqlite3

There is an important change in the current configuration:

  • General runtime configuration is saved in config.json

  • Provider-related configuration is persisted to SQLite instead of being fully written back to config.json

That is to say, these fields are stored in service_provider_settings in SQLite:

  • embedding_provider

  • embedding_fallback_provider

  • provider_configs

  • llm_provider

  • llm_fallback_provider

  • llm_model

  • llm_base_url

  • llm_api_key

Other configurations are still saved in config.json, for example:

{
  "http_port": 8060,
  "chroma_persist_directory": "./data/chroma",
  "knowledge_base_db_path": "./data/knowledge_bases.sqlite3",
  "enable_llm_summary": false,
  "security": {
    "enabled": false,
    "allow_anonymous": true,
    "api_keys": [],
    "tenant_api_keys": {}
  },
  "rate_limit": {
    "requests_per_window": 120,
    "window_seconds": 60,
    "burst": 30
  },
  "quotas": {
    "max_upload_files": 20,
    "max_upload_bytes": 52428800,
    "max_upload_file_bytes": 10485760,
    "max_index_documents": 500,
    "max_index_chunks": 2000,
    "max_index_chars": 500000
  },
  "cache": {
    "enabled": false,
    "max_entries": 256,
    "ttl_seconds": 300
  },
  "provider_budget": {
    "enabled": true
  }
}

Current built-in provider capabilities:

  • Embedding provider default value is zhipu

  • LLM provider default value is doubao

  • Built-in provider configurations include doubao, zhipu, aliyun

  • qwen / dashscope are normalized to aliyun

  • /providers/{provider}/models supports pulling model lists from OpenAI-compatible model services

  • Local embedding supports m3e-small and e5-small

  • LLM additionally supports ollama

Hot-Reloading and Runtime Refresh

Hot-reloading behavior:

  • After modification via /config, /config/bulk, /config/reset, /config/reload, the runtime refreshes immediately

  • When a request enters, it detects whether the disk configuration has changed via reload_if_changed()

  • After provider settings or retrieval configurations change, related runtime dependencies are rebuilt and the retrieval cache is cleared

Readiness and Metrics

  • /health returns a health summary, runtime snapshot, and config_revision

  • /ready returns 503 if bootstrap is incomplete or critical dependencies are not ready

  • /metrics returns observational metrics aggregated by operation / provider

The current readiness snapshot includes:

  • document_processor

  • embedding_model

  • vector_store

  • hybrid_service

  • llm_model

  • retrieval_cache

  • provider_budget

Testing

Run full tests:

uv run python -m unittest discover -s tests

Compilation check:

uv run python -m compileall src

Current test coverage:

  • Configuration defaults, disk reloading, and provider configuration migration

  • HTTP shell and MCP shell behavior

  • Request context / tenant resolution

  • Request-level retrieval cache

  • Provider budget / fallback

  • Readiness / health / metrics

  • Packaging metadata and static assets

License

MIT

Available Tools

10 tools
ask_ragA

向 RAG 知识库提问,并根据存储的信息返回答案。 使用场景:

  • 询问特定主题或概念

  • 请求解释或定义

  • 从处理过的文档中获取信息

  • 基于学习的文本或文档获取答案

参数: query: 要向知识库提出的问题或查询。

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.5/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. While it states the tool queries a RAG knowledge base and returns answers, it doesn't describe important behavioral aspects like: what types of answers are returned (structured/unstructured), whether there are rate limits, authentication requirements, response formats, or error conditions. For a query tool with no annotation coverage, this leaves significant gaps in understanding how the tool behaves.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with a clear purpose statement followed by usage scenarios and parameter documentation. It's appropriately sized for a single-parameter tool. The only minor inefficiency is the repetition of similar concepts in the usage scenarios (e.g., '询问特定主题或概念' and '请求解释或定义' could potentially be combined).

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given that there's an output schema (which handles return values), the description doesn't need to explain outputs. However, for a query tool with no annotations, the description should provide more behavioral context about how the tool operates, what it expects from the knowledge base, and potential limitations. The usage scenarios help, but more operational transparency would improve completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description explicitly documents the single parameter: 'query: 要向知识库提出的问题或查询' (query: the question or query to ask the knowledge base). With 0% schema description coverage and only one parameter, this provides complete parameter semantics beyond what the bare schema offers. The description fully compensates for the lack of schema documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: '向 RAG 知识库提问,并根据存储的信息返回答案' (Ask the RAG knowledge base questions and return answers based on stored information). This specifies the verb (ask/query) and resource (RAG knowledge base). However, it doesn't explicitly differentiate from its sibling 'ask_rag_filtered', which appears to be a similar querying tool with filtering capabilities.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides four clear usage scenarios (asking about topics/concepts, requesting explanations/definitions, getting information from processed documents, obtaining answers based on learned text/documents). This gives good context about when to use the tool. However, it doesn't explicitly state when NOT to use it or mention alternatives like 'ask_rag_filtered' despite having that sibling tool available.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

ask_rag_filteredA

向 RAG 知识库提问,并使用特定过滤器聚焦搜索。 使用场景:

  • 仅搜索 PDF 文档:file_type=".pdf"

  • 查找包含表格的文档:min_tables=1

  • 查找结构良好的文档:min_titles=5

  • 搜索增强处理的文档:processing_method="unstructured_enhanced"

参数: query: 要向知识库提出的问题或查询。 file_type: 按文件类型过滤(例如 ".pdf", ".docx", ".txt")。 min_tables: 文档必须包含的最小表格数量。 min_titles: 文档必须包含的最小标题数量。 processing_method: 按处理方法过滤(例如 "unstructured_enhanced", "markitdown")。

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYes
file_typeNo
min_tablesNo
min_titlesNo
processing_methodNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.5/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It describes the tool's filtering behavior well with specific examples, but doesn't mention other behavioral aspects like response format, error handling, rate limits, or authentication requirements. The description adds value by explaining filtering logic but lacks comprehensive behavioral disclosure.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured and appropriately sized. It starts with a clear purpose statement, provides usage scenarios with bullet points, then lists parameters with explanations. Every sentence earns its place, and there's no redundant information. The bilingual nature (Chinese with English examples) is efficient for the intended context.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (5 parameters, filtering logic) and the presence of an output schema (which handles return values), the description is mostly complete. It explains the purpose, usage, and parameters thoroughly. The main gap is lack of behavioral context beyond filtering (e.g., performance characteristics, limitations), but the output schema reduces the need to describe return values.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description fully compensates by providing detailed parameter explanations. Each parameter is clearly explained with examples: 'query: 要向知识库提出的问题或查询' (the question or query to ask the knowledge base), 'file_type: 按文件类型过滤(例如 ".pdf", ".docx", ".txt")' (filter by file type, e.g., ".pdf", ".docx", ".txt"), etc. The description adds significant meaning beyond the bare schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: '向 RAG 知识库提问,并使用特定过滤器聚焦搜索' (Ask the RAG knowledge base and use specific filters to focus the search). It specifies the verb ('提问' - ask/query) and resource ('RAG 知识库' - RAG knowledge base), and distinguishes it from the sibling 'ask_rag' by explicitly mentioning filtering capabilities.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit usage scenarios with concrete examples: '仅搜索 PDF 文档:file_type=".pdf"', '查找包含表格的文档:min_tables=1', etc. It clearly indicates when to use this tool (for filtered searches) versus the sibling 'ask_rag' (presumably for unfiltered queries), making the distinction clear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

clear_embedding_cache_toolA

清除嵌入缓存以释放内存和磁盘空间。 使用场景:

  • 在系统内存不足时释放内存

  • 在更改嵌入模型后重置缓存

  • 清除不再需要的旧缓存嵌入

  • 排查与缓存相关的问题

返回: 有关缓存清理操作的确认消息。

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.7/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It clearly states this is a destructive operation that clears cache to free resources, and mentions it returns a confirmation message. However, it doesn't specify potential side effects like performance impact during clearing or whether this requires special permissions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is efficiently structured with a clear purpose statement followed by specific usage scenarios in bullet points and a brief note about return values. Every sentence earns its place without redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given this is a simple, parameterless tool with an output schema (confirmed by context signals), the description provides complete context: clear purpose, specific usage guidelines, behavioral information about the destructive nature, and mention of return confirmation. No additional information is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters with 100% schema description coverage, so the baseline is 4. The description appropriately doesn't discuss parameters since none exist, focusing instead on usage scenarios and behavioral context.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('清除嵌入缓存' - clear embedding cache) and the purpose ('以释放内存和磁盘空间' - to free memory and disk space). It distinguishes this tool from sibling tools like 'get_embedding_cache_stats' (which reads cache stats) and 'optimize_vector_database' (which optimizes rather than clears).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit usage scenarios in a bulleted list: when system memory is low, after changing embedding models, to remove old/unneeded cache embeddings, and for troubleshooting cache-related issues. This gives clear guidance on when to use this tool versus alternatives like 'get_embedding_cache_stats' for inspection only.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_embedding_cache_statsA

获取有关嵌入缓存性能的详细统计信息。 使用场景:

  • 检查缓存命中率以查看系统是否高效工作

  • 监控缓存的内存使用情况

  • 了解嵌入的重用频率

  • 调试性能问题

返回: 有关嵌入缓存性能的详细统计信息。

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It clearly indicates this is a read-only operation (获取/获取) and describes what kind of information will be returned. However, it doesn't mention potential limitations like whether this requires specific permissions, if there are rate limits, or how frequently the statistics are updated. The description adds useful context about the types of metrics available but doesn't fully cover behavioral aspects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with a clear purpose statement followed by specific usage scenarios and a brief return statement. Each sentence earns its place by providing distinct value. It could be slightly more concise by combining the purpose and return statements, but overall it's efficiently organized.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given that the tool has 0 parameters, an output schema exists, and the description provides clear purpose and usage guidance, this is reasonably complete. The description doesn't need to explain return values since an output schema exists, and it adequately covers when and why to use this tool. The main gap is the lack of behavioral details that would be helpful for a monitoring tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters with 100% schema description coverage, so the baseline would be 3. However, the description explicitly states '使用场景' (usage scenarios) that help the agent understand when to invoke this parameterless tool, adding meaningful context beyond the empty schema. This elevates the score above baseline.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose as '获取有关嵌入缓存性能的详细统计信息' (get detailed statistics about embedding cache performance), which is a specific verb+resource combination. It distinguishes itself from siblings like 'get_knowledge_base_stats' and 'get_vector_database_stats' by focusing specifically on cache performance. However, it doesn't explicitly contrast with 'clear_embedding_cache_tool' beyond the obvious read vs. write difference.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit usage scenarios in a bulleted list: checking cache hit rates, monitoring memory usage, understanding reuse frequency, and debugging performance issues. These give clear guidance on when to use this tool versus alternatives like 'get_vector_database_stats' for broader system monitoring or 'clear_embedding_cache_tool' for cache management.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_knowledge_base_statsA

获取有关知识库的综合统计信息,包括文档类型、处理方法和结构信息。 使用场景:

  • 检查知识库中有多少文档

  • 了解文件类型的分布

  • 查看使用了哪些处理方法

  • 分析存储文档的结构复杂性

返回: 有关知识库内容的详细统计信息。

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It discloses that the tool returns 'detailed statistical information' and implies read-only behavior by focusing on analysis. However, it lacks details on potential side effects (e.g., if it triggers background processing), performance characteristics (e.g., latency for large knowledge bases), or error conditions. The description adds some context but doesn't fully cover behavioral traits beyond basic functionality.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with a purpose statement, usage scenarios in bullet points, and an output note. Each sentence earns its place by clarifying different aspects (what it does, when to use it, what it returns). It could be slightly more concise by integrating the output note into the purpose, but overall it's efficient and front-loaded with key information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (0 parameters) and the presence of an output schema, the description is reasonably complete. It covers purpose, usage, and output at a high level, which is sufficient for a stats-retrieval tool. However, without annotations, it could benefit from more behavioral details (e.g., idempotency, rate limits), but the output schema likely handles return values, reducing the need for extensive description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description correctly omits parameter details, focusing instead on usage and output. This aligns with the baseline of 4 for zero parameters, as it avoids redundancy and adds value through context rather than repeating schema information.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: '获取有关知识库的综合统计信息' (Get comprehensive statistics about the knowledge base). It specifies the types of statistics (document types, processing methods, structural information) and distinguishes itself from siblings like 'get_embedding_cache_stats' or 'get_vector_database_stats' by focusing on knowledge base content rather than caching or database metrics. However, it doesn't explicitly contrast with all siblings (e.g., 'ask_rag' is for querying, not statistics).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit usage scenarios in a bulleted list: checking document count, understanding file type distribution, viewing processing methods, and analyzing structural complexity. This clearly indicates when to use this tool—for statistical analysis of knowledge base content—and implicitly distinguishes it from alternatives like querying tools ('ask_rag') or maintenance tools ('reindex_vector_database'). No exclusions are stated, but the context is well-defined.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_vector_database_statsB

获取向量数据库的详细统计信息。 使用场景:

  • 检查数据库状态

  • 分析文档分布

  • 诊断性能问题

  • 规划优化

返回: 向量数据库的详细统计信息。

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. While it mentions the tool returns detailed statistics, it doesn't specify whether this is a read-only operation, what permissions might be required, potential rate limits, or how the statistics are formatted. For a tool with zero annotation coverage, this leaves significant behavioral gaps unaddressed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections: purpose statement, usage scenarios, and return information. It's appropriately sized for a zero-parameter tool. The only minor issue is some redundancy between the purpose statement and return section, but overall it's efficient and front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given that the tool has an output schema (which handles return value documentation) and zero parameters, the description provides adequate context about purpose and usage scenarios. However, with no annotations and multiple sibling statistics tools, it could benefit from more differentiation and behavioral details to be fully complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters with 100% schema description coverage (empty schema). The description doesn't need to explain any parameters, which is appropriate. It correctly focuses on what the tool does rather than parameter details, earning a high score for this dimension.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool '获取向量数据库的详细统计信息' (gets detailed statistics of the vector database), which is a clear verb+resource combination. However, it doesn't differentiate from sibling tools like 'get_knowledge_base_stats' or 'get_embedding_cache_stats', leaving ambiguity about what distinguishes these statistics tools. The purpose is understandable but lacks sibling differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description includes a '使用场景' (usage scenarios) section listing four specific contexts: checking database status, analyzing document distribution, diagnosing performance issues, and planning optimization. This provides clear guidance on when to use the tool. However, it doesn't explicitly state when NOT to use it or mention alternatives among siblings, which prevents a perfect score.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

learn_documentA

使用高级非结构化处理技术(包含真正的语义分块)读取和处理文档文件,并将其添加到知识库。 当您想通过智能处理文档文件来训练人工智能时,可以使用此功能。

支持的文件类型:PDF、DOCX、PPTX、XLSX、TXT、HTML、CSV、JSON、XML、ODT、ODP、ODS、RTF、 图像(PNG、JPG、TIFF、带 OCR 的 BMP)、电子邮件(EML、MSG)以及超过 25 种格式。

高级功能:

  • 基于文档结构(标题、章节、列表)的 REAL 语义分块

  • 智能文档结构保存(标题、列表、表格)

  • 自动去噪(页眉、页脚、无关内容)

  • 结构化元数据提取

  • 适用于任何文档类型的强大回退系统

  • 通过语义边界增强上下文保存

使用示例:

  • 处理布局复杂的研究论文或文章

  • 从包含表格和列表的报告或手册中添加内容

  • 从带格式的电子表格导入数据

  • 将演示文稿转换为可搜索的知识

  • 使用 OCR 处理扫描文档

文档将通过 REAL 语义分块进行智能处理,并与增强的元数据一起存储。

将保存处理后文档的副本以供验证。

参数: file_path:要处理的文档文件的绝对路径或相对路径。

ParametersJSON Schema
NameRequiredDescriptionDefault
file_pathYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Describes advanced processing steps: REAL semantic chunking, structure preservation, denoising, metadata extraction, fallback system, and saving a copy for verification. No annotations, so description carries full burden; it discloses key behaviors without contradicting any annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Description is somewhat long but well-structured with bullet points for supported types, features, and examples. Front-loaded with purpose; each section adds value without redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Covers input, processing behavior, and outcome (stored in knowledge base with metadata, copy saved). Output schema exists, so return values not needed. Could mention idempotency but overall complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Single parameter file_path is explained as 'absolute or relative path' in the description, adding meaning beyond the schema's type string. Schema coverage is 0%, so description compensates well.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states the tool reads and processes document files using advanced semantic chunking and adds to knowledge base. Distinguishes from sibling learn_text by specifying document file types and advanced features.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides context on when to use (train AI on document files) and lists specific use cases. Does not explicitly exclude alternatives, but implied by focus on structured documents.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

learn_textA

向 RAG 知识库添加一段新文本以供将来参考。 使用场景:

  • 添加事实、定义或解释

  • 存储对话中的重要信息

  • 保存研究发现或笔记

  • 添加特定主题的上下文

参数: text: 要学习并存储在知识库中的文本内容。 source_name: 来源的描述性名称(例如 "user_notes", "research_paper", "conversation_summary")。

ParametersJSON Schema
NameRequiredDescriptionDefault
textYes
source_nameNomanual_input

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. While it mentions the tool adds text to a knowledge base for future reference, it lacks critical details such as whether this operation is idempotent, what permissions are required, how the text is processed (e.g., embedding generation), or potential side effects like storage limits. This is a significant gap for a mutation tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured and front-loaded with the core purpose, followed by usage scenarios and parameter explanations. Every sentence adds value without redundancy, and it efficiently conveys necessary information in a compact format, making it easy for an agent to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (mutation with 2 parameters), no annotations, and an output schema (which reduces the need to describe return values), the description is moderately complete. It covers purpose, usage, and parameters but lacks behavioral details like error handling or processing behavior. This is adequate but has clear gaps for a tool that modifies a knowledge base.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds meaningful context for both parameters beyond the input schema, which has 0% description coverage. It explains that 'text' is the content to learn and store, and 'source_name' is a descriptive name for the source with examples like 'user_notes' or 'research_paper'. This compensates well for the schema's lack of descriptions, though it could provide more detail on format constraints.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verb ('添加'/'add') and resource ('RAG 知识库'/'RAG knowledge base'), and distinguishes it from siblings like ask_rag (querying) and clear_embedding_cache_tool (maintenance). It explicitly defines the action as adding new text for future reference, making the purpose unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear usage scenarios (e.g., adding facts, storing conversation info, saving research notes), which helps the agent understand when to use this tool. However, it does not explicitly state when NOT to use it or mention alternatives like ask_rag for retrieval, leaving room for improvement in distinguishing from sibling tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

optimize_vector_databaseA

优化向量数据库以提高搜索性能。 使用场景:

  • 搜索速度变慢

  • 添加了许多新文档

  • 希望提高系统的整体性能

返回: 有关优化过程的信息。

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.5/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. While it mentions the tool optimizes for performance, it doesn't describe what the optimization actually does (reindexing? compression? cache management?), whether it requires downtime, how long it takes, what permissions are needed, or potential risks. The return statement is vague ('有关优化过程的信息' - information about the optimization process).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately concise with a clear purpose statement followed by bulleted usage scenarios and a return statement. Each section earns its place, though the return statement could be more specific. The structure is logical and front-loaded with the main purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given that the tool has no parameters, an output schema exists, and annotations are absent, the description provides adequate basic information about purpose and usage scenarios. However, for a performance optimization tool that likely involves significant system changes, the description lacks important behavioral details about what the optimization entails, its impact, and safety considerations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters with 100% schema description coverage, so the schema already fully documents the parameter situation. The description appropriately doesn't discuss parameters since none exist, earning a baseline 4 for not creating confusion about non-existent parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose as '优化向量数据库以提高搜索性能' (optimize vector database to improve search performance), which is a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'reindex_vector_database' or 'clear_embedding_cache_tool', which might serve related performance purposes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides three clear usage scenarios (slow search, many new documents added, wanting overall performance improvement), giving good context about when to use this tool. However, it doesn't specify when NOT to use it or mention alternatives among the sibling tools, which would be needed for a perfect score.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

reindex_vector_databaseA

使用优化配置重新索引向量数据库。 使用场景:

  • 更改配置文件

  • 搜索速度非常慢

  • 希望针对特定数据库大小进行优化

  • 存在持续的性能问题

参数: profile: 配置文件('small', 'medium', 'large', 'auto')。 'auto' 会自动检测最佳配置文件

返回: 有关重新索引过程的信息。

ParametersJSON Schema
NameRequiredDescriptionDefault
profileNoauto

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.1/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden. It indicates this is a reindexing operation (implies mutation/write), mentions performance optimization, and describes the 'auto' profile option. However, it doesn't disclose important behavioral aspects like whether this operation is destructive, requires downtime, has rate limits, or specific permission requirements for a database mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured and appropriately sized. It begins with the core purpose, then provides usage scenarios in bullet points, followed by parameter details, and finally return information. Every section adds value with no redundant information. The Chinese text is concise and clear.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given this is a database mutation tool with no annotations but with an output schema, the description does well. It explains the purpose, when to use it, parameter details, and mentions what the return contains. The output schema existence means the description doesn't need to detail return values. However, for a potentially destructive database operation, more behavioral context would be helpful.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds significant value beyond the schema. The input schema has 0% description coverage and only shows 'profile' as a string parameter. The description explains the parameter meaning ('配置文件' - configuration file), lists the four possible values ('small', 'medium', 'large', 'auto'), and explains what 'auto' does ('会自动检测最佳配置文件' - automatically detects the best configuration file). This fully compensates for the poor schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: '使用优化配置重新索引向量数据库' (Reindex vector database using optimized configuration). It specifies the verb ('重新索引' - reindex) and resource ('向量数据库' - vector database). However, it doesn't explicitly differentiate from sibling tools like 'optimize_vector_database' - both seem related to vector database optimization.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides excellent usage guidelines with a dedicated '使用场景' (Usage scenarios) section listing four specific situations when to use this tool: after configuration changes, when search is very slow, for database size optimization, and for persistent performance issues. This gives clear context for when this tool is appropriate.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

TDQS

A3.9/5.0
Disambiguation5/5

Each tool has a clear, distinct purpose: querying with/without filters, learning from files or text, and various statistics and maintenance operations. There is no functional overlap.

Naming Consistency4/5

Tool names follow a consistent verb_noun pattern in snake_case, e.g., ask_rag, learn_document, get_knowledge_base_stats. The only deviation is 'clear_embedding_cache_tool' which includes an unnecessary 'tool' suffix.

Tool Count5/5

With 10 tools covering querying, learning, statistics, and maintenance, the set is well-scoped for a RAG knowledge base server. No tool is redundant, and the number is appropriate for the domain.

Completeness3/5

The tools cover essential operations (add, query, manage, maintain), but lack delete or list/update for documents, which are common for a full lifecycle. The gaps are minor but notable.

Maintenance

ActivityInactive
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    Intelligent knowledge base management tool that enables searching, browsing, and analyzing documents across multiple datasets with smart document analysis capabilities.
    24
  • A
    license
    Not graded
    quality
    D
    maintenance
    A local knowledge base system based on ChromaDB that supports automatic chunking, vector storage, and efficient similarity retrieval of txt and pdf documents, with MCP protocol support allowing AI assistants to directly access knowledge management functions.
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Indexes local and enterprise documents to provide a unified personal knowledge base for AI clients via the Model Context Protocol. It supports full-text search across various file formats and integrates with platforms like Feishu and WeChat Work.
    40
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/kalicyh/mcp-rag'

If you have feedback or need assistance with the MCP directory API, please join our Discord server