Skip to main content
Glama
itsalfredakku

Postgres MCP Server

data

Execute PostgreSQL database operations including insert, update, delete, and bulk actions with data validation for efficient table management.

Instructions

Data operations: insert, update, delete, bulk operations with validation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesAction: insert (single row), update (modify rows), delete (remove rows), bulk_insert (multiple rows), bulk_update (batch update), truncate (empty table)
dataNoData object for insert/update (key-value pairs)
optionsNoOperation options
rowsNoArray of data objects for bulk operations
schemaNameNoSchema name (default: public)public
tableNameYesTable name (required for all actions)
whereNoWHERE conditions for update/delete operations

Implementation Reference

  • The handler function that executes the 'data' tool logic. Currently implemented as a placeholder returning a not-implemented message.
    private async handleData(args: any) { // Placeholder for data operations return { content: [{ type: 'text', text: JSON.stringify({ message: 'Data operations not yet implemented' }, null, 2) }] }; }
  • The JSON schema definition for the 'data' tool input, specifying parameters for data manipulation actions.
    { name: 'data', description: 'Data operations: insert, update, delete, bulk operations with validation', inputSchema: { type: 'object', properties: { action: { type: 'string', enum: ['insert', 'update', 'delete', 'bulk_insert', 'bulk_update', 'truncate'], description: 'Action: insert (single row), update (modify rows), delete (remove rows), bulk_insert (multiple rows), bulk_update (batch update), truncate (empty table)' }, tableName: { type: 'string', description: 'Table name (required for all actions)' }, schemaName: { type: 'string', description: 'Schema name (default: public)', default: 'public' }, data: { type: 'object', description: 'Data object for insert/update (key-value pairs)' }, rows: { type: 'array', items: { type: 'object' }, description: 'Array of data objects for bulk operations' }, where: { type: 'object', description: 'WHERE conditions for update/delete operations' }, options: { type: 'object', properties: { onConflict: { type: 'string', description: 'ON CONFLICT action (DO NOTHING, DO UPDATE)' }, returning: { type: 'array', items: { type: 'string' }, description: 'Columns to return' }, validate: { type: 'boolean', default: true, description: 'Validate data before operation' } }, description: 'Operation options' } }, required: ['action', 'tableName'] } },
  • src/index.ts:633-637 (registration)
    Tool list registration handler that returns all tool definitions, including 'data'.
    // Register tool definitions this.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: toolDefinitions, }));
  • src/index.ts:656-656 (registration)
    Dispatch registration in the CallToolRequestSchema handler switch statement for the 'data' tool.
    return await this.handleData(args);

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/itsalfredakku/postgres-mcp'

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