Skip to main content
Glama

Add or update documents

search_add_documents
DestructiveIdempotent

Add or replace up to 1,000 documents in an index, all or nothing. Use when loading or syncing the app's records into an index. Before: search_get_index (needs search query access) for the fields. Returns the task: indexed, unchanged and stale counts, and the receipt. Scope: search:write. Reuse the same idempotency_key on retry. Cost: priced at get_pricing; any price is reserved on the prepaid balance before the call. Refused for balance or a limit: follow next_action.

Example tool call

This call uses example arguments supplied in the tool’s input schema.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "name": "products",
      "documents": [
        {
          "id": "sku-1",
          "brand": "Acme",
          "price": 75,
          "title": "Leather shoes"
        }
      ],
      "idempotency_key": "sync-products-0001"
    },
    "name": "search_add_documents"
  }
}

Input Schema

NameRequiredDescriptionDefault
nameYesIndex name.
documentsYesThe documents. A document with an existing id replaces it.
idempotency_keyYesUnique per request. Reuse it on retry.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.4/5.0
Behavior5/5

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

Annotations already declare destructiveHint=true and idempotentHint=true, and the description adds substantial context beyond them: all-or-nothing atomicity, the 1,000-document cap, returned task counts (indexed/unchanged/stale) plus receipt, the search:write scope, idempotency_key reuse on retry, prepaid balance reservation via get_pricing, and refusal handling via next_action. This covers exactly the mutation risks an agent needs.

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 core action and size limit, then layered prerequisites, return shape, scope, and cost. Dense but nearly every clause carries operational value; the telegraphic closing line ('Refused for balance or a limit: follow next_action') is terse but still parseable.

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?

With no output schema, the description compensates by describing the returned task and counts, and it covers preconditions, permissions, cost reservation, idempotency, and error routing. For a destructive bulk-write tool, nothing essential is missing.

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 all three parameters, including the idempotency_key retry guidance and the replace-on-existing-id behavior. The description largely restates these facts rather than adding syntax or format detail, so the baseline 3 is appropriate.

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 with scope: 'Add or replace up to 1,000 documents in an index, all or nothing.' The replace/upsert semantics and the atomic guarantee distinguish it immediately from sibling tools like search_delete_documents or search_query.

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 a clear usage condition ('Use when loading or syncing the app's records into an index') and an explicit prerequisite step naming the sibling search_get_index, including the access it requires. It stops short of stating when not to use it or naming an alternative for partial/streaming loads, so it is strong but not fully comprehensive.

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.