Skip to main content
Glama

PostgreSQL MCP Server

AGPL 3.0
438
89
  • Linux
  • Apple

pg_manage_constraints

Manage PostgreSQL constraints by listing, creating, or dropping foreign keys and other constraints. Use operations like get, create_fk, drop_fk, create, and drop to handle schema rules efficiently.

Instructions

Manage PostgreSQL constraints - get, create foreign keys, drop foreign keys, create constraints, drop constraints. Examples: operation="get" to list constraints, operation="create_fk" with constraintName, tableName, columnNames, referencedTable, referencedColumns

Input Schema

NameRequiredDescriptionDefault
cascadeNoInclude CASCADE clause (for drop_fk/drop operations)
checkExpressionNoCheck expression (for create operation with check constraints)
columnNamesNoColumn names in the table (required for create_fk)
connectionStringNoPostgreSQL connection string (optional)
constraintNameNoConstraint name (required for create_fk/drop_fk/create/drop)
constraintTypeNoFilter by constraint type (for get operation)
constraintTypeCreateNoType of constraint to create (for create operation)
deferrableNoMake constraint deferrable (for create_fk/create operations)
ifExistsNoInclude IF EXISTS clause (for drop_fk/drop operations)
initiallyDeferredNoInitially deferred (for create_fk/create operations)
onDeleteNoON DELETE action (for create_fk)
onUpdateNoON UPDATE action (for create_fk)
operationYesOperation: get (list constraints), create_fk (foreign key), drop_fk (drop foreign key), create (constraint), drop (constraint)
referencedColumnsNoReferenced column names (required for create_fk)
referencedSchemaNoReferenced table schema (for create_fk, defaults to same as table schema)
referencedTableNoReferenced table name (required for create_fk)
schemaNoSchema name (defaults to public)
tableNameNoTable name (optional filter for get, required for create_fk/drop_fk/create/drop)

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "cascade": { "description": "Include CASCADE clause (for drop_fk/drop operations)", "type": "boolean" }, "checkExpression": { "description": "Check expression (for create operation with check constraints)", "type": "string" }, "columnNames": { "description": "Column names in the table (required for create_fk)", "items": { "type": "string" }, "type": "array" }, "connectionString": { "description": "PostgreSQL connection string (optional)", "type": "string" }, "constraintName": { "description": "Constraint name (required for create_fk/drop_fk/create/drop)", "type": "string" }, "constraintType": { "description": "Filter by constraint type (for get operation)", "enum": [ "PRIMARY KEY", "FOREIGN KEY", "UNIQUE", "CHECK" ], "type": "string" }, "constraintTypeCreate": { "description": "Type of constraint to create (for create operation)", "enum": [ "unique", "check", "primary_key" ], "type": "string" }, "deferrable": { "description": "Make constraint deferrable (for create_fk/create operations)", "type": "boolean" }, "ifExists": { "description": "Include IF EXISTS clause (for drop_fk/drop operations)", "type": "boolean" }, "initiallyDeferred": { "description": "Initially deferred (for create_fk/create operations)", "type": "boolean" }, "onDelete": { "description": "ON DELETE action (for create_fk)", "enum": [ "NO ACTION", "RESTRICT", "CASCADE", "SET NULL", "SET DEFAULT" ], "type": "string" }, "onUpdate": { "description": "ON UPDATE action (for create_fk)", "enum": [ "NO ACTION", "RESTRICT", "CASCADE", "SET NULL", "SET DEFAULT" ], "type": "string" }, "operation": { "description": "Operation: get (list constraints), create_fk (foreign key), drop_fk (drop foreign key), create (constraint), drop (constraint)", "enum": [ "get", "create_fk", "drop_fk", "create", "drop" ], "type": "string" }, "referencedColumns": { "description": "Referenced column names (required for create_fk)", "items": { "type": "string" }, "type": "array" }, "referencedSchema": { "description": "Referenced table schema (for create_fk, defaults to same as table schema)", "type": "string" }, "referencedTable": { "description": "Referenced table name (required for create_fk)", "type": "string" }, "schema": { "description": "Schema name (defaults to public)", "type": "string" }, "tableName": { "description": "Table name (optional filter for get, required for create_fk/drop_fk/create/drop)", "type": "string" } }, "required": [ "operation" ], "type": "object" }

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/HenkDz/postgresql-mcp-server'

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