Skip to main content
Glama
Teja-sudo

postgres-mcp-server

by Teja-sudo

export_to_sql_file

Export database schema (DDL) and data to a SQL file for migration scripts or backups. Supports objects, table data, schema dumps, and query results.

Instructions

Export schema (DDL) and/or data from the connected database to a .sql file. Supports four content kinds via the 'what' parameter: 'objects' (DDL of a list of objects), 'data' (INSERT statements for tables), 'schema_dump' (full schema, optionally with data), 'query_result' (SELECT result emitted as INSERTs into a target table). Mode is 'append' (default, appends to existing file with separator banner) or 'overwrite'. The header banner records timestamp and source server alias (host/port hidden). Use this before transfer_objects or for migration script generation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathYesAbsolute or relative path to the .sql file. Must end with .sql.
modeNoFile write mode. Append (default) preserves existing content with a separator banner; overwrite replaces the file.append
whatYes
include_create_if_not_existsNo
confirm_overwriteNoWhen mode='overwrite' and file was modified <60s ago, set true to confirm. Foot-gun guard.
serverNoOne-time server override.
databaseNoOne-time database override.
schemaNoOne-time schema override (sets default schema for refs).
Behavior4/5

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

Details file modes (append/overwrite with banner), header banner recording timestamp and server alias (host/port hidden), and foot-gun guard for confirm_overwrite. No annotations, so description carries burden; covers key behavioral traits.

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?

Front-loaded with purpose, then organized by content kinds, modes, and usage note. Slightly lengthy but appropriate for complexity; no wasted sentences.

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?

Given 8 parameters, no output schema, and no annotations, the description covers all content kinds, modes, header, and usage guidance. It is comprehensive and leaves no major gaps.

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 75%, but the description adds value by explaining the four 'what' kinds, mode behavior, and header banner. It clarifies complex union schema and enhances understanding.

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 it exports schema and/or data to a .sql file, then details four content kinds. It differentiates from siblings by mentioning use before transfer_objects.

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?

Explicitly says 'Use this before transfer_objects or for migration script generation.' Provides context on modes and content kinds, but no exclusions or alternatives beyond that.

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