Skip to main content
Glama

Add a file to an agent knowledge base

add_agent_knowledge_file

Add a file to an agent knowledge base

Adds a file as knowledge source to a voice agent, as the dashboard upload does. Send the file as base64 in base64 with its name in fileName. Allowed are PDF, TXT, MD, CSV and JSON files of at most 15 MB; the content must match the extension (a PDF starts with %PDF-, text files are UTF-8), otherwise the request is rejected with 400. Over MCP the whole request may be at most 1 MB, so larger files go through the API directly. The document is created in the voice engine and attached to the agent. When that fails, the request still succeeds and the entry is stored with status failed; delete it and add it again.

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": {
      "agentId": "<agentId>",
      "body": "<body>"
    },
    "name": "add_agent_knowledge_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
bodyYesThe file and its name.
agentIdYesIdentifier of the voice agent. Accepted either as the public form `agent_12` or as the bare number `12`; the prefix is stripped before the lookup.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.3/5.0
Behavior5/5

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

Annotations only declare readOnly=false, destructive=false, idempotent=false; the description goes well beyond that by disclosing validation failure modes (400 on extension/content mismatch), a partial-success semantic where the request succeeds even if voice-engine document creation fails and the entry is stored with status 'failed', and the remediation (delete and re-add). This is exactly the kind of non-obvious behavior an agent needs before calling a write tool.

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?

Purpose is front-loaded in the first sentence and the paragraph proceeds logically from input format to limits to failure semantics. It is somewhat dense and duplicates the 15 MB / 1 MB limit text that already appears verbatim in the schema descriptions.

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?

For a two-parameter nested-body write tool with no output schema, the description covers format, encoding, size ceilings, validation rejection, partial-failure state, and recovery. Nothing material is missing for an agent to invoke it correctly, including the caveat that success does not guarantee the document is usable.

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 coverage is 100%, so the baseline is 3, but the description adds meaning the schema does not: that the file content must be base64 in `base64` and that its bytes must actually match the declared extension (PDF magic bytes, UTF-8 text), which is a validation contract rather than a restatement. It does omit any mention of the optional `title` parameter, and it repeats the size limits already present in 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?

The description uses a specific verb and resource ('Adds a file as knowledge source to a voice agent') and clarifies the mechanism ('as the dashboard upload does'), which distinguishes it from a text/URL knowledge tool. It does not explicitly name or contrast with the sibling add_agent_knowledge, so an agent must infer the boundary from the file-oriented framing alone.

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?

It gives concrete acceptance conditions (PDF, TXT, MD, CSV, JSON, max 15 MB, content must match extension) and an explicit routing rule: files over the 1 MB MCP limit should go through the API directly. That is real when-to-use/when-not guidance, though it never names a sibling alternative for non-file knowledge.

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.