Skip to main content
Glama

PostgreSQL MCP Server

AGPL 3.0
438
89
  • Linux
  • Apple

pg_manage_indexes

Manage PostgreSQL indexes effectively with a single tool to list, create, drop, reindex, and analyze usage for performance optimization and database efficiency.

Instructions

Manage PostgreSQL indexes - get, create, drop, reindex, and analyze usage with a single tool. Examples: operation="get" to list indexes, operation="create" with indexName, tableName, columns, operation="analyze_usage" for performance analysis

Input Schema

NameRequiredDescriptionDefault
cascadeNoInclude CASCADE clause (for drop operation)
columnsNoColumn names for the index (required for create operation)
concurrentNoCreate/drop index concurrently (for create/drop operations)
connectionStringNoPostgreSQL connection string (optional)
ifExistsNoInclude IF EXISTS clause (for drop operation)
ifNotExistsNoInclude IF NOT EXISTS clause (for create operation)
includeStatsNoInclude usage statistics (for get operation)
indexNameNoIndex name (required for create/drop)
methodNoIndex method (for create operation, defaults to btree)
minSizeBytesNoMinimum index size in bytes (for analyze_usage operation)
operationYesOperation: get (list indexes), create (new index), drop (remove index), reindex (rebuild), analyze_usage (find unused/duplicate)
schemaNoSchema name (defaults to public)
showDuplicatesNoDetect duplicate indexes (for analyze_usage operation)
showUnusedNoInclude unused indexes (for analyze_usage operation)
tableNameNoTable name (optional for get/analyze_usage, required for create)
targetNoTarget name for reindex (required for reindex operation)
typeNoType of target for reindex (required for reindex operation)
uniqueNoCreate unique index (for create operation)
whereNoWHERE clause for partial index (for create operation)

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "cascade": { "description": "Include CASCADE clause (for drop operation)", "type": "boolean" }, "columns": { "description": "Column names for the index (required for create operation)", "items": { "type": "string" }, "type": "array" }, "concurrent": { "description": "Create/drop index concurrently (for create/drop operations)", "type": "boolean" }, "connectionString": { "description": "PostgreSQL connection string (optional)", "type": "string" }, "ifExists": { "description": "Include IF EXISTS clause (for drop operation)", "type": "boolean" }, "ifNotExists": { "description": "Include IF NOT EXISTS clause (for create operation)", "type": "boolean" }, "includeStats": { "description": "Include usage statistics (for get operation)", "type": "boolean" }, "indexName": { "description": "Index name (required for create/drop)", "type": "string" }, "method": { "description": "Index method (for create operation, defaults to btree)", "enum": [ "btree", "hash", "gist", "spgist", "gin", "brin" ], "type": "string" }, "minSizeBytes": { "description": "Minimum index size in bytes (for analyze_usage operation)", "type": "number" }, "operation": { "description": "Operation: get (list indexes), create (new index), drop (remove index), reindex (rebuild), analyze_usage (find unused/duplicate)", "enum": [ "get", "create", "drop", "reindex", "analyze_usage" ], "type": "string" }, "schema": { "description": "Schema name (defaults to public)", "type": "string" }, "showDuplicates": { "description": "Detect duplicate indexes (for analyze_usage operation)", "type": "boolean" }, "showUnused": { "description": "Include unused indexes (for analyze_usage operation)", "type": "boolean" }, "tableName": { "description": "Table name (optional for get/analyze_usage, required for create)", "type": "string" }, "target": { "description": "Target name for reindex (required for reindex operation)", "type": "string" }, "type": { "description": "Type of target for reindex (required for reindex operation)", "enum": [ "index", "table", "schema", "database" ], "type": "string" }, "unique": { "description": "Create unique index (for create operation)", "type": "boolean" }, "where": { "description": "WHERE clause for partial index (for create operation)", "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