docs: update contributing with correct conventions (#1844)

## Description

Update CONTRIBUTING.md with correct file name conventions

## PR Checklist

- [x] 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
- [x] Ensure the tests and linter pass
- [x] Code coverage does not decrease (if any source code was changed)
- [x] Appropriate docs were updated (if necessary)
- [x] Make sure to add `!` if this involve a breaking change

Co-authored-by: Averi Kitsch <akitsch@google.com>
This commit is contained in:
gRedHeadphone
2025-11-05 05:16:11 +05:30
committed by GitHub
parent cf7012a82b
commit ec7859bf0d

View File

@@ -98,8 +98,7 @@ implementation](https://github.com/googleapis/genai-toolbox/blob/main/internal/s
We recommend looking at an [example tool We recommend looking at an [example tool
implementation](https://github.com/googleapis/genai-toolbox/tree/main/internal/tools/postgres/postgressql). implementation](https://github.com/googleapis/genai-toolbox/tree/main/internal/tools/postgres/postgressql).
* **Create a new directory** under `internal/tools` for your tool type (e.g., * **Create a new directory** under `internal/tools` for your tool type (e.g., `internal/tools/newdb/newdbtool`).
`internal/tools/newdb` or `internal/tools/newdb<tool_name>`).
* **Define a configuration struct** for your tool in a file named `newdbtool.go`. * **Define a configuration struct** for your tool in a file named `newdbtool.go`.
Create a `Config` struct and a `Tool` struct to store necessary parameters for Create a `Config` struct and a `Tool` struct to store necessary parameters for
tools. tools.
@@ -107,7 +106,7 @@ tools.
[`ToolConfig`](https://github.com/googleapis/genai-toolbox/blob/fd300dc606d88bf9f7bba689e2cee4e3565537dd/internal/tools/tools.go#L61) [`ToolConfig`](https://github.com/googleapis/genai-toolbox/blob/fd300dc606d88bf9f7bba689e2cee4e3565537dd/internal/tools/tools.go#L61)
interface**. This interface requires one method: interface**. This interface requires one method:
* `ToolConfigKind() string`: Returns a unique string identifier for your tool * `ToolConfigKind() string`: Returns a unique string identifier for your tool
(e.g., `"newdb"`). (e.g., `"newdb-tool"`).
* `Initialize(sources map[string]Source) (Tool, error)`: Creates a new * `Initialize(sources map[string]Source) (Tool, error)`: Creates a new
instance of your tool and validates that it can connect to the specified instance of your tool and validates that it can connect to the specified
data source. data source.
@@ -124,13 +123,13 @@ tools.
* `Authorized(services []string) bool`: Checks if the tool is authorized to * `Authorized(services []string) bool`: Checks if the tool is authorized to
run based on the provided authentication services. run based on the provided authentication services.
* **Implement `init()`** to register the new Tool. * **Implement `init()`** to register the new Tool.
* **Implement Unit Tests** in a file named `newdb_test.go`. * **Implement Unit Tests** in a file named `newdbtool_test.go`.
### Adding Integration Tests ### Adding Integration Tests
* **Add a test file** under a new directory `tests/newdb`. * **Add a test file** under a new directory `tests/newdb`.
* **Add pre-defined integration test suites** in the * **Add pre-defined integration test suites** in the
`/tests/newdb/newdb_test.go` that are **required** to be run as long as your `/tests/newdb/newdb_integration_test.go` that are **required** to be run as long as your
code contains related features. Please check each test suites for the config code contains related features. Please check each test suites for the config
defaults, if your source require test suites config updates, please refer to defaults, if your source require test suites config updates, please refer to
[config option](./tests/option.go): [config option](./tests/option.go):