Skip to main content
Glama

Проиндексировать документы для поиска

index_documents

Build a semantic search index from a folder of documents by chunking text, generating embeddings, saving the index locally, and updating only changed files on reruns.

Instructions

Строит поисковый индекс по папке с документами: режет тексты на фрагменты и считает эмбеддинги через Infergate (POST /embeddings). Индекс сохраняется в файл .infergate-index.json в этой папке. Повторный запуск обновляет только изменённые файлы. Понимает .txt, .md, .html, .csv, .json; PDF и Word сначала переведите в .txt или .md. Платный вызов (копейки за сотни страниц).

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": {
      "folder": "<folder>"
    },
    "name": "index_documents"
  }
}

Input Schema

NameRequiredDescriptionDefault
modelNoМодель эмбеддингов (по умолчанию baai/bge-m3 — многоязычная, хорошо понимает русский)
folderYesПапка с документами (ищет во вложенных папках тоже)
chunk_charsNoРазмер фрагмента в символах (по умолчанию 1500)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4/5.0
Behavior4/5

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

With no annotations at all, the description carries the full load and does well: it discloses the side effect (an .infergate-index.json file written into the target folder), the external network call to Infergate POST /embeddings, incremental re-run behavior, and the fact that the call costs money. It does not cover failure modes, permission requirements, or runtime expectations for large folders.

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?

Five short sentences, each earning its place: purpose and mechanism first, then output location, then idempotency, then format limits, then cost. No filler or repetition of the title.

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?

For a three-parameter tool with no annotations and no output schema, the description covers what the agent most needs: what happens on disk, that it costs money, and which formats will silently not be handled. It could be more complete by indicating what result is reported back after indexing (counts, errors) or what happens on partial failure.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents model, folder, and chunk_chars with defaults and bounds. The description only loosely echoes them through "режет тексты на фрагменты" and "считает эмбеддинги", adding no syntax, format, or trade-off detail beyond the schema; baseline 3 applies.

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 gives a specific verb and resource ("Строит поисковый индекс по папке с документами") and explains the mechanism (chunking plus embeddings). It never names or contrasts with the obvious sibling search_documents, so the agent must infer that indexing precedes searching rather than being told.

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?

Practical when-to-use signals are present: re-running refreshes only changed files, and PDF/Word files must be converted to .txt or .md first, which effectively states an unsupported-input exclusion. What is missing is any explicit pointer to search_documents as the consumer of the index or guidance on when a re-index is unnecessary.

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