Skip to content

feat(tools/postgres-list-active-queries): add new postgres-list-active-queries tool#1400

Merged
Yuan325 merged 2 commits into
googleapis:mainfrom
isaurabhuttam:featListActiveQueries
Sep 16, 2025
Merged

feat(tools/postgres-list-active-queries): add new postgres-list-active-queries tool#1400
Yuan325 merged 2 commits into
googleapis:mainfrom
isaurabhuttam:featListActiveQueries

Conversation

@isaurabhuttam

@isaurabhuttam isaurabhuttam commented Sep 10, 2025

Copy link
Copy Markdown
Contributor

Description

Adds a PostgreSQL tool kind postgres-list-active-queries that returns the top N currently running queries (state='active') from pg_stat_activity, ordered by longest running first. Each row includes: pid, user, database, application_name, client_addr, state, wait_event_type, wait_event, backend_start, xact_start, query_start, computed duration, and query (SQL text).

Parameters supported

  • min_duration (optional) — only include queries running at least this long (e.g., "1 minute", "2 seconds").

  • exclude_application_names(optional) — comma-separated list of application_name values to exclude (e.g., "psql,pgAdmin 4,my-batch").

  • limit (optional) — max rows to return (default 50).

Test Output

  • Test without filter:
image
  • Test with filter, but response
image
  • Test with filter, but no response
image

Should include a concise description of the changes (bug or feature), it's
impact, along with a summary of the solution

PR Checklist


Thank you for opening a Pull Request! Before submitting your PR, there are a
few things you can do to make sure it goes smoothly:

  • Make sure you reviewed
    CONTRIBUTING.md
  • Make sure to open an issue as a
    bug/issue
    before writing your code! That way we can discuss the change, evaluate
    designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)
  • Make sure to add ! if this involve a breaking change

Comment thread internal/prebuiltconfigs/tools/alloydb-postgres.yaml

@averikitsch averikitsch left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have an example or demo of this working?

@averikitsch

Copy link
Copy Markdown
Contributor

/gcbrun

@averikitsch averikitsch left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@averikitsch averikitsch added the release candidate Use label to signal PR should be included in the next release. label Sep 10, 2025

@averikitsch averikitsch left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you update the title to feat(tools/postgres-list-active-queries) and update for all your PRs?

@isaurabhuttam isaurabhuttam changed the title feat (postgres, cloud-sql-postgres, alloydb-postgres): add list_active_queries prebuilt tool to MCP Toolbox feat (postgres, cloud-sql-postgres, alloydb-postgres): add postgres-list-active-queries tool type in MCP Toolbox Sep 12, 2025
@isaurabhuttam isaurabhuttam changed the title feat (postgres, cloud-sql-postgres, alloydb-postgres): add postgres-list-active-queries tool type in MCP Toolbox feat (postgres-list-active-queries): add postgres-list-active-queries tool type in MCP Toolbox Sep 12, 2025
@isaurabhuttam isaurabhuttam force-pushed the featListActiveQueries branch 2 times, most recently from 1c838b6 to 6d6073c Compare September 12, 2025 12:44
@isaurabhuttam isaurabhuttam marked this pull request as ready for review September 12, 2025 12:47
@isaurabhuttam isaurabhuttam requested a review from a team September 12, 2025 12:47
@prernakakkar-google

Copy link
Copy Markdown
Contributor

/gcbrun

@prernakakkar-google prernakakkar-google added the tests: run Label to trigger Github Action tests. label Sep 12, 2025
@github-actions github-actions Bot removed the tests: run Label to trigger Github Action tests. label Sep 12, 2025
@Yuan325 Yuan325 changed the title feat (postgres-list-active-queries): add postgres-list-active-queries tool type in MCP Toolbox feat(tools/postgres-list-active-queries): add postgres-list-active-queries tool Sep 13, 2025
@Yuan325 Yuan325 changed the title feat(tools/postgres-list-active-queries): add postgres-list-active-queries tool feat(tools/postgres-list-active-queries): add new postgres-list-active-queries tool Sep 13, 2025

@Yuan325 Yuan325 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, please let me know if you would like me to clarify any of the requested changes :) Thank you!

Comment thread docs/en/resources/tools/postgres/postgres-list-active-queries.md Outdated
Comment thread docs/en/resources/tools/postgres/postgres-list-active-queries.md Outdated
Comment thread docs/en/resources/tools/postgres/postgres-list-active-queries.md Outdated
Comment thread docs/en/resources/tools/postgres/postgres-list-active-queries.md Outdated
Comment thread docs/en/resources/tools/postgres/postgres-list-active-queries.md Outdated
Comment thread internal/prebuiltconfigs/tools/postgres.yaml Outdated
Comment thread internal/tools/postgres/postgreslistactivequeries/postgreslistactivequeries.go Outdated
Comment thread tests/postgres/postgres_integration_test.go Outdated
@isaurabhuttam isaurabhuttam force-pushed the featListActiveQueries branch 3 times, most recently from 58f8e21 to c219f36 Compare September 15, 2025 16:11
@Yuan325 Yuan325 added the docs: deploy-preview Label to trigger Github Action docs preview. label Sep 15, 2025
@github-actions

Copy link
Copy Markdown
Contributor

@averikitsch

Copy link
Copy Markdown
Contributor

/gcbrun

@isaurabhuttam isaurabhuttam force-pushed the featListActiveQueries branch 2 times, most recently from 2567ae4 to 669d308 Compare September 16, 2025 10:02
@Yuan325

Yuan325 commented Sep 16, 2025

Copy link
Copy Markdown
Contributor

/gcbrun

@Yuan325 Yuan325 added the tests: run Label to trigger Github Action tests. label Sep 16, 2025
@github-actions github-actions Bot removed the tests: run Label to trigger Github Action tests. label Sep 16, 2025

@Yuan325 Yuan325 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@Yuan325

Yuan325 commented Sep 16, 2025

Copy link
Copy Markdown
Contributor

/gcbrun

@Yuan325

Yuan325 commented Sep 16, 2025

Copy link
Copy Markdown
Contributor

/gcbrun

@Yuan325 Yuan325 added the tests: run Label to trigger Github Action tests. label Sep 16, 2025
@Yuan325 Yuan325 enabled auto-merge (squash) September 16, 2025 17:05
@github-actions github-actions Bot removed the tests: run Label to trigger Github Action tests. label Sep 16, 2025
@Yuan325 Yuan325 merged commit b2b06c7 into googleapis:main Sep 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs: deploy-preview Label to trigger Github Action docs preview. release candidate Use label to signal PR should be included in the next release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants