Skip to main content
Glama
heroku

Heroku MCP server

Official
by heroku

pg_locks

Analyze and resolve database locks and blocking transactions. Identify blocked queries, investigate deadlocks, monitor lock states, and improve performance by diagnosing concurrency issues.

Instructions

Analyze database locks and blocking transactions. Use this tool when you need to: 1) Identify blocked queries and lock chains, 2) Investigate deadlock situations, 3) Monitor transaction lock states, 4) Resolve blocking issues affecting performance. The tool helps diagnose and resolve database concurrency problems.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
appYesThe name of the Heroku app whose database locks to view.
databaseNoConfig var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::`. If omitted, DATABASE_URL is used.
truncateNoWhen true, truncates queries to 40 characters.

Implementation Reference

  • Executes the pg_locks tool by building and running the Heroku CLI 'pg:locks' command with provided options, then processes the output.
    async (options: PgLocksOptions): Promise<McpToolResponse> => { const command = new CommandBuilder(TOOL_COMMAND_MAP.PG_LOCKS) .addFlags({ app: options.app, truncate: options.truncate }) .addPositionalArguments({ database: options.database }) .build(); const output = await herokuRepl.executeCommand(command); return handleCliOutput(output); }
  • Zod input schema for pg_locks tool defining app, optional truncate, and database parameters.
    export const pgLocksOptionsSchema = z.object({ app: z.string().describe('Target app name'), truncate: z.boolean().optional().describe('Truncate queries to 40 chars'), database: z .string() .optional() .describe('Database identifier. Format: APP_NAME::DB for other apps. Default: DATABASE_URL') });
  • Registers the pg_locks tool on the MCP server with name, description, input schema, and handler function.
    server.tool( 'pg_locks', 'Analyze locks: blocked queries, deadlocks, concurrency', pgLocksOptionsSchema.shape, async (options: PgLocksOptions): Promise<McpToolResponse> => { const command = new CommandBuilder(TOOL_COMMAND_MAP.PG_LOCKS) .addFlags({ app: options.app, truncate: options.truncate }) .addPositionalArguments({ database: options.database }) .build(); const output = await herokuRepl.executeCommand(command); return handleCliOutput(output); } );
  • src/index.ts:79-79 (registration)
    Calls the registration function to add the pg_locks tool during server initialization.
    data.registerPgLocksTool(server, herokuRepl);
  • Constant mapping for the pg:locks Heroku CLI command used by the tool handler.
    PG_LOCKS: 'pg:locks',

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

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