Skip to main content
Glama

Add knowledge document

add_knowledge_document

Add text to a knowledge base as one document, stored as the file named by filename, which must end in .txt, .md or .markdown. text is 1 to 80,000 characters; put longer text in several documents, or upload a PDF, DOCX or larger file in the workspace or through POST /v1/knowledge-bases/{id}/documents. The document is processed in the background and becomes searchable when list_knowledge_documents shows it ready. Text identical to a document already in the base returns that document (deduplicated: true), in whatever state it is.

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": {
      "project_id": "<project_id>",
      "knowledge_base_id": "<knowledge_base_id>",
      "filename": "<filename>",
      "text": "<text>"
    },
    "name": "add_knowledge_document"
  }
}

Input Schema

NameRequiredDescriptionDefault
textYesThe document's text, at most 80,000 characters.
filenameYesThe document's file name, ending in .txt, .md or .markdown.
project_idYesThe workspace project the knowledge base belongs to.
organization_idNoOptional. Defaults to the authenticated workspace; when supplied it must be that workspace's id.
knowledge_base_idYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.4/5.0
Behavior5/5

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

Beyond the annotations, it discloses that processing is asynchronous and the document only becomes searchable once list_knowledge_documents reports it ready, and that identical text returns the existing document with deduplicated: true in whatever state it is. Those are exactly the non-obvious behaviors an agent needs; the content-based dedup is a nuance on top of idempotentHint=false rather than a contradiction of it.

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?

Four sentences, each carrying a distinct payload: what it creates, the size ceiling and its workaround, the async lifecycle, and the dedup rule. The purpose is front-loaded and there is no filler.

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?

There is no output schema, and the description covers the key return semantics (deduplicated flag, readiness state) that an agent must act on. It does not say whether a document identifier is returned or how the response is shaped beyond the dedup field, which is the only remaining gap.

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?

With 80% schema coverage, the schema already documents filename extensions and the 1-80,000 character range, and the description mostly restates those. It does add the consequence and workaround for oversized text, but says nothing about project_id or knowledge_base_id beyond what the schema provides, so the baseline 3 is right.

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?

States a specific verb and resource ('Add text to a knowledge base as one document') plus the storage form (file named by filename). An agent can distinguish it immediately from list_knowledge_documents and get_knowledge_document_text, which are read operations on the same resource.

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?

Gives an explicit escalation path when text exceeds 80,000 characters (split into several documents, or upload a PDF/DOCX or use POST /v1/knowledge-bases/{id}/documents), and points to list_knowledge_documents to confirm readiness. It does not spell out when to use this versus creating a new knowledge base, but the surrounding siblings make that boundary obvious.

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.