Skip to main content
Glama
antonorlov

MCP PostgreSQL Server

list_schemas

Retrieve all database schemas to understand the structure and organization of PostgreSQL databases for efficient data management and query planning.

Instructions

List all schemas in the database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the 'list_schemas' tool. It ensures a database connection, queries the information_schema.schemata for all schema names, and returns the results as JSON.
    private async handleListSchemas() { await this.ensureConnection(); try { const result = await this.client!.query(` SELECT schema_name FROM information_schema.schemata ORDER BY schema_name `); return { content: [ { type: 'text', text: JSON.stringify(result.rows, null, 2), }, ], }; } catch (error) { throw new McpError( ErrorCode.InternalError, `Failed to list schemas: ${getErrorMessage(error)}` ); } }
  • src/index.ts:263-264 (registration)
    Dispatch registration in the CallToolRequestSchema handler switch statement, routing 'list_schemas' calls to the handleListSchemas method.
    case 'list_schemas': return await this.handleListSchemas();
  • Tool registration in the ListToolsRequestSchema response, defining the name, description, and empty input schema for 'list_schemas'.
    { name: 'list_schemas', description: 'List all schemas in the database', inputSchema: { type: 'object', properties: {}, required: [], }, },

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

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