mirror of
https://github.com/googleapis/genai-toolbox.git
synced 2026-02-14 17:15:11 -05:00
## Description This pull request resolves issue [#36](https://github.com/gemini-cli-extensions/sql-server/issues/36) by introducing default connection parameters for the MSSQL prebuilt tool. If a user does not specify a host or port, the tool will now default to localhost:1433 **Changes Implemented** The modification is in internal/prebuiltconfigs/tools/mssql.yaml, where the host and port fields now include default values: host: ${MSSQL_HOST:localhost} port: ${MSSQL_PORT:1433} This configuration allows the tool to function using the defaults, but users can still set the MSSQL_HOST or MSSQL_PORT environment variables to override them. **Validation Process** Validated changes by running the toolbox against a Microsoft SQL Server instance hosted in a Docker container. - **Database Setup:** A testdb database containing a products table was initialized. - **CLI Configuration:** The ~/.gemini/settings.json file was updated to point to my local toolbox build. - **Tool Launch:** The UI was started using go run . --prebuilt mssql --ui - **Testing:** Confirmed the connection logic by testing two scenarios. One with the environment variables set and one without (to confirm the default logic). **1.** Default Value Connection: For this test, the MSSQL_HOST and MSSQL_PORT environment variables were not defined. The application correctly utilized the new default values (localhost:1433) to connect to the testdb. <img width="2175" height="1144" alt="Screenshot 2025-11-12 6 33 05 PM" src="https://github.com/user-attachments/assets/bacfc9bf-8b35-42e1-ad53-4af3aef27125" /> **2.** Explicit Variable Connection: For the second test, MSSQL_HOST and MSSQL_PORT were set to specific values. The application correctly prioritized these variables over the new defaults and connected successfully. <img width="2175" height="1144" alt="Screenshot 2025-11-12 6 37 02 PM" src="https://github.com/user-attachments/assets/61254849-211d-41f4-8c7d-ff92cf64a51c" /> Result: Both connection methods were verified by executing the list_tables prebuilt tool via the UI. In each scenario, the tool successfully retrieved the UserDetails table, confirming the changes. <img width="2250" height="1144" alt="Screenshot 2025-11-12 6 38 12 PM" src="https://github.com/user-attachments/assets/87085777-897e-4a74-9e3f-f36cc8a33305" /> ## 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](https://github.com/googleapis/genai-toolbox/blob/main/CONTRIBUTING.md) - [ ] 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 - [ ] 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 [#36](https://github.com/gemini-cli-extensions/sql-server/issues/36)