Repository navigation
Description
Self Checks
- I have searched for existing issues search for existing issues, including closed ones.
- I confirm that I am using English to submit this report (Language Policy).
- Non-english title submitions will be closed directly ( 非英文标题的提交将会被直接关闭 ) (Language Policy).
- Please do not modify this template :) and fill in all the required fields.
Is your feature request related to a problem?
The built-in RAGFlow MCP server (Go runtime, `main` and v1.0.0) exposes only three tools ([tools.json](https://github.com/infiniflow/ragflow/blob/main/internal/mcp/tools.json), [server.go](https://github.com/infiniflow/ragflow/blob/main/internal/mcp/server.go#L52-L64)): `ragflow_retrieval`, `ragflow_list_datasets`, and `ragflow_list_chats` (not document-related).
`ragflow_retrieval` already accepts `dataset_ids` and `document_ids`, so similarity search across all datasets, several documents, or a single document is possible. However, agents using the MCP server still have two gaps:
1. **No way to discover documents.** There is no tool to list the documents in a dataset. An agent can get dataset IDs from `ragflow_list_datasets`, but can only obtain document IDs/names indirectly from chunks returned by retrieval. This makes the `document_ids` filter hard to use in practice (e.g. "summarize the contract named X").
2. **No way to read a whole document.** There is no tool to list all chunks of a document in order. `ragflow_retrieval` cannot substitute for this: results are filtered by `similarity_threshold`, ranked by relevance rather than document order, and capped by the fixed rerank window (`page × page_size` ≤ 512, see [docs](https://github.com/infiniflow/ragflow/blob/main/docs/develop/mcp/mcp_tools.md)). Full-document summarization, translation, comparison, or full-context verification are therefore not possible via MCP.Describe the feature you'd like
Add two MCP tools (names are suggestions):
1. ragflow_list_documents — list documents in a dataset.
dataset_id(string, required): must be accessible to the authenticated userkeywords/name(string, optional): filter by document namepage(integer, optional, default 1)page_size(integer, optional, default 30, max 100)
Returns per document: id, name, dataset_id, type, size, chunk_count, token_count, run (parse status), create_date, update_date, meta_fields, plus pagination (total, page, page_size).
2. ragflow_list_chunks (or ragflow_read_document) — read all chunks of a document in document order.
dataset_id(string, required)document_id(string, required)page(integer, optional, default 1)page_size(integer, optional, default 30, max 100)
Returns chunks ordered by their position in the document (id, content, position info if available, important_keywords), plus document info (name, chunk_count) and pagination, so an agent can page through and reconstruct the full document without a relevance filter or the 512-candidate cap.
Both tools should apply the same authentication and dataset permission checks as ragflow_retrieval and be included in tools/list.
Describe implementation you've considered
Both capabilities already exist in the HTTP API, so the MCP tools can be thin wrappers around existing services:
- List documents:
GET /api/v1/datasets/{dataset_id}/documents - List chunks:
GET /api/v1/datasets/{dataset_id}/documents/{document_id}/chunks
The MCP retrieval handler already uses ListDocumentsByDatasetIDWithOptions and document metadata services (mcp_retrieval.go), which ragflow_list_documents can reuse. Implementation: add the schemas to internal/mcp/tools.json, register them in internal/mcp/server.go, wire handlers in internal/handler/mcp_server.go, and update docs/develop/mcp/mcp_tools.md.
Considerations:
- Keep
page_sizebounded to avoid oversized MCP responses; includetotalso agents know how many pages remain. - Return chunks in document order (not relevance order) for
ragflow_list_chunks. - Return a clear error for documents that are not yet parsed or not accessible.
Documentation, adoption, use case
Typical agent workflow:
1. `ragflow_list_datasets` → choose a dataset.
2. `ragflow_list_documents(dataset_id)` → find target documents by name/metadata.
3. Either:
- `ragflow_retrieval(question, dataset_ids, document_ids=[...])` → targeted search within one or several documents, or
- `ragflow_list_chunks(dataset_id, document_id)` → page through the whole document for summarization, translation, comparison, or full-context verification.
Use cases: "Summarize the whole contract X", "Compare policy v1 and v2", "Answer only from documents uploaded this month", and agents that search broadly first and then read the most relevant document in full.Additional information
I searched existing issues for MCP document listing / chunk reading tools and found no duplicates. Scoped retrieval (all datasets, multiple documents, or a single document) is already supported via dataset_ids / document_ids; this request is only about document discovery and full-document reading.
Activity
leilei3167 commentedon Nov 18, 2026
Implemented in #22501: document discovery with name filters and paginated document-order chunk reading, using the existing permission checks. The PR includes transport, validation, and handler tests, plus the local native-test limitation.