> For the complete documentation index, see [llms.txt](https://docs.telys.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.telys.ai/mcp/tool-add.md).

# telys\_add

`telys_add` **adds text documents to a Telys memory collection (created if absent)**. It is one of the five tools on the Telys MCP server (`telys mcp`), called by name over JSON-RPC 2.0 (protocol version `2025-06-18`) on stdio.

Given a `collection` and a list of `texts`, the server embeds each document with its default embedder (`AlgentaMultigramEmbedder`), inserts the new rows, and persists the collection to the active store (`$TELYS_MEMORY_PATH`, default `~/.telys/memory`). If the collection does not exist, the server creates it first — partitioned by `scope` — then saves. This is the write path that feeds [`telys_search`](/mcp/tool-search.md).

## Input schema

Required: `collection`, `texts`.

| Field        | Type            | Required | Default | Description                                                                                                                    |
| ------------ | --------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------ |
| `collection` | string          | yes      | —       | Target collection. Auto-created (with `partition_by="scope"`) and saved if it does not exist.                                  |
| `texts`      | array of string | yes      | —       | The documents to embed and store.                                                                                              |
| `ids`        | array of string | no       | auto    | External IDs, one per text. When omitted, the server assigns IDs.                                                              |
| `metadata`   | array of object | no       | —       | One metadata object per text. Include a `scope` key to route each record into a partition and to filter it later with `where`. |

{% hint style="info" %}
When you supply `ids`, `texts`, and `metadata`, the arrays align by position — element *i* of each describes the same record. Keep their lengths equal.
{% endhint %}

{% hint style="warning" %}
`telys_add` inserts **new rows only**; an ID that already exists raises a conflict. There is no update or upsert tool over MCP — to replace existing records, use the SDK's `Collection.upsert_texts(...)` or `Collection.update_texts(...)`. See [Add & upsert records](/working-with-data/add-and-upsert.md) and [Update records](/working-with-data/update-records.md).
{% endhint %}

## Output schema

| Field        | Type    | Description                                                                |
| ------------ | ------- | -------------------------------------------------------------------------- |
| `added`      | integer | Number of documents inserted in this call.                                 |
| `collection` | string  | Echoes the collection that was written (and created, if it did not exist). |

## Example call

A `tools/call` request that seeds a fresh `notes` collection:

{% code title="request.json" %}

```json
{
  "jsonrpc": "2.0",
  "id": 4,
  "method": "tools/call",
  "params": {
    "name": "telys_add",
    "arguments": {
      "collection": "notes",
      "texts": [
        "Scope keys compose one partition string with scope_key().",
        "Partitions physically split a collection; the first element becomes the key."
      ],
      "ids": ["n-018", "n-019"],
      "metadata": [
        { "scope": "project:acme", "source": "design-doc" },
        { "scope": "project:acme", "source": "design-doc" }
      ]
    }
  }
}
```

{% endcode %}

The wrapped result — a JSON payload in one text content block, with `isError` for status:

{% code title="response.json" %}

```json
{
  "jsonrpc": "2.0",
  "id": 4,
  "result": {
    "content": [
      { "type": "text", "text": "{\"added\": 2, \"collection\": \"notes\"}" }
    ],
    "isError": false
  }
}
```

{% endcode %}

Decoding the `text` field:

{% code title="payload.json" %}

```json
{ "added": 2, "collection": "notes" }
```

{% endcode %}

## In practice

Drive it from natural language; the client fills `texts` and `metadata`:

```
Remember in my notes collection, scope project:acme: "we standardized on scope_key() for partitions".
```

## Errors

Failures return the same envelope with `isError: true` and a single text block of the form `<Type>: <message>` — for example, a duplicate ID or mismatched array lengths. See [MCP configuration & scoping](/mcp/configuration-and-scoping.md) and [Exceptions & error codes](/reference/exceptions-and-errors.md).

## See also

* [Tool: telys\_search](/mcp/tool-search.md) — query the documents you added.
* [Tool: telys\_create\_collection](/mcp/tool-create-collection.md) — create a collection explicitly instead of on first add.
* [Add & upsert records](/working-with-data/add-and-upsert.md) — the SDK write paths, including upsert and update.
* [Partitions & scope keys](/understand-telys/partitions-scope-key.md) — how the `scope` metadata routes records.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.telys.ai/mcp/tool-add.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
