Skip to main content
Glama

Switch Default Database

db_use_database
Read-onlyIdempotent

Set the default database for subsequent PostgreSQL queries in the current session. Switch between databases to direct all following operations without specifying a database each time.

Instructions

Switches the default database for subsequent tool calls. After switching, all tools that accept an optional 'database' parameter will use this database when the parameter is omitted. The target database must be listed in pgautopilot.json. This is an idempotent operation — calling it with the same database name has no effect.

When to use:

  • After calling db_list_databases, when the user wants to work with a specific database.

  • When switching between production and analytics databases mid-session.

Behavioral notes:

  • The target database is lazily connected on first use if not already connected.

  • If the target database is unreachable, the switch succeeds but subsequent tools will return a connection error with guidance.

  • This does NOT affect other MCP sessions or connections — only the current session.

Returns: confirmation with the new default database name and its connection details.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
databaseYesName of the database to switch to as the default
Install Server

TDQS

A3.9/5.0
Behavior1/5

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

The annotations declare readOnlyHint=true, but the description explicitly states the tool 'switches the default database' and affects subsequent tool calls—this is a session-state mutation, directly contradicting the read-only annotation. Because of this annotation contradiction, behavioral transparency must be scored 1 per rubric, despite the otherwise rich behavioral notes.

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 with clear sections: main purpose, when to use, behavioral notes, and return value. Every sentence adds relevant information, and the most important behavior is front-loaded. No unnecessary repetition or filler exists.

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?

The description covers prerequisites (config listing), idempotency, lazy connection behavior, unreachable-database handling, session scoping, and return value. There is no output schema, but the return format is described. For a state-changing tool with one parameter, this is complete.

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 single parameter 'database' is fully described in the schema, and the description adds meaningful constraints and behavior: the target must be listed in pgautopilot.json, is lazily connected on first use, and that unreachable targets lead to connection errors later. This exceeds the baseline expected with 100% schema coverage.

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 states a specific verb and resource: 'Switches the default database for subsequent tool calls.' It clearly explains the scope and effect without ambiguity, and the tool is distinct from sibling tools like db_list_databases and db_table_info. This is a clear, actionable definition.

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 provides explicit contexts, such as after db_list_databases or when switching between production and analytics databases. It does not explicitly name alternatives or state when not to use the tool, but the usage context is sufficiently clear to guide tool selection.

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