Skip to main content
Glama

pg_connect

Connect to a PostgreSQL database using a connection URL or individual parameters like host, port, database, user, password, and SSL. Optionally enable read-only mode to block modifications.

Instructions

Connect to a PostgreSQL database using a URL or individual parameters

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
connectionIdYesUnique identifier for this connection
urlNoPostgreSQL connection URL (e.g., postgresql://user:pass@host:5432/dbname?ssl=true)
hostNoPostgreSQL host (ignored if url is provided)
portNoPostgreSQL port (default: 5432, ignored if url is provided)
databaseNoDatabase name (ignored if url is provided)
userNoUsername (ignored if url is provided)
passwordNoPassword (ignored if url is provided)
sslNoUse SSL connection (default: false, ignored if url is provided)
readOnlyNoEnable read-only mode - blocks INSERT, UPDATE, DELETE, and DDL operations (default: true)
Behavior2/5

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

No annotations are provided, so the description must fully disclose behavior. It only states the connection method but omits what happens on success/failure, whether connections are pooled, or any side effects. The readOnly parameter is not mentioned in the description, though it is in the schema.

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 a single, effective sentence that immediately conveys the core purpose. It is front-loaded and contains no extraneous information.

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

Completeness2/5

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

Given the tool's complexity (9 parameters, no annotations, no output schema), the description is too minimal. It fails to explain the return behavior (e.g., what happens after connecting), error handling, or how to use the connection with sibling tools. The schema covers parameter details, but the description should provide broader context.

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?

Schema description coverage is 100%, so the baseline is 3. The description adds a high-level distinction between URL and individual parameters, which echoes the schema's 'ignored if url is provided' notes. It does not add substantial new meaning beyond the schema.

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 specifies the action ('Connect') and the resource ('PostgreSQL database'), and distinguishes between two connection methods (URL or individual parameters). This clearly differentiates it from sibling tools like pg_disconnect, pg_query, etc.

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?

The description provides no guidance on when to use this tool versus alternatives (e.g., before querying, after disconnect). It does not mention prerequisites, such as needing a connectionId, or that it must be called before other database operations.

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/shedyhs/pg-mcp'

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