Skip to main content
Glama
abushadab

Self-Hosted Supabase MCP Server

by abushadab

rebuild_hooks

Restart the pg_net worker to ensure proper functionality with the pg_net extension in a Self-Hosted Supabase MCP Server environment.

Instructions

Attempts to restart the pg_net worker. Requires the pg_net extension to be installed and available.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The execute function implementing the rebuild_hooks tool, which restarts the pg_net worker using net.worker_restart() SQL.
    execute: async (input: RebuildHooksInput, context: ToolContext) => {
        const client = context.selfhostedClient;
    
        // Attempt to restart the pg_net worker.
        // This might fail if pg_net is not installed or the user lacks permissions.
        const restartSql = 'SELECT net.worker_restart()'; // Remove semicolon
    
        try {
            console.error('Attempting to restart pg_net worker...');
            const result = await executeSqlWithFallback(client, restartSql, false);
    
            // Check if the result contains an error
            if ('error' in result) {
                // Specific check for function not found (pg_net might not be installed/active)
                const notFound = result.error.code === '42883'; // undefined_function
                const message = `Failed to restart pg_net worker: ${result.error.message}${notFound ? ' (Is pg_net installed and enabled?)' : ''}`;
                console.error(message);
                return { success: false, message };
            }
    
            // If no error, assume success
            console.error('pg_net worker restart requested successfully.');
            return { success: true, message: 'pg_net worker restart requested successfully.' };
    
        } catch (error: unknown) {
            // Catch exceptions during the RPC call itself
            const errorMessage = error instanceof Error ? error.message : String(error);
            console.error(`Exception attempting to restart pg_net worker: ${errorMessage}`);
            return { success: false, message: `Exception attempting to restart pg_net worker: ${errorMessage}` };
        }
    },
  • Zod input/output schemas and static MCP input schema for the rebuild_hooks tool.
    const RebuildHooksInputSchema = z.object({});
    type RebuildHooksInput = z.infer<typeof RebuildHooksInputSchema>;
    
    // Output schema
    const RebuildHooksOutputSchema = z.object({
        success: z.boolean(),
        message: z.string(),
    });
    
    // Static JSON Schema for MCP capabilities
    const mcpInputSchema = {
        type: 'object',
        properties: {},
        required: [],
    };
  • src/index.ts:111-111 (registration)
    Registration of rebuildHooksTool in the availableTools object for the MCP server.
    [rebuildHooksTool.name]: rebuildHooksTool as AppTool,
  • src/index.ts:22-22 (registration)
    Import of the rebuildHooksTool.
    import { rebuildHooksTool } from './tools/rebuild_hooks.js';

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

B3.3/5.0
Behavior2/5

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

With no annotations provided, the description carries the full burden. It only discloses one behavioral trait (requires extension) but omits side effects, success/failure behavior, or what 'attempts' means.

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

Conciseness4/5

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

The description is two concise sentences with no wasted words, front-loading the action immediately. It is appropriately sized for a simple tool.

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

Completeness3/5

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

Given the tool has no parameters and no output schema, the description covers the core purpose and a prerequisite. However, it lacks details on return value, error conditions, or what exactly 'restart' entails, leaving gaps.

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?

There are no parameters, so the schema coverage is 100%. The description adds context about extension requirements beyond the empty schema, meeting the baseline expectation for zero-parameter tools.

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

Purpose4/5

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

The description clearly states the tool attempts to restart the pg_net worker using a specific verb and resource. It distinguishes itself from sibling tools which are unrelated operations.

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?

The description mentions a prerequisite (pg_net extension installed) but lacks explicit guidance on when to use this tool versus alternatives or when not to use it.

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

Deploy Server

Other Tools

Related Tools