Skip to content

Commit 3524b79

Browse files
Yuan325averikitsch
andauthored
docs: update files (#1)
* docs: update files * update files * Apply suggestions from code review --------- Co-authored-by: Averi Kitsch <akitsch@google.com>
1 parent 88db10d commit 3524b79

File tree

3 files changed

+39
-25
lines changed

3 files changed

+39
-25
lines changed

POSTGRESQL.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1-
# PostgreSQL Extension
1+
You are a highly skilled database engineer and database administrator. Your purpose is to
2+
help the developer build and interact with databases and utilize data context throughout the entire
3+
software delivery cycle.
24

3-
This document provides instructions for the Gemini agent to assist users with the PostgreSQL extension.
5+
---
6+
7+
# Setup
48

59
## PostgreSQL MCP Server (Data Plane: Connecting and Querying)
610

711
This section covers connecting to a PostgreSQL database instance.
812

9-
1. **Verify Environment Variables**: Before attempting to connect, confirm with the user that the following environment variables are set in the extension configuration or their shell environment.
13+
1. **Verify Environment Variables**: The extension requires the following environment variables to be set before the Gemini CLI is started:
1014

1115
* `POSTGRES_HOST`: The hostname or IP address of the PostgreSQL server.
1216
* `POSTGRES_PORT`: The port number of the PostgreSQL server.
@@ -16,4 +20,7 @@ This section covers connecting to a PostgreSQL database instance.
1620

1721
2. **Handle Missing Variables**: If a command fails with an error message containing a placeholder like `${POSTGRES_HOST}`, it signifies a missing environment variable. Inform the user which variable is missing and instruct them to set it.
1822

19-
3. **Handle Permission Errors**: If you encounter permission errors, ensure the user has the correct privileges on the PostgreSQL database.
23+
3. **Handle Permission Errors**: If an operation fails due to permission, it is
24+
likely that the user do not have the correct privileges on the PostgreSQL
25+
database. Database-level permissions (e.g., `SELECT`, `INSERT`) are required
26+
to execute queries.

README.md

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,52 +2,59 @@
22

33
This Gemini CLI extension provides a set of tools to interact with [PostgreSQL](https://www.postgresql.org/docs/) instances. It allows you to manage your databases, execute queries, and explore schemas directly from the [Gemini CLI](https://google-gemini.github.io/gemini-cli/), using natural language prompts.
44

5-
## Features
5+
## Why Use the Postgres Extension?
66

7-
* **Integrated with Gemini CLI:** As a Google-developed extension, it integrates seamlessly into the Gemini CLI environment, making security an accessible part of your workflow.
8-
* **Connect to PostgreSQL:** Securely connect to your PostgreSQL instances.
9-
* **Explore Database Schema:** List databases, tables, views, and schemas.
10-
* **Query your Database:** Execute SQL queries against your database.
11-
12-
## Supported Tools
13-
14-
* list-tables: Use this tool to list tables and descriptions.
15-
* execute-sql: Use this tool to execute any SQL statement.
7+
* **Natural Language Management:** Stop wrestling with complex commands. Explore schemas and query data by describing what you want in plain English.
8+
* **Seamless Workflow:** Stay in your CLI. No need to constantly switch contexts to the GCP console for common database tasks.
9+
* **Code Generation:** Accelerate development by asking Gemini to generate data classes and other code snippets based on your table schemas.
1610

1711
## Prerequisites
1812

1913
Before you begin, ensure you have the following:
2014

2115
* [Gemini CLI](https://github.com/google-gemini/gemini-cli) installed.
2216
* A running PostgreSQL instance.
17+
* User are granted database-level permissions to execute queries.
2318

2419
## Installation
2520

26-
To install the extension, use the `gemini extensions install` command:
21+
To install the extension, use the command:
2722

2823
```bash
29-
gemini extensions install github.com/gemini-cli-extensions/postgresql.git
24+
gemini extensions install github.com/gemini-cli-extensions/postgres
3025
```
3126

3227
## Configuration
3328

29+
Set the following environment variables before starting the Gemini CLI:
30+
3431
* `POSTGRES_HOST`: The hostname or IP address of the PostgreSQL server.
3532
* `POSTGRES_PORT`: The port number of the PostgreSQL server.
3633
* `POSTGRES_DATABASE`: The name of the database to connect to.
3734
* `POSTGRES_USER`: The username for authentication.
3835
* `POSTGRES_PASSWORD`: The password for authentication.
3936

37+
## Usage Examples
4038

41-
## Usage
39+
Interact with Postgres using natural language right from your IDE:
4240

43-
* Explore Schemas and Data
44-
* Generate code
41+
* **Explore Schemas and Data:**
42+
* "Show me all tables in the 'orders' database."
43+
* "What are the columns in the 'products' table?"
44+
* "How many orders were placed in the last 30 days, and what were the top 5 most purchased items?"
45+
46+
* **Generate Code:**
47+
* "Generate a Python dataclass to represent the 'customers' table."
48+
49+
## Supported Tools
4550

51+
* `list_tables`: Lists tables in the database.
52+
* `execute_sql`: Executes a SQL query.
4653

47-
## Security
54+
## Additional Extensions
4855

49-
This extension executes commands against your PostgreSQL database. Always review the generated SQL queries before execution, especially for write operations.
56+
Find additional extensions to support your entire software development lifecycle at [github.com/gemini-cli-extensions](https://github.com/gemini-cli-extensions).
5057

51-
## Disclaimer
58+
## Troubleshooting
5259

53-
This is not an officially supported Google product. This extension is under active development, and breaking changes may be introduced.
60+
* "cannot execute binary file": Ensure the correct binary for your OS/Architecture has been downloaded. See [Installing the server](https://googleapis.github.io/genai-toolbox/getting-started/introduction/#installing-the-server) for more information.

gemini-extension.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "PostgreSQL",
2+
"name": "postgres",
33
"version": "0.1.0",
4-
"description": "Connect to PostgreSQL",
4+
"description": "Connect and interact with a PostgreSQL database and data",
55
"mcpServers": {
66
"PostgreSQL": {
77
"command": "${extensionPath}${/}toolbox",

0 commit comments

Comments
 (0)