Skip to main content
Glama

build_knowledge_index

Build (or rebuild) the structured index for a knowledge base — the second leg beside vector search.

Vector search answers "what does this passage say". It **cannot count, filter numerically or
aggregate**, so "how many documents", "which ones are between 1000 and 2000 words", "how many
per category" are not answered badly — they are structurally unanswerable. This builds a small
per-KB table from whatever structured header the documents share, which the agent can then query
with SQL via `query_knowledge_table`.

Only worth it when the documents share a machine-readable header (a metadata table, YAML front
matter, `Field: value` lines). **Prose gets declined, and that is the right answer** — a table
of unique values makes statistics meaningless.

`roles` names the fields that must be extracted **exactly** and never paraphrased. Use it when
the answer has to quote something the model must not invent:
  - `identity` — what to call the item (book title, drug name, product name)
  - `link`     — where to send the user
  - `image`    — what to show the user
  - `code`     — the unique identifier
Which link is "the" link is a business fact the data does not state — only the customer knows.
A declared role that cannot be found comes back in `roles.unresolved` **with candidate field
names**: ask the user which one it is, do not guess.

**Read `dropped` in the report and tell the user about it.** A column that was thrown out
(coverage too low, two columns holding identical values) is invisible in later query results —
the model simply works around it — so this report is the only place it is ever mentioned.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
rolesNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.9/5.0
Behavior5/5

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

With no annotations, the description carries the full burden, and it does so richly. It discloses that prose gets declined, that unresolved roles come back in `roles.unresolved` with candidates for the user to choose, and that dropped columns are not visible in later query results and should be reported. This reveals otherwise hidden behaviors and consequences beyond the schema.

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?

While the description is long, it is well-structured with clear paragraphs, bolded terms, and a bullet list for roles. Every sentence earns its place, from the purpose statement to the actionable guidance about `dropped`. The front-loading is strong, and the length is justified by the tool's complexity.

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?

The description covers purpose, usage criteria, exclusions, parameter semantics, and important behavioral outcomes. It references an output report containing `roles.unresolved` and `dropped`, and since an output schema exists, the description does not need to enumerate return values. This is a complete guide for a complex 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 description adds deep meaning to the `roles` parameter, explaining exact extraction, listing specific role values (identity, link, image, code), and detailing unresolved-role behavior. The `name` parameter is not explicitly described, but its meaning is reasonably implied by 'for a knowledge base.' Since schema coverage is 0%, this is a strong compensation, though a brief mention of `name` would cement a 5.

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 opens with a specific verb and resource: 'Build (or rebuild) the structured index for a knowledge base.' It clearly distinguishes this from vector search by explaining what vector search cannot do (count, filter numerically, aggregate), and it frames the tool as the 'second leg beside vector search.' This is explicit and differentiates it from related siblings like search_knowledge_base and get_knowledge_index.

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 explicitly states when to use the tool: 'Only worth it when the documents share a machine-readable header' and also gives a when-not: 'Prose gets declined, and that is the right answer.' It contrasts with vector search and refers to the follow-up SQL query tool, providing clear alternatives and context. The `roles` section also guides when and how to use the parameter.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources