Skip to main content
Glama

telys_upsert

Idempotent

Insert new text rows and replace existing ones by external id, ensuring repeated calls converge without duplicates or conflicts. Ideal for idempotent document writes with versioned updates.

Instructions

Add-or-replace text rows by external id: new ids are inserted; existing ids are re-embedded and replaced as a versioned update (never a duplicate physical row), then persisted. Use when the caller owns the ids and a repeated call must converge instead of conflicting — this is the idempotent write path. Required: collection, texts, ids (explicit JSON null is treated as omitted = plain telys_add with generated ids). Optional: metadata (one object per text) and partition_by (default 'scope'; the collection is auto-created when absent). Fails on ids/texts length mismatch.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idsYesexternal ids, one per text; new ids insert, existing ids are replaced
textsYesdocuments to embed on-device; one row per text
metadataNoone object per text positionally; the partition key is defaulted when omitted
collectionYestarget collection; auto-created (with partition_by) when absent
partition_byNopartition key used when auto-creating the collectionscope

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changedv0.1.1
    • addedInput schema / properties / collection / description
      Added value: +"target collection; auto-created (with partition_by) when absent"
    • addedInput schema / properties / ids / description
      Added value: +"external ids, one per text; new ids insert, existing ids are replaced"
    • addedInput schema / properties / metadata / description
      Added value: +"one object per text positionally; the partition key is defaulted when omitted"
    • addedInput schema / properties / partition_by / description
      Added value: +"partition key used when auto-creating the collection"
    • addedInput schema / properties / texts / description
      Added value: +"documents to embed on-device; one row per text"
  2. First observedv0.1.0

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already convey idempotentHint=true and readOnlyHint=false, and the description adds valuable specifics: versioned updates, never duplicate physical rows, auto-creation of collections, and failure on length mismatch. These go beyond the annotations and inform the agent of important side effects and constraints.

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?

The description is dense but each sentence carries critical information: core behavior, usage context, required/optional parameters, and a failure condition. It is front-loaded with the primary purpose and does not waste words, though it is somewhat lengthy for a tool description.

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?

For a write operation with 5 parameters and no output schema, the description covers all essential aspects: upsert semantics, auto-creation, null handling, length mismatch failure, and default partition. It doesn't describe return values, but for a write path that's less critical, and the failure condition is disclosed. The description is sufficiently complete for an agent to call it correctly.

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% (all properties described), so the baseline is 3. The description adds extra semantics: the null-handling for ids (treated as omitted = telys_add), positional mapping for metadata, and the default partition_by 'scope' with auto-creation. This enriches the parameter understanding beyond the schema.

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?

The description clearly states the action 'Add-or-replace text rows by external id' and explains the behavior for new vs existing ids, distinguishing it from siblings like telys_add and telys_update. It names the specific resource and verb, making the tool's purpose unambiguous.

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: 'Use when the caller owns the ids and a repeated call must converge instead of conflicting — this is the idempotent write path.' It also contrasts with telys_add by explaining that explicit JSON null for ids reverts to plain telys_add with generated ids, providing clear alternative guidance.

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