Skip to main content
Glama
itsalfredakku

Postgres MCP Server

data

Perform PostgreSQL database operations including insert, update, delete, and bulk data management with validation for table modifications.

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)
tableNameYesTable name (required for all actions)
schemaNameNoSchema name (default: public)public
dataNoData object for insert/update (key-value pairs)
rowsNoArray of data objects for bulk operations
whereNoWHERE conditions for update/delete operations
optionsNoOperation options

Implementation Reference

  • Handler function that processes calls to the 'data' tool. Currently implemented as a placeholder returning a message that data operations are not yet implemented.
    private async handleData(args: any) { // Placeholder for data operations return { content: [{ type: 'text', text: JSON.stringify({ message: 'Data operations not yet implemented' }, null, 2) }] };
  • Input schema definition for the 'data' tool, specifying parameters for various data manipulation actions (insert, update, delete, bulk operations, truncate).
    { 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:634-636 (registration)
    Registration of tool list handler that returns the toolDefinitions array, which includes the 'data' tool schema.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: toolDefinitions, }));
  • src/index.ts:655-656 (registration)
    Dispatch/registration of the 'data' tool handler in the CallToolRequestSchema switch statement.
    case 'data': 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