Skip to main content
Glama
MCP Server RAG

MCP Server RAG

by atengk

rag_index_text

Index plain text into a specified knowledge base by chunking, embedding, and persisting it; SHA-256 content checks skip unchanged documents and atomically replace changed chunks.

Instructions

对单段纯文本内容进行切片、计算高维向量嵌入并持久化索引到指定知识库中。

支持基于 SHA-256 内容指纹校验的幂等更新:
- 若相同 title 的文档内容未变动,秒级跳过;
- 若内容发生修改,原子删除旧切片并插入新切片。

Args:
    kb_name: 目标知识库名称
    text: 待索引的正文纯文本内容
    title: 文档标题或唯一标识(在知识库中作为 doc_id)
    metadata: 可选的附加结构化元数据(标签、分类、作者等)

Returns:
    dict[str, Any]: 索引执行结果状态字典

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "kb_name": "<kb_name>",
      "text": "<text>",
      "title": "<title>"
    },
    "name": "rag_index_text"
  }
}

Input Schema

NameRequiredDescriptionDefault
textYes
titleYes
kb_nameYes
metadataNo

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.9/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 load and does well: it discloses the pipeline (chunk → embed → persist), SHA-256 content-fingerprint idempotency with a fast skip on unchanged content, and atomic delete-then-insert on modification. It omits error behavior for a missing/invalid KB and any permission or rate-limit context.

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?

Front-loaded one-sentence purpose followed by a tight bulleted idempotency block and a conventional Args/Returns section. Every line contributes; nothing is repeated from the name or schema.

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?

An output schema exists, so the terse return note is acceptable, and the mutation semantics (atomic swap, idempotent skip) are unusually well covered for an unannotated write tool. The one material gap is the implicit precondition that the target KB already exists and what happens if it does not.

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 description coverage is 0%, so the description must compensate and largely does: it explains kb_name as the target KB, text as the raw body, title as the document identity used as doc_id within the KB, and metadata as optional structured tags/category/author. The title-as-doc_id mapping is genuinely non-obvious information absent from the schema.

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?

States a specific compound action — chunking, computing high-dimensional embeddings, and persisting into a named knowledge base — for '单段纯文本内容' (a single plain-text segment). That qualifier implicitly separates it from the file/directory/URL indexing siblings, though no alternative is named explicitly.

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

Usage Guidelines3/5

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

Usage is only implied: you supply a single text string plus a target KB. There is no explicit when-to-use statement, no mention of when to prefer rag_index_file/rag_index_directory/rag_index_url instead, and no stated prerequisites (e.g., whether the KB must already exist via rag_create_kb).

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