Session activity
pg_activityInspect live PostgreSQL sessions to find long-running queries, idle-in-transaction connections, and blocked sessions, with state summaries and max_connections usage.
Instructions
Show who is connected right now: sessions from pg_stat_activity with user, database,
application, client, state, wait event, how long the transaction, query and state have
lasted, the query text, which sessions block them (blocked_by), plus a summary by state
and the use of max_connections.
Use it to find long-running queries, sessions stuck "idle in transaction" and blocked
sessions. Idle sessions are hidden unless include_idle is true or state="idle" is
given. min_duration_seconds keeps sessions whose transaction or current state is at
least that old. Your own session is never listed. For the lock tree use pg_locks.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "pg_activity"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| state | No | ||
| database | No | ||
| connection | No | ||
| include_idle | No | ||
| min_duration_seconds | No |