Skip to main content
Glama
retrieval-mcp

retrieval-mcp

by ZhiJiu-An

fetch

Read-onlyIdempotent

Retrieves surrounding context for matched snippets or reads a full document by doc_id, providing complete clauses and evidence when search snippets are insufficient.

Instructions

取命中片段周围的上下文,或按 doc_id 读取整篇文档。这是取依据的主力工具。

何时用:片段不足以判断、需要完整条款或前后文。 何时不用:只想确认文档是否存在 —— search 已经足够。

window=0 时返回该块所属小节的完整文本(小块入库、父块返回), 比只给这一小块更有用。truncated=true 表示被字数上限截断。

Input Schema

NameRequiredDescriptionDefault
doc_idNosearch 返回的 doc_id,读取整篇;与 chunk_id 二选一
windowNochunk 模式下向前后各扩展几块。schema 硬上限 10;实际还会按服务端 RAG_MAX_WINDOW 收敛
chunk_idNosearch 返回的 chunk_id;与 doc_id 二选一

Output Schema

NameRequiredDescriptionDefault
hintNo
textYes
titleYes
doc_idYes
chunk_idYes
truncatedYes
updated_atYes
resolved_byNoexact
section_pathYes
next_chunk_idNo
prev_chunk_idNo
chars_returnedYes
corpus_versionNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint and openWorldHint=false, so safety is covered. The description adds genuinely non-obvious behavior: window=0 returns the full parent section rather than the small indexed block, and truncated=true signals a character-limit cut. It doesn't discuss ordering or size limits, but the important behavioral quirk is disclosed.

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?

Front-loaded with the action, then two labeled sections for when/when-not, then the window=0 caveat. Efficient overall, though the bold emphasis markers and the 'main tool for evidence' positioning sentence are slightly redundant given the surrounding text.

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?

Three optional parameters, an output schema already present, and annotations covering safety — the description supplies exactly the missing pieces (mode selection, window=0 behavior, truncation flag) and need not restate return values.

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?

Schema coverage is 100%, so the baseline is 3; however the description explains the special semantics of window=0 (parent-block return) that the schema's 'expand N chunks' wording does not convey, and frames doc_id/chunk_id as alternative whole-document vs. chunk reads. This is meaningful meaning added on top of the 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?

Description states a specific action pair — fetch surrounding context for a matched chunk, or read a whole document by doc_id — and labels itself the primary evidence-retrieval tool. It is clearly distinguishable from 'search' (existence checks) and 'list_sources' (enumeration).

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?

Contains explicit 何时用 (when the snippet is insufficient / full clause needed) and 何时不用 (just confirming a document exists — search suffices) sections, naming the sibling tool that covers the excluded case. Routing is fully determined.

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

Deploy Server

Other Tools