Skip to main content
Glama

table_alter

Destructive

Change the columns or name of a data table. One call is one atomic step: every operation applies, or none does.

Operations:

  • {"op":"add_column","name":"currency","type":"text","nullable":true,"default":"'USD'","comment":"..."} — existing rows get the default. Re-running a completed add returns applied: [] with note already_exists.

  • {"op":"rename_column","from":"memo","to":"bank_memo"} — data and indexes are kept.

  • {"op":"set_default","name":"status","default":"'paid'"} (null removes it)

  • {"op":"set_nullable","name":"status","nullable":false}

  • {"op":"drop_column","name":"amount_tol"} — DESTRUCTIVE

  • {"op":"alter_type","name":"bank_total","type":"bigint","using":"bank_total::bigint"} — DESTRUCTIVE; refused with VALUE_WOULD_TRUNCATE when any value would change

  • {"op":"rename_table","to":"new_name"} — DESTRUCTIVE

Types: text, integer, bigint, numeric, boolean, timestamptz, date, uuid, jsonb. id, created_at and updated_at are protected. Destructive operations need a person: the call returns code APPROVAL_REQUIRED with approval.requestId, nothing is applied (not even the other operations in the call), and a card appears in the chat. There is no confirm flag. Do not retry; the person's decision starts your next turn. In a chat, a default on a table above 250,000 rows returns job.jobId; poll table_change_status. Outside a chat it runs inline. Failures return success:false, code, operationIndex and the database message unchanged.

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": {
      "operations": "<operations>"
    },
    "name": "table_alter"
  }
}

Input Schema

NameRequiredDescriptionDefault
tableIdNoTable ID. Supply exactly one of tableId or tableName.
tableNameNoExact, case-sensitive accessible table name or SQL table slug; preferred when known. table, name and table_name are accepted aliases. Supply exactly one of tableName or tableId.
operationsYesArray of operations (a JSON string is also accepted). Example: [{"op":"add_column","name":"settlement_date","type":"date"}]
approvalRequestIdNoOptional. The requestId of an earlier APPROVAL_REQUIRED result, to read its outcome. It never approves anything: only a person can, on the card in the chat.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.3/5.0
Behavior5/5

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

Annotations already flag destructiveHint=true, but the description goes well beyond them: atomic all-or-nothing application, APPROVAL_REQUIRED with a requestId and a chat card, the absence of a confirm flag, a no-retry instruction, truncation refusal with VALUE_WOULD_TRUNCATE, protected columns, and the 250,000-row threshold that switches to job.jobId polling.

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?

It is front-loaded (scope first, then operations, then failure/approval behavior) and each block carries distinct, load-bearing information. It is long and dense, but the density is driven by a genuinely complex tool rather than padding.

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 destructive multi-operation tool with no output schema, it covers what an agent needs before calling: operation grammar, destructive preconditions, the approval loop, async job handling, and the exact error shape (success:false, code, operationIndex, raw DB message). Nothing material is left to inference.

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 tableId/tableName/approvalRequestId are already documented and the baseline is 3. The description nevertheless adds genuine meaning the schema cannot express: the payload shape of each op, what existing rows inherit on add, that null removes a default, and that approvalRequestId only reads an outcome rather than approving.

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 opening sentence gives a specific verb and resource ('Change the columns or name of a data table') and the enumerated operations make the exact scope concrete. It never name-checks a sibling such as table_update or table_create to delineate boundaries, so the 'no sibling differentiation' ceiling applies.

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?

Clear procedural context: one call equals one atomic step, destructive ops require approval, do not retry, and poll table_change_status when a job id is returned. What it lacks is an explicit 'use this instead of table_update/table_create' statement or an exclusion, so it falls short of a 5.

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.