Skip to main content
Glama
abushadab

Self-Hosted Supabase MCP Server

by abushadab

list_realtime_publications

Retrieve PostgreSQL publications configured for Supabase Realtime to monitor and manage real-time data synchronization in self-hosted Supabase instances.

Instructions

Lists PostgreSQL publications, often used by Supabase Realtime.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The execute handler function that performs the tool logic: checks for direct PG connection, executes SQL query on pg_catalog.pg_publication, processes and validates the response using handleSqlResponse and Zod schema.
    execute: async (
        input: ListRealtimePublicationsInput,
        context: ToolContext
    ): Promise<ListRealtimePublicationsOutput> => {
        const client = context.selfhostedClient;
        console.error('Listing Realtime publications...');
    
        // Direct DB connection likely needed for pg_catalog access
        if (!client.isPgAvailable()) {
            context.log('Direct database connection (DATABASE_URL) is required to list publications.', 'error');
            throw new Error('Direct database connection (DATABASE_URL) is required to list publications.');
        }
    
        const sql = `
            SELECT
                oid,
                pubname,
                pubowner,
                puballtables,
                pubinsert,
                pubupdate,
                pubdelete,
                pubtruncate,
                pubviaroot
            FROM pg_catalog.pg_publication;
        `;
    
        console.error('Attempting to list publications using direct DB connection...');
        // Use executeSqlWithPg as it's a simple read query without parameters
        const result = await client.executeSqlWithPg(sql);
    
        const validatedPublications = handleSqlResponse(result, ListRealtimePublicationsOutputSchema);
    
        console.error(`Found ${validatedPublications.length} publications.`);
        context.log(`Found ${validatedPublications.length} publications.`);
        return validatedPublications;
    },
  • Zod schemas defining the input (empty object), output Publication model based on pg_publication columns, and output as array of Publications.
    // Input schema (no parameters needed)
    const ListRealtimePublicationsInputSchema = z.object({});
    type ListRealtimePublicationsInput = z.infer<typeof ListRealtimePublicationsInputSchema>;
    
    // Output schema based on pg_publication columns
    const PublicationSchema = z.object({
        oid: z.number().int(),
        pubname: z.string(),
        pubowner: z.number().int(), // Owner OID
        puballtables: z.boolean(),
        pubinsert: z.boolean(),
        pubupdate: z.boolean(),
        pubdelete: z.boolean(),
        pubtruncate: z.boolean(),
        pubviaroot: z.boolean(),
        // Potentially add pubownername if needed via join
    });
    const ListRealtimePublicationsOutputSchema = z.array(PublicationSchema);
    type ListRealtimePublicationsOutput = z.infer<typeof ListRealtimePublicationsOutputSchema>;
  • Static JSON schema for MCP tool input, as required by the protocol (empty object).
    // Static JSON schema for MCP (no parameters)
    export const mcpInputSchema = {
        type: 'object',
        properties: {},
        required: [],
    };
  • src/index.ts:120-120 (registration)
    Registration of the list_realtime_publications tool in the availableTools object, which is used to populate the MCP server's tool capabilities.
    [listRealtimePublicationsTool.name]: listRealtimePublicationsTool as AppTool,
  • src/index.ts:34-34 (registration)
    Import of the list_realtime_publications tool module.
    import listRealtimePublicationsTool from './tools/list_realtime_publications.js';

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.8/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so the description carries full burden. It only says 'lists' without disclosing read-only nature, authentication needs, or side effects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence, 10 words, no fluff. Every word adds value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple list tool with no parameters or output schema, the description provides the essential purpose and context. Missing return format is acceptable given no schema burden.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Zero parameters, so baseline is 4. The description does not need to add parameter info.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool lists PostgreSQL publications and hints at the Supabase Realtime context, making it distinct from sibling list tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use vs alternatives, but the purpose is self-evident given no other sibling tool lists publications.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.