Skip to main content
Glama

add_document

Add raw text or markdown documents to a searchable knowledge base, writing the file and indexing it immediately so new content is available to search.

Instructions

Add a new document to the knowledge base from raw text content.

Mutating — writes a file to disk and indexes it immediately. No auth required.

Args: content: Full text content of the document (markdown supported) filepath: Relative path within documents directory (e.g., "security/new-technique.md"). The subdirectory should match the category. category: Category stored with the document (default: general). Any name is accepted, but search_knowledge() filters only by configured categories (category_mappings values, keyword_routes keys, general), and update_document() or re-indexing the file detects it again from the path through category_mappings. list_categories() shows the categories in use.

Returns: JSON string with indexing results (filepath, chunks created, status).

Usage: Use to add new documents from text content. Use add_from_url() instead when the source is a web page. Use update_document() to replace content of an existing file. The document is immediately searchable after this call — no manual reindex needed.

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": {
      "content": "<content>",
      "filepath": "<filepath>"
    },
    "name": "add_document"
  }
}

Input Schema

NameRequiredDescriptionDefault
contentYes
categoryNogeneral
filepathYes

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv3.0.0

TDQS

A4.6/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does so well: it declares the mutation, the side effects (writes a file to disk, indexes immediately), no auth requirement, and that the document is searchable without a manual reindex. The main gap is conflict behavior — it never says whether an existing filepath is overwritten or errors.

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 side effects, then a structured Args/Returns/Usage layout — easy to scan. Slightly long, and the Returns block partially duplicates the existing output schema, but nothing is wasted boilerplate.

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, yet the description still orients the agent with the result shape and the indexing-is-immediate guarantee, which is the key operational fact. The only material omission is what happens when filepath already exists.

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

Parameters5/5

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

Schema coverage is 0%, so the description must compensate fully, and it does: content is 'full text, markdown supported', filepath is a relative path whose subdirectory must match the category, and category documents its 'general' default plus the non-obvious caveat that search_knowledge() only filters configured categories.

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?

Opens with a precise verb+resource+source: 'Add a new document to the knowledge base from raw text content.' The 'raw text content' qualifier immediately separates it from add_from_url and update_document.

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?

Explicitly states when to use this tool ('add new documents from text content') and names the alternatives with their selecting conditions: add_from_url() for web pages, update_document() to replace an existing file. No inference required.

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