Files
genai-toolbox/internal
Niraj Nandre a03984cc15 fix(tools/alloydb-postgres-list-tables): Exclude google_ml schema from list_tables (#2046)
## Description

This Pull Request addresses an issue where the `postgres-list-tables`
tool was including the `google_ml` schema in the results when listing
tables from an AlloyDB PostgreSQL instance.

The primary change involves updating the SQL query within 

[https://github.com/googleapis/genai-toolbox/blob/main/internal/tools/postgres/postgreslisttables/postgreslisttables.go](url)
to explicitly exclude the `google_ml` schema, alongside other system
schemas.

The `WHERE` clause in the `listTablesStatement` has been modified from:

```sql
-- Original WHERE clause snippet
AND ns.nspname NOT IN ('pg_catalog', 'information_schema', 'pg_toast')
AND ns.nspname NOT LIKE 'pg_temp_%' AND ns.nspname NOT LIKE 'pg_toast_temp_%'
```

To:
```sql
-- Updated WHERE clause snippet
AND ns.nspname NOT IN ('pg_catalog', 'information_schema', 'pg_toast','google_ml')
AND ns.nspname NOT LIKE 'pg_temp_%' AND ns.nspname NOT LIKE 'pg_toast_temp_%'
```
This ensures that tables residing in the google_ml schema are no longer
returned by the tool, improving the clarity and relevance of the table
listings for users.

## Testing

The changes were validated end-to-end by:

*   Building a custom `toolbox` binary from the modified source.
* Configuring `~/.gemini/settings.json` to use this binary as an
`alloydb-test` MCP server.
* Launching `gemini` CLI and confirming the `alloydb-test` server was `🟢
Ready` via `/mcp`.
*   Invoking the `postgres-list-tables` tool with `list tables`.
* Verifying that `google_ml` schema tables were successfully excluded
from the results.

Testing screenshot : 

<img width="2809" height="1779" alt="Screenshot 2025-11-25 3 47 43 PM"
src="https://github.com/user-attachments/assets/126cf5be-30d7-4ec1-9d31-652b5219c0ce"
/>

## 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:

- [x] Make sure you reviewed

[CONTRIBUTING.md](https://github.com/googleapis/genai-toolbox/blob/main/CONTRIBUTING.md)
- [x] Make sure to open an issue as a

[bug/issue](https://github.com/googleapis/genai-toolbox/issues/new/choose)
  before writing your code! That way we can discuss the change, evaluate
  designs, and agree on the general idea
- [x] 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

🛠️ Fixes #2009

Co-authored-by: prernakakkar-google <158031829+prernakakkar-google@users.noreply.github.com>
2025-12-01 21:51:06 +00:00
..
2025-05-13 21:09:37 +00:00