Skip to main content
Glama
sbfulfil

PostgreSQL MCP Server

by sbfulfil

list_schemas

Retrieve and display all schemas within a PostgreSQL database, enabling users to explore database structure and metadata for improved database navigation and analysis.

Instructions

List all schemas in the database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for 'list_schemas' tool. Connects to the PostgreSQL database, queries information_schema.schemata excluding system schemas, and returns a formatted text list of available schemas.
    async listSchemas() { const client = await this.connectToDatabase(); try { const query = ` SELECT schema_name FROM information_schema.schemata WHERE schema_name NOT IN ('information_schema', 'pg_catalog', 'pg_toast') ORDER BY schema_name; `; const result = await client.query(query); return { content: [ { type: 'text', text: `Available schemas:\n\n` + result.rows.map(row => `• ${row.schema_name}`).join('\n'), }, ], }; } finally { await client.end(); } }
  • src/index.js:109-116 (registration)
    Registration of the 'list_schemas' tool in the ListToolsRequestSchema handler response, including name, description, and input schema (empty object).
    { name: 'list_schemas', description: 'List all schemas in the database', inputSchema: { type: 'object', properties: {}, }, },
  • Input schema definition for the 'list_schemas' tool: an empty object with no required parameters.
    inputSchema: { type: 'object', properties: {}, },
  • src/index.js:154-155 (registration)
    Dispatch/registration case in the CallToolRequestSchema handler's switch statement that invokes the listSchemas method.
    case 'list_schemas': return await this.listSchemas();

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/sbfulfil/pg-mcp'

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