Skip to main content
Glama
Postgres MCP

Postgres MCP

by freakynit

Switch current database

switch_database

Switches the active PostgreSQL database to the specified one; if the change fails, it automatically reverts to the previous database.

Instructions

Switches the active database to the specified one. If an error occurs during the switch, the system automatically reverts back to the previous active database

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": {
      "database_name": "<database_name>"
    },
    "name": "switch_database"
  }
}

Input Schema

NameRequiredDescriptionDefault
database_nameYesName of the database to switch to.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.0.1

TDQS

B3.3/5.0
Behavior3/5

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

With no annotations supplied, the description carries the full burden, but it does add a valuable behavioral fact: an error during the switch automatically reverts to the previous active database, implying atomic failure handling. It remains silent on scope (session vs. global), permission requirements, and impact on in-flight queries or transactions, which are significant gaps for a stateful mutation.

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?

Two tight sentences: the action is front-loaded and the failure/revert behavior follows immediately. Nothing is wasted or repeated from the schema.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple one-parameter tool with no output schema, the description covers the primary effect and error handling. However, with no annotations to lean on, it leaves open whether the switch is session-scoped or global and what permissions are needed, which an agent would need to know before invoking it.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema covers 100% of the single parameter, documenting database_name as 'Name of the database to switch to.' The description adds no format, naming convention, or validity details beyond that, so the baseline of 3 applies.

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 description names a specific verb and resource: switching the active database to the specified one. It is unambiguous and does not overlap with siblings like list_tables, describe_tables, or execute_raw_query, though it never explicitly contrasts with them.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no guidance on when to use this tool versus alternatives, no mention of prerequisites (permissions, existing connections, whether it affects only the current session), and no exclusions. The agent must infer that this should be called before running queries against another database.

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