Skip to main content
Glama
MCPg - Production-grade PostgreSQL MCP Server

MCPg - Production-grade PostgreSQL MCP Server

Get tablespace DDL

get_tablespace_ddl
Read-only

Returns the CREATE TABLESPACE DDL for a named tablespace via pg_get_tablespacedef, reporting found=false when it does not exist. Use it to reproduce or audit tablespace definitions on PG 19+.

Instructions

Return the CREATE TABLESPACE DDL for a named tablespace using PG 19's pg_get_tablespacedef(oid) function. Returns found=false with an empty ddl when the tablespace doesn't exist. Requires PG 19+. Returns an object with object_type ('tablespace'), object_name, found, and ddl.

Example: get_tablespace_ddl(tablespace_name='fast_ssd')

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": {
      "tablespace_name": "<tablespace_name>"
    },
    "name": "get_tablespace_ddl"
  }
}

Input Schema

NameRequiredDescriptionDefault
databaseNoOptional: a database id from list_databases, to target a configured secondary (read-only) database; omit for the primary. Database names that are not configured ids are rejected.
tablespace_nameYes

Output Schema

NameRequiredDescriptionDefault
ddlYes
foundYes
object_nameYes
object_typeYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.8.4
    • changedInput schema / properties / database / description
      Previous value: -"Optional: target a configured secondary (read-only) database by name; omit for the primary. Call list_databases to see the configured ids."New value: +"Optional: a database id from list_databases, to target a configured secondary (read-only) database; omit for the primary. Database names that are not configured ids are rejected."
  2. First observedv0.6.8

TDQS

A3.7/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true and openWorldHint=false, so safety is covered. The description adds real behavioral context on top: the PG 19+ version gate and the not-found contract ('Returns found=false with an empty ddl when the tablespace doesn't exist'), which an agent would otherwise have to discover by trial.

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?

Three tight sentences plus an example, with the core action front-loaded. The final sentence restating the returned object_type/object_name/found/ddl fields is partly redundant given an output schema exists, but it is brief and still aids at-a-glance readability.

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?

This is a simple, single-resource read tool with an output schema and read-only annotations, and the description covers the version prerequisite, the missing-object case, and the call shape. Nothing an agent needs in order to invoke it correctly is absent.

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 50% — the `database` parameter is well documented in the schema itself, but `tablespace_name` has no schema description. The description contributes a concrete call example (tablespace_name='fast_ssd'), clarifying that the parameter takes a name rather than an OID, but adds no syntax or constraints.

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 ('Return the CREATE TABLESPACE DDL for a named tablespace') and even names the underlying function pg_get_tablespacedef(oid). It does not explicitly contrast with the closely related get_role_ddl / get_database_ddl siblings, so an agent must infer the distinction from the noun 'tablespace', but the operation itself is unambiguous.

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

Usage Guidelines3/5

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

Usage is implied rather than stated: 'Requires PG 19+' functions as a hard precondition, which is genuinely useful selection guidance. However, there is no explicit when-to-use framing versus the sibling DDL tools and no statement of what to do if the server is pre-19 beyond the version note.

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

Deploy Server

Other Tools