Skip to main content
Glama
antonorlov

MCP PostgreSQL Server

list_schemas

List all schemas in a PostgreSQL database to inspect database structure, enabling efficient data organization, analysis, and management.

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 queries the information_schema.schemata to list all schemas and returns the result 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)}` ); } }
  • Input schema for the 'list_schemas' tool, which takes no parameters.
    inputSchema: { type: 'object', properties: {}, required: [], },
  • src/index.ts:211-219 (registration)
    Registration of the 'list_schemas' tool in the ListTools response, including name, description, and schema.
    { name: 'list_schemas', description: 'List all schemas in the database', inputSchema: { type: 'object', properties: {}, required: [], }, },
  • src/index.ts:263-264 (registration)
    Dispatch case in the CallToolRequest handler that routes to the list_schemas handler.
    case 'list_schemas': return await this.handleListSchemas();

Other Tools

Related Tools

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