Skip to main content
Glama

Backup Database

db_backup
Read-only

Creates a full SQL dump of a PostgreSQL database using pg_dump, saving schema and data to a timestamped file in the configured backup directory. Use before migrations or for periodic backups.

Instructions

Creates a full SQL dump of the database using pg_dump and saves it to the configured backup directory (default: ./backups). The backup includes the full schema and data. When the local pg_dump binary is not available and DOCKER_CONTAINER is set, this tool falls back to running pg_dump inside the specified Docker container.

When to use:

  • Before running risky migrations or bulk operations

  • Periodic backups as part of maintenance routines

  • When the user asks to back up or export the database

Parameter guidance:

  • label: optional label for the backup filename (e.g., "pre-migration"). The final filename includes a timestamp: backups/db_backup_pre-migration_2026-09-01T120000.sql

  • confirmed: set to true to confirm the backup operation

Behavioral notes:

  • Requires pg_dump to be available either locally or via Docker.

  • The backup file is a plain SQL dump, not a binary format.

  • Large databases may take significant time and disk space.

  • This tool is idempotent — running it multiple times creates separate backup files.

  • The backup directory is created automatically if it does not exist.

Returns: path to the created backup file and its size.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
labelNoOptional label for the backup filename
databaseNoName of the database to query (from pgautopilot.json). Omit to use the current default database.
confirmedNoExplicit user confirmation required to run a backup
Install Server

TDQS

A3.8/5.0
Behavior1/5

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

The description contradicts the annotations. It says the tool 'saves' backup files to a directory, which is a filesystem side effect, while readOnlyHint is true. It also calls the tool 'idempotent' while idempotentHint is false and the clarifying clause ('creates separate backup files') actually indicates non-idempotent behavior. Despite otherwise useful behavioral notes, the contradiction makes this dimension fail.

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 well organized into short sections: an opening summary, when to use, parameter guidance, behavioral notes, and return value. Every section adds practical information, and the key action is front-loaded.

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 tool with no output schema, the description covers prerequisites (pg_dump or Docker), fallback behavior, performance implications, return value, and automatic directory creation. It loses one point because the incorrect idempotence claim and readOnlyHint contradiction could mislead an agent about side effects.

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?

The schema already provides 100% coverage for label, database, and confirmed. The description adds meaningful value beyond the schema by showing the exact filename format with a timestamp, giving a concrete 'pre-migration' example, and clarifying that confirmed is an explicit user confirmation gate.

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 opens with a specific verb and resource: 'Creates a full SQL dump of the database using pg_dump and saves it to the configured backup directory.' It also clarifies that the backup includes the full schema and data, making it easy to distinguish from the db_* query and schema sibling tools.

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 'When to use' section lists concrete triggers: risky migrations, bulk operations, periodic maintenance, and explicit user requests to back up/export. It does not explicitly mention when not to use the tool, but there are no obvious backup sibling alternatives to exclude.

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

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/cyberreinxy/pgautopilot'

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