Skip to main content
Glama

upsert_rows

Insert or update rows in a PostgreSQL table using a defined conflict key, with typed row data and optional validation of affected row count.

Instructions

Upsert typed rows through a verified primary or unique conflict key

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rowsYesRows sharing one column set
returningNoColumns returned after commit validation
schema_nameYesExact schema name
expected_rowsNoOptional exact affected row count
relation_nameYesExact table name
update_columnsNoInserted columns updated on conflict
conflict_columnsYesComplete primary or non-partial unique key
max_affected_rowsNoHard mutation ceiling
Behavior2/5

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

No annotations are provided, so the description carries full responsibility. It only states 'upsert through a verified conflict key' without explaining core behaviors like atomicity, row resolution details, or whether returned rows include inserted or updated results. The schema adds limited behavioral context via 'update_columns' and 'conflict_columns' but the description does not synthesize this.

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 a single concise sentence that is front-loaded and to the point. It could benefit from more structure, but it efficiently communicates the core function with no wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 8 parameters, no output schema, and no annotations, the description provides minimal context. It omits information about return values, error handling, row-matching logic, and the effect of 'update_columns'. A more complete description would guide the agent on expected outcomes and limitations.

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 coverage is 100%, so the schema already describes each parameter. The description adds no additional semantic meaning beyond the verb 'upsert', which is already implied. With high schema coverage, a baseline of 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?

The description clearly states the tool upserts typed rows using a verified primary or unique conflict key. It effectively distinguishes itself from sibling tools like insert_rows and update_rows by specifying the combined insert-or-update behavior.

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?

The description implies usage for upsert scenarios but lacks explicit guidance on when to prefer this over insert_rows or update_rows, or any exclusions. The name and description together make the context clear, but no alternatives or when-not-to-use are mentioned.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/surajmandalcell/pgsql-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server