Skip to main content
Glama
Teja-sudo

postgres-mcp-server

by Teja-sudo

safe_alter_table

Converts high-level schema change intents (add column, foreign key, index, etc.) into multi-step zero-downtime DDL recipes for safe table alterations.

Instructions

Convert a high-level intent ('add NOT NULL column with default', 'add NOT NULL', 'add foreign key', 'add CHECK', 'create index', 'drop index') into a multi-step zero-downtime DDL recipe. Each step has its own SQL, expected lock level, and notes. Pipe the resulting scriptSql through dry_run_sql_file for verification, then through executeSqlFile(useTransaction=false) for the production rollout (CONCURRENTLY operations cannot run inside a transaction).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
intentYes
Behavior4/5

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

Since no annotations are provided, the description carries full burden. It discloses that the output contains scriptSql, lock levels, and notes, and mentions transaction constraints. It lacks details on error handling or validation, but covers key behaviors.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences plus a brief instruction, front-loaded with the core purpose. Every sentence adds value without redundancy.

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?

Given high complexity and no output schema, the description adequately explains the recipe output (SQL, lock level, notes) and usage workflow. It could be more detailed on return structure, but is sufficient for most use cases.

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 0%, so description compensates by explaining the 'intent' parameter's kinds (e.g., 'add NOT NULL column with default'). This adds meaning beyond the bare schema structure, though it does not detail each sub-field.

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 converts a high-level intent into a multi-step zero-downtime DDL recipe. It lists specific intent types (e.g., 'add NOT NULL column with default') and explains the output format (SQL, lock level, notes), distinguishing it from siblings like execute_sql.

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 provides explicit workflow: use the recipe output with dry_run_sql_file then executeSqlFile. It warns about CONCURRENTLY operations outside transactions. However, it does not explicitly state when to use this versus direct ALTER TABLE or other mutation tools.

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/Teja-sudo/postgres-mcp-server'

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