This is page 3 of 45. Use http://codebase.md/googleapis/genai-toolbox?lines=true&page={x} to view the full context. # Directory Structure ``` ├── .ci │ ├── continuous.release.cloudbuild.yaml │ ├── generate_release_table.sh │ ├── integration.cloudbuild.yaml │ ├── quickstart_test │ │ ├── go.integration.cloudbuild.yaml │ │ ├── js.integration.cloudbuild.yaml │ │ ├── py.integration.cloudbuild.yaml │ │ ├── run_go_tests.sh │ │ ├── run_js_tests.sh │ │ ├── run_py_tests.sh │ │ └── setup_hotels_sample.sql │ ├── test_with_coverage.sh │ └── versioned.release.cloudbuild.yaml ├── .github │ ├── auto-label.yaml │ ├── blunderbuss.yml │ ├── CODEOWNERS │ ├── header-checker-lint.yml │ ├── ISSUE_TEMPLATE │ │ ├── bug_report.yml │ │ ├── config.yml │ │ ├── feature_request.yml │ │ └── question.yml │ ├── label-sync.yml │ ├── labels.yaml │ ├── PULL_REQUEST_TEMPLATE.md │ ├── release-please.yml │ ├── renovate.json5 │ ├── sync-repo-settings.yaml │ └── workflows │ ├── cloud_build_failure_reporter.yml │ ├── deploy_dev_docs.yaml │ ├── deploy_previous_version_docs.yaml │ ├── deploy_versioned_docs.yaml │ ├── docs_deploy.yaml │ ├── docs_preview_clean.yaml │ ├── docs_preview_deploy.yaml │ ├── lint.yaml │ ├── schedule_reporter.yml │ ├── sync-labels.yaml │ └── tests.yaml ├── .gitignore ├── .gitmodules ├── .golangci.yaml ├── .hugo │ ├── archetypes │ │ └── default.md │ ├── assets │ │ ├── icons │ │ │ └── logo.svg │ │ └── scss │ │ ├── _styles_project.scss │ │ └── _variables_project.scss │ ├── go.mod │ ├── go.sum │ ├── hugo.toml │ ├── layouts │ │ ├── _default │ │ │ └── home.releases.releases │ │ ├── index.llms-full.txt │ │ ├── index.llms.txt │ │ ├── partials │ │ │ ├── hooks │ │ │ │ └── head-end.html │ │ │ ├── navbar-version-selector.html │ │ │ ├── page-meta-links.html │ │ │ └── td │ │ │ └── render-heading.html │ │ ├── robot.txt │ │ └── shortcodes │ │ ├── include.html │ │ ├── ipynb.html │ │ └── regionInclude.html │ ├── package-lock.json │ ├── package.json │ └── static │ ├── favicons │ │ ├── android-chrome-192x192.png │ │ ├── android-chrome-512x512.png │ │ ├── apple-touch-icon.png │ │ ├── favicon-16x16.png │ │ ├── favicon-32x32.png │ │ └── favicon.ico │ └── js │ └── w3.js ├── CHANGELOG.md ├── cmd │ ├── options_test.go │ ├── options.go │ ├── root_test.go │ ├── root.go │ └── version.txt ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── DEVELOPER.md ├── Dockerfile ├── docs │ └── en │ ├── _index.md │ ├── about │ │ ├── _index.md │ │ └── faq.md │ ├── concepts │ │ ├── _index.md │ │ └── telemetry │ │ ├── index.md │ │ ├── telemetry_flow.png │ │ └── telemetry_traces.png │ ├── getting-started │ │ ├── _index.md │ │ ├── colab_quickstart.ipynb │ │ ├── configure.md │ │ ├── introduction │ │ │ ├── _index.md │ │ │ └── architecture.png │ │ ├── local_quickstart_go.md │ │ ├── local_quickstart_js.md │ │ ├── local_quickstart.md │ │ ├── mcp_quickstart │ │ │ ├── _index.md │ │ │ ├── inspector_tools.png │ │ │ └── inspector.png │ │ └── quickstart │ │ ├── go │ │ │ ├── genAI │ │ │ │ ├── go.mod │ │ │ │ ├── go.sum │ │ │ │ └── quickstart.go │ │ │ ├── genkit │ │ │ │ ├── go.mod │ │ │ │ ├── go.sum │ │ │ │ └── quickstart.go │ │ │ ├── langchain │ │ │ │ ├── go.mod │ │ │ │ ├── go.sum │ │ │ │ └── quickstart.go │ │ │ ├── openAI │ │ │ │ ├── go.mod │ │ │ │ ├── go.sum │ │ │ │ └── quickstart.go │ │ │ └── quickstart_test.go │ │ ├── golden.txt │ │ ├── js │ │ │ ├── genAI │ │ │ │ ├── package-lock.json │ │ │ │ ├── package.json │ │ │ │ └── quickstart.js │ │ │ ├── genkit │ │ │ │ ├── package-lock.json │ │ │ │ ├── package.json │ │ │ │ └── quickstart.js │ │ │ ├── langchain │ │ │ │ ├── package-lock.json │ │ │ │ ├── package.json │ │ │ │ └── quickstart.js │ │ │ ├── llamaindex │ │ │ │ ├── package-lock.json │ │ │ │ ├── package.json │ │ │ │ └── quickstart.js │ │ │ └── quickstart.test.js │ │ ├── python │ │ │ ├── __init__.py │ │ │ ├── adk │ │ │ │ ├── quickstart.py │ │ │ │ └── requirements.txt │ │ │ ├── core │ │ │ │ ├── quickstart.py │ │ │ │ └── requirements.txt │ │ │ ├── langchain │ │ │ │ ├── quickstart.py │ │ │ │ └── requirements.txt │ │ │ ├── llamaindex │ │ │ │ ├── quickstart.py │ │ │ │ └── requirements.txt │ │ │ └── quickstart_test.py │ │ └── shared │ │ ├── cloud_setup.md │ │ ├── configure_toolbox.md │ │ └── database_setup.md │ ├── how-to │ │ ├── _index.md │ │ ├── connect_via_geminicli.md │ │ ├── connect_via_mcp.md │ │ ├── connect-ide │ │ │ ├── _index.md │ │ │ ├── alloydb_pg_admin_mcp.md │ │ │ ├── alloydb_pg_mcp.md │ │ │ ├── bigquery_mcp.md │ │ │ ├── cloud_sql_mssql_admin_mcp.md │ │ │ ├── cloud_sql_mssql_mcp.md │ │ │ ├── cloud_sql_mysql_admin_mcp.md │ │ │ ├── cloud_sql_mysql_mcp.md │ │ │ ├── cloud_sql_pg_admin_mcp.md │ │ │ ├── cloud_sql_pg_mcp.md │ │ │ ├── firestore_mcp.md │ │ │ ├── looker_mcp.md │ │ │ ├── mssql_mcp.md │ │ │ ├── mysql_mcp.md │ │ │ ├── neo4j_mcp.md │ │ │ ├── postgres_mcp.md │ │ │ ├── spanner_mcp.md │ │ │ └── sqlite_mcp.md │ │ ├── deploy_docker.md │ │ ├── deploy_gke.md │ │ ├── deploy_toolbox.md │ │ ├── export_telemetry.md │ │ └── toolbox-ui │ │ ├── edit-headers.gif │ │ ├── edit-headers.png │ │ ├── index.md │ │ ├── optional-param-checked.png │ │ ├── optional-param-unchecked.png │ │ ├── run-tool.gif │ │ ├── tools.png │ │ └── toolsets.png │ ├── reference │ │ ├── _index.md │ │ ├── cli.md │ │ └── prebuilt-tools.md │ ├── resources │ │ ├── _index.md │ │ ├── authServices │ │ │ ├── _index.md │ │ │ └── google.md │ │ ├── sources │ │ │ ├── _index.md │ │ │ ├── alloydb-admin.md │ │ │ ├── alloydb-pg.md │ │ │ ├── bigquery.md │ │ │ ├── bigtable.md │ │ │ ├── cassandra.md │ │ │ ├── clickhouse.md │ │ │ ├── cloud-monitoring.md │ │ │ ├── cloud-sql-admin.md │ │ │ ├── cloud-sql-mssql.md │ │ │ ├── cloud-sql-mysql.md │ │ │ ├── cloud-sql-pg.md │ │ │ ├── couchbase.md │ │ │ ├── dataplex.md │ │ │ ├── dgraph.md │ │ │ ├── firebird.md │ │ │ ├── firestore.md │ │ │ ├── http.md │ │ │ ├── looker.md │ │ │ ├── mongodb.md │ │ │ ├── mssql.md │ │ │ ├── mysql.md │ │ │ ├── neo4j.md │ │ │ ├── oceanbase.md │ │ │ ├── oracle.md │ │ │ ├── postgres.md │ │ │ ├── redis.md │ │ │ ├── spanner.md │ │ │ ├── sqlite.md │ │ │ ├── tidb.md │ │ │ ├── trino.md │ │ │ ├── valkey.md │ │ │ └── yugabytedb.md │ │ └── tools │ │ ├── _index.md │ │ ├── alloydb │ │ │ ├── _index.md │ │ │ ├── alloydb-create-cluster.md │ │ │ ├── alloydb-create-instance.md │ │ │ ├── alloydb-create-user.md │ │ │ ├── alloydb-get-cluster.md │ │ │ ├── alloydb-get-instance.md │ │ │ ├── alloydb-get-user.md │ │ │ ├── alloydb-list-clusters.md │ │ │ ├── alloydb-list-instances.md │ │ │ ├── alloydb-list-users.md │ │ │ └── alloydb-wait-for-operation.md │ │ ├── alloydbainl │ │ │ ├── _index.md │ │ │ └── alloydb-ai-nl.md │ │ ├── bigquery │ │ │ ├── _index.md │ │ │ ├── bigquery-analyze-contribution.md │ │ │ ├── bigquery-conversational-analytics.md │ │ │ ├── bigquery-execute-sql.md │ │ │ ├── bigquery-forecast.md │ │ │ ├── bigquery-get-dataset-info.md │ │ │ ├── bigquery-get-table-info.md │ │ │ ├── bigquery-list-dataset-ids.md │ │ │ ├── bigquery-list-table-ids.md │ │ │ ├── bigquery-search-catalog.md │ │ │ └── bigquery-sql.md │ │ ├── bigtable │ │ │ ├── _index.md │ │ │ └── bigtable-sql.md │ │ ├── cassandra │ │ │ ├── _index.md │ │ │ └── cassandra-cql.md │ │ ├── clickhouse │ │ │ ├── _index.md │ │ │ ├── clickhouse-execute-sql.md │ │ │ ├── clickhouse-list-databases.md │ │ │ ├── clickhouse-list-tables.md │ │ │ └── clickhouse-sql.md │ │ ├── cloudmonitoring │ │ │ ├── _index.md │ │ │ └── cloud-monitoring-query-prometheus.md │ │ ├── cloudsql │ │ │ ├── _index.md │ │ │ ├── cloudsqlcreatedatabase.md │ │ │ ├── cloudsqlcreateusers.md │ │ │ ├── cloudsqlgetinstances.md │ │ │ ├── cloudsqllistdatabases.md │ │ │ ├── cloudsqllistinstances.md │ │ │ ├── cloudsqlmssqlcreateinstance.md │ │ │ ├── cloudsqlmysqlcreateinstance.md │ │ │ ├── cloudsqlpgcreateinstances.md │ │ │ └── cloudsqlwaitforoperation.md │ │ ├── couchbase │ │ │ ├── _index.md │ │ │ └── couchbase-sql.md │ │ ├── dataform │ │ │ ├── _index.md │ │ │ └── dataform-compile-local.md │ │ ├── dataplex │ │ │ ├── _index.md │ │ │ ├── dataplex-lookup-entry.md │ │ │ ├── dataplex-search-aspect-types.md │ │ │ └── dataplex-search-entries.md │ │ ├── dgraph │ │ │ ├── _index.md │ │ │ └── dgraph-dql.md │ │ ├── firebird │ │ │ ├── _index.md │ │ │ ├── firebird-execute-sql.md │ │ │ └── firebird-sql.md │ │ ├── firestore │ │ │ ├── _index.md │ │ │ ├── firestore-add-documents.md │ │ │ ├── firestore-delete-documents.md │ │ │ ├── firestore-get-documents.md │ │ │ ├── firestore-get-rules.md │ │ │ ├── firestore-list-collections.md │ │ │ ├── firestore-query-collection.md │ │ │ ├── firestore-query.md │ │ │ ├── firestore-update-document.md │ │ │ └── firestore-validate-rules.md │ │ ├── http │ │ │ ├── _index.md │ │ │ └── http.md │ │ ├── looker │ │ │ ├── _index.md │ │ │ ├── looker-add-dashboard-element.md │ │ │ ├── looker-conversational-analytics.md │ │ │ ├── looker-get-dashboards.md │ │ │ ├── looker-get-dimensions.md │ │ │ ├── looker-get-explores.md │ │ │ ├── looker-get-filters.md │ │ │ ├── looker-get-looks.md │ │ │ ├── looker-get-measures.md │ │ │ ├── looker-get-models.md │ │ │ ├── looker-get-parameters.md │ │ │ ├── looker-health-analyze.md │ │ │ ├── looker-health-pulse.md │ │ │ ├── looker-health-vacuum.md │ │ │ ├── looker-make-dashboard.md │ │ │ ├── looker-make-look.md │ │ │ ├── looker-query-sql.md │ │ │ ├── looker-query-url.md │ │ │ ├── looker-query.md │ │ │ └── looker-run-look.md │ │ ├── mongodb │ │ │ ├── _index.md │ │ │ ├── mongodb-aggregate.md │ │ │ ├── mongodb-delete-many.md │ │ │ ├── mongodb-delete-one.md │ │ │ ├── mongodb-find-one.md │ │ │ ├── mongodb-find.md │ │ │ ├── mongodb-insert-many.md │ │ │ ├── mongodb-insert-one.md │ │ │ ├── mongodb-update-many.md │ │ │ └── mongodb-update-one.md │ │ ├── mssql │ │ │ ├── _index.md │ │ │ ├── mssql-execute-sql.md │ │ │ ├── mssql-list-tables.md │ │ │ └── mssql-sql.md │ │ ├── mysql │ │ │ ├── _index.md │ │ │ ├── mysql-execute-sql.md │ │ │ ├── mysql-list-active-queries.md │ │ │ ├── mysql-list-table-fragmentation.md │ │ │ ├── mysql-list-tables-missing-unique-indexes.md │ │ │ ├── mysql-list-tables.md │ │ │ └── mysql-sql.md │ │ ├── neo4j │ │ │ ├── _index.md │ │ │ ├── neo4j-cypher.md │ │ │ ├── neo4j-execute-cypher.md │ │ │ └── neo4j-schema.md │ │ ├── oceanbase │ │ │ ├── _index.md │ │ │ ├── oceanbase-execute-sql.md │ │ │ └── oceanbase-sql.md │ │ ├── oracle │ │ │ ├── _index.md │ │ │ ├── oracle-execute-sql.md │ │ │ └── oracle-sql.md │ │ ├── postgres │ │ │ ├── _index.md │ │ │ ├── postgres-execute-sql.md │ │ │ ├── postgres-list-active-queries.md │ │ │ ├── postgres-list-available-extensions.md │ │ │ ├── postgres-list-installed-extensions.md │ │ │ ├── postgres-list-tables.md │ │ │ └── postgres-sql.md │ │ ├── redis │ │ │ ├── _index.md │ │ │ └── redis.md │ │ ├── spanner │ │ │ ├── _index.md │ │ │ ├── spanner-execute-sql.md │ │ │ ├── spanner-list-tables.md │ │ │ └── spanner-sql.md │ │ ├── sqlite │ │ │ ├── _index.md │ │ │ ├── sqlite-execute-sql.md │ │ │ └── sqlite-sql.md │ │ ├── tidb │ │ │ ├── _index.md │ │ │ ├── tidb-execute-sql.md │ │ │ └── tidb-sql.md │ │ ├── trino │ │ │ ├── _index.md │ │ │ ├── trino-execute-sql.md │ │ │ └── trino-sql.md │ │ ├── utility │ │ │ ├── _index.md │ │ │ └── wait.md │ │ ├── valkey │ │ │ ├── _index.md │ │ │ └── valkey.md │ │ └── yuagbytedb │ │ ├── _index.md │ │ └── yugabytedb-sql.md │ ├── samples │ │ ├── _index.md │ │ ├── alloydb │ │ │ ├── _index.md │ │ │ ├── ai-nl │ │ │ │ ├── alloydb_ai_nl.ipynb │ │ │ │ └── index.md │ │ │ └── mcp_quickstart.md │ │ ├── bigquery │ │ │ ├── _index.md │ │ │ ├── colab_quickstart_bigquery.ipynb │ │ │ ├── local_quickstart.md │ │ │ └── mcp_quickstart │ │ │ ├── _index.md │ │ │ ├── inspector_tools.png │ │ │ └── inspector.png │ │ └── looker │ │ ├── _index.md │ │ ├── looker_gemini_oauth │ │ │ ├── _index.md │ │ │ ├── authenticated.png │ │ │ ├── authorize.png │ │ │ └── registration.png │ │ ├── looker_gemini.md │ │ └── looker_mcp_inspector │ │ ├── _index.md │ │ ├── inspector_tools.png │ │ └── inspector.png │ └── sdks │ ├── _index.md │ ├── go-sdk.md │ ├── js-sdk.md │ └── python-sdk.md ├── go.mod ├── go.sum ├── internal │ ├── auth │ │ ├── auth.go │ │ └── google │ │ └── google.go │ ├── log │ │ ├── handler.go │ │ ├── log_test.go │ │ ├── log.go │ │ └── logger.go │ ├── prebuiltconfigs │ │ ├── prebuiltconfigs_test.go │ │ ├── prebuiltconfigs.go │ │ └── tools │ │ ├── alloydb-postgres-admin.yaml │ │ ├── alloydb-postgres-observability.yaml │ │ ├── alloydb-postgres.yaml │ │ ├── bigquery.yaml │ │ ├── clickhouse.yaml │ │ ├── cloud-sql-mssql-admin.yaml │ │ ├── cloud-sql-mssql-observability.yaml │ │ ├── cloud-sql-mssql.yaml │ │ ├── cloud-sql-mysql-admin.yaml │ │ ├── cloud-sql-mysql-observability.yaml │ │ ├── cloud-sql-mysql.yaml │ │ ├── cloud-sql-postgres-admin.yaml │ │ ├── cloud-sql-postgres-observability.yaml │ │ ├── cloud-sql-postgres.yaml │ │ ├── dataplex.yaml │ │ ├── firestore.yaml │ │ ├── looker-conversational-analytics.yaml │ │ ├── looker.yaml │ │ ├── mssql.yaml │ │ ├── mysql.yaml │ │ ├── neo4j.yaml │ │ ├── oceanbase.yaml │ │ ├── postgres.yaml │ │ ├── spanner-postgres.yaml │ │ ├── spanner.yaml │ │ └── sqlite.yaml │ ├── server │ │ ├── api_test.go │ │ ├── api.go │ │ ├── common_test.go │ │ ├── config.go │ │ ├── mcp │ │ │ ├── jsonrpc │ │ │ │ ├── jsonrpc_test.go │ │ │ │ └── jsonrpc.go │ │ │ ├── mcp.go │ │ │ ├── util │ │ │ │ └── lifecycle.go │ │ │ ├── v20241105 │ │ │ │ ├── method.go │ │ │ │ └── types.go │ │ │ ├── v20250326 │ │ │ │ ├── method.go │ │ │ │ └── types.go │ │ │ └── v20250618 │ │ │ ├── method.go │ │ │ └── types.go │ │ ├── mcp_test.go │ │ ├── mcp.go │ │ ├── server_test.go │ │ ├── server.go │ │ ├── static │ │ │ ├── assets │ │ │ │ └── mcptoolboxlogo.png │ │ │ ├── css │ │ │ │ └── style.css │ │ │ ├── index.html │ │ │ ├── js │ │ │ │ ├── auth.js │ │ │ │ ├── loadTools.js │ │ │ │ ├── mainContent.js │ │ │ │ ├── navbar.js │ │ │ │ ├── runTool.js │ │ │ │ ├── toolDisplay.js │ │ │ │ ├── tools.js │ │ │ │ └── toolsets.js │ │ │ ├── tools.html │ │ │ └── toolsets.html │ │ ├── web_test.go │ │ └── web.go │ ├── sources │ │ ├── alloydbadmin │ │ │ ├── alloydbadmin_test.go │ │ │ └── alloydbadmin.go │ │ ├── alloydbpg │ │ │ ├── alloydb_pg_test.go │ │ │ └── alloydb_pg.go │ │ ├── bigquery │ │ │ ├── bigquery_test.go │ │ │ └── bigquery.go │ │ ├── bigtable │ │ │ ├── bigtable_test.go │ │ │ └── bigtable.go │ │ ├── cassandra │ │ │ ├── cassandra_test.go │ │ │ └── cassandra.go │ │ ├── clickhouse │ │ │ ├── clickhouse_test.go │ │ │ └── clickhouse.go │ │ ├── cloudmonitoring │ │ │ ├── cloud_monitoring_test.go │ │ │ └── cloud_monitoring.go │ │ ├── cloudsqladmin │ │ │ ├── cloud_sql_admin_test.go │ │ │ └── cloud_sql_admin.go │ │ ├── cloudsqlmssql │ │ │ ├── cloud_sql_mssql_test.go │ │ │ └── cloud_sql_mssql.go │ │ ├── cloudsqlmysql │ │ │ ├── cloud_sql_mysql_test.go │ │ │ └── cloud_sql_mysql.go │ │ ├── cloudsqlpg │ │ │ ├── cloud_sql_pg_test.go │ │ │ └── cloud_sql_pg.go │ │ ├── couchbase │ │ │ ├── couchbase_test.go │ │ │ └── couchbase.go │ │ ├── dataplex │ │ │ ├── dataplex_test.go │ │ │ └── dataplex.go │ │ ├── dgraph │ │ │ ├── dgraph_test.go │ │ │ └── dgraph.go │ │ ├── dialect.go │ │ ├── firebird │ │ │ ├── firebird_test.go │ │ │ └── firebird.go │ │ ├── firestore │ │ │ ├── firestore_test.go │ │ │ └── firestore.go │ │ ├── http │ │ │ ├── http_test.go │ │ │ └── http.go │ │ ├── ip_type.go │ │ ├── looker │ │ │ ├── looker_test.go │ │ │ └── looker.go │ │ ├── mongodb │ │ │ ├── mongodb_test.go │ │ │ └── mongodb.go │ │ ├── mssql │ │ │ ├── mssql_test.go │ │ │ └── mssql.go │ │ ├── mysql │ │ │ ├── mysql_test.go │ │ │ └── mysql.go │ │ ├── neo4j │ │ │ ├── neo4j_test.go │ │ │ └── neo4j.go │ │ ├── oceanbase │ │ │ ├── oceanbase_test.go │ │ │ └── oceanbase.go │ │ ├── oracle │ │ │ └── oracle.go │ │ ├── postgres │ │ │ ├── postgres_test.go │ │ │ └── postgres.go │ │ ├── redis │ │ │ ├── redis_test.go │ │ │ └── redis.go │ │ ├── sources.go │ │ ├── spanner │ │ │ ├── spanner_test.go │ │ │ └── spanner.go │ │ ├── sqlite │ │ │ ├── sqlite_test.go │ │ │ └── sqlite.go │ │ ├── tidb │ │ │ ├── tidb_test.go │ │ │ └── tidb.go │ │ ├── trino │ │ │ ├── trino_test.go │ │ │ └── trino.go │ │ ├── util.go │ │ ├── valkey │ │ │ ├── valkey_test.go │ │ │ └── valkey.go │ │ └── yugabytedb │ │ ├── yugabytedb_test.go │ │ └── yugabytedb.go │ ├── telemetry │ │ ├── instrumentation.go │ │ └── telemetry.go │ ├── testutils │ │ └── testutils.go │ ├── tools │ │ ├── alloydb │ │ │ ├── alloydbcreatecluster │ │ │ │ ├── alloydbcreatecluster_test.go │ │ │ │ └── alloydbcreatecluster.go │ │ │ ├── alloydbcreateinstance │ │ │ │ ├── alloydbcreateinstance_test.go │ │ │ │ └── alloydbcreateinstance.go │ │ │ ├── alloydbcreateuser │ │ │ │ ├── alloydbcreateuser_test.go │ │ │ │ └── alloydbcreateuser.go │ │ │ ├── alloydbgetcluster │ │ │ │ ├── alloydbgetcluster_test.go │ │ │ │ └── alloydbgetcluster.go │ │ │ ├── alloydbgetinstance │ │ │ │ ├── alloydbgetinstance_test.go │ │ │ │ └── alloydbgetinstance.go │ │ │ ├── alloydbgetuser │ │ │ │ ├── alloydbgetuser_test.go │ │ │ │ └── alloydbgetuser.go │ │ │ ├── alloydblistclusters │ │ │ │ ├── alloydblistclusters_test.go │ │ │ │ └── alloydblistclusters.go │ │ │ ├── alloydblistinstances │ │ │ │ ├── alloydblistinstances_test.go │ │ │ │ └── alloydblistinstances.go │ │ │ ├── alloydblistusers │ │ │ │ ├── alloydblistusers_test.go │ │ │ │ └── alloydblistusers.go │ │ │ └── alloydbwaitforoperation │ │ │ ├── alloydbwaitforoperation_test.go │ │ │ └── alloydbwaitforoperation.go │ │ ├── alloydbainl │ │ │ ├── alloydbainl_test.go │ │ │ └── alloydbainl.go │ │ ├── bigquery │ │ │ ├── bigqueryanalyzecontribution │ │ │ │ ├── bigqueryanalyzecontribution_test.go │ │ │ │ └── bigqueryanalyzecontribution.go │ │ │ ├── bigquerycommon │ │ │ │ ├── table_name_parser_test.go │ │ │ │ ├── table_name_parser.go │ │ │ │ └── util.go │ │ │ ├── bigqueryconversationalanalytics │ │ │ │ ├── bigqueryconversationalanalytics_test.go │ │ │ │ └── bigqueryconversationalanalytics.go │ │ │ ├── bigqueryexecutesql │ │ │ │ ├── bigqueryexecutesql_test.go │ │ │ │ └── bigqueryexecutesql.go │ │ │ ├── bigqueryforecast │ │ │ │ ├── bigqueryforecast_test.go │ │ │ │ └── bigqueryforecast.go │ │ │ ├── bigquerygetdatasetinfo │ │ │ │ ├── bigquerygetdatasetinfo_test.go │ │ │ │ └── bigquerygetdatasetinfo.go │ │ │ ├── bigquerygettableinfo │ │ │ │ ├── bigquerygettableinfo_test.go │ │ │ │ └── bigquerygettableinfo.go │ │ │ ├── bigquerylistdatasetids │ │ │ │ ├── bigquerylistdatasetids_test.go │ │ │ │ └── bigquerylistdatasetids.go │ │ │ ├── bigquerylisttableids │ │ │ │ ├── bigquerylisttableids_test.go │ │ │ │ └── bigquerylisttableids.go │ │ │ ├── bigquerysearchcatalog │ │ │ │ ├── bigquerysearchcatalog_test.go │ │ │ │ └── bigquerysearchcatalog.go │ │ │ └── bigquerysql │ │ │ ├── bigquerysql_test.go │ │ │ └── bigquerysql.go │ │ ├── bigtable │ │ │ ├── bigtable_test.go │ │ │ └── bigtable.go │ │ ├── cassandra │ │ │ └── cassandracql │ │ │ ├── cassandracql_test.go │ │ │ └── cassandracql.go │ │ ├── clickhouse │ │ │ ├── clickhouseexecutesql │ │ │ │ ├── clickhouseexecutesql_test.go │ │ │ │ └── clickhouseexecutesql.go │ │ │ ├── clickhouselistdatabases │ │ │ │ ├── clickhouselistdatabases_test.go │ │ │ │ └── clickhouselistdatabases.go │ │ │ ├── clickhouselisttables │ │ │ │ ├── clickhouselisttables_test.go │ │ │ │ └── clickhouselisttables.go │ │ │ └── clickhousesql │ │ │ ├── clickhousesql_test.go │ │ │ └── clickhousesql.go │ │ ├── cloudmonitoring │ │ │ ├── cloudmonitoring_test.go │ │ │ └── cloudmonitoring.go │ │ ├── cloudsql │ │ │ ├── cloudsqlcreatedatabase │ │ │ │ ├── cloudsqlcreatedatabase_test.go │ │ │ │ └── cloudsqlcreatedatabase.go │ │ │ ├── cloudsqlcreateusers │ │ │ │ ├── cloudsqlcreateusers_test.go │ │ │ │ └── cloudsqlcreateusers.go │ │ │ ├── cloudsqlgetinstances │ │ │ │ ├── cloudsqlgetinstances_test.go │ │ │ │ └── cloudsqlgetinstances.go │ │ │ ├── cloudsqllistdatabases │ │ │ │ ├── cloudsqllistdatabases_test.go │ │ │ │ └── cloudsqllistdatabases.go │ │ │ ├── cloudsqllistinstances │ │ │ │ ├── cloudsqllistinstances_test.go │ │ │ │ └── cloudsqllistinstances.go │ │ │ └── cloudsqlwaitforoperation │ │ │ ├── cloudsqlwaitforoperation_test.go │ │ │ └── cloudsqlwaitforoperation.go │ │ ├── cloudsqlmssql │ │ │ └── cloudsqlmssqlcreateinstance │ │ │ ├── cloudsqlmssqlcreateinstance_test.go │ │ │ └── cloudsqlmssqlcreateinstance.go │ │ ├── cloudsqlmysql │ │ │ └── cloudsqlmysqlcreateinstance │ │ │ ├── cloudsqlmysqlcreateinstance_test.go │ │ │ └── cloudsqlmysqlcreateinstance.go │ │ ├── cloudsqlpg │ │ │ └── cloudsqlpgcreateinstances │ │ │ ├── cloudsqlpgcreateinstances_test.go │ │ │ └── cloudsqlpgcreateinstances.go │ │ ├── common_test.go │ │ ├── common.go │ │ ├── couchbase │ │ │ ├── couchbase_test.go │ │ │ └── couchbase.go │ │ ├── dataform │ │ │ └── dataformcompilelocal │ │ │ ├── dataformcompilelocal_test.go │ │ │ └── dataformcompilelocal.go │ │ ├── dataplex │ │ │ ├── dataplexlookupentry │ │ │ │ ├── dataplexlookupentry_test.go │ │ │ │ └── dataplexlookupentry.go │ │ │ ├── dataplexsearchaspecttypes │ │ │ │ ├── dataplexsearchaspecttypes_test.go │ │ │ │ └── dataplexsearchaspecttypes.go │ │ │ └── dataplexsearchentries │ │ │ ├── dataplexsearchentries_test.go │ │ │ └── dataplexsearchentries.go │ │ ├── dgraph │ │ │ ├── dgraph_test.go │ │ │ └── dgraph.go │ │ ├── firebird │ │ │ ├── firebirdexecutesql │ │ │ │ ├── firebirdexecutesql_test.go │ │ │ │ └── firebirdexecutesql.go │ │ │ └── firebirdsql │ │ │ ├── firebirdsql_test.go │ │ │ └── firebirdsql.go │ │ ├── firestore │ │ │ ├── firestoreadddocuments │ │ │ │ ├── firestoreadddocuments_test.go │ │ │ │ └── firestoreadddocuments.go │ │ │ ├── firestoredeletedocuments │ │ │ │ ├── firestoredeletedocuments_test.go │ │ │ │ └── firestoredeletedocuments.go │ │ │ ├── firestoregetdocuments │ │ │ │ ├── firestoregetdocuments_test.go │ │ │ │ └── firestoregetdocuments.go │ │ │ ├── firestoregetrules │ │ │ │ ├── firestoregetrules_test.go │ │ │ │ └── firestoregetrules.go │ │ │ ├── firestorelistcollections │ │ │ │ ├── firestorelistcollections_test.go │ │ │ │ └── firestorelistcollections.go │ │ │ ├── firestorequery │ │ │ │ ├── firestorequery_test.go │ │ │ │ └── firestorequery.go │ │ │ ├── firestorequerycollection │ │ │ │ ├── firestorequerycollection_test.go │ │ │ │ └── firestorequerycollection.go │ │ │ ├── firestoreupdatedocument │ │ │ │ ├── firestoreupdatedocument_test.go │ │ │ │ └── firestoreupdatedocument.go │ │ │ ├── firestorevalidaterules │ │ │ │ ├── firestorevalidaterules_test.go │ │ │ │ └── firestorevalidaterules.go │ │ │ └── util │ │ │ ├── converter_test.go │ │ │ ├── converter.go │ │ │ ├── validator_test.go │ │ │ └── validator.go │ │ ├── http │ │ │ ├── http_test.go │ │ │ └── http.go │ │ ├── http_method.go │ │ ├── looker │ │ │ ├── lookeradddashboardelement │ │ │ │ ├── lookeradddashboardelement_test.go │ │ │ │ └── lookeradddashboardelement.go │ │ │ ├── lookercommon │ │ │ │ ├── lookercommon_test.go │ │ │ │ └── lookercommon.go │ │ │ ├── lookerconversationalanalytics │ │ │ │ ├── lookerconversationalanalytics_test.go │ │ │ │ └── lookerconversationalanalytics.go │ │ │ ├── lookergetdashboards │ │ │ │ ├── lookergetdashboards_test.go │ │ │ │ └── lookergetdashboards.go │ │ │ ├── lookergetdimensions │ │ │ │ ├── lookergetdimensions_test.go │ │ │ │ └── lookergetdimensions.go │ │ │ ├── lookergetexplores │ │ │ │ ├── lookergetexplores_test.go │ │ │ │ └── lookergetexplores.go │ │ │ ├── lookergetfilters │ │ │ │ ├── lookergetfilters_test.go │ │ │ │ └── lookergetfilters.go │ │ │ ├── lookergetlooks │ │ │ │ ├── lookergetlooks_test.go │ │ │ │ └── lookergetlooks.go │ │ │ ├── lookergetmeasures │ │ │ │ ├── lookergetmeasures_test.go │ │ │ │ └── lookergetmeasures.go │ │ │ ├── lookergetmodels │ │ │ │ ├── lookergetmodels_test.go │ │ │ │ └── lookergetmodels.go │ │ │ ├── lookergetparameters │ │ │ │ ├── lookergetparameters_test.go │ │ │ │ └── lookergetparameters.go │ │ │ ├── lookerhealthanalyze │ │ │ │ ├── lookerhealthanalyze_test.go │ │ │ │ └── lookerhealthanalyze.go │ │ │ ├── lookerhealthpulse │ │ │ │ ├── lookerhealthpulse_test.go │ │ │ │ └── lookerhealthpulse.go │ │ │ ├── lookerhealthvacuum │ │ │ │ ├── lookerhealthvacuum_test.go │ │ │ │ └── lookerhealthvacuum.go │ │ │ ├── lookermakedashboard │ │ │ │ ├── lookermakedashboard_test.go │ │ │ │ └── lookermakedashboard.go │ │ │ ├── lookermakelook │ │ │ │ ├── lookermakelook_test.go │ │ │ │ └── lookermakelook.go │ │ │ ├── lookerquery │ │ │ │ ├── lookerquery_test.go │ │ │ │ └── lookerquery.go │ │ │ ├── lookerquerysql │ │ │ │ ├── lookerquerysql_test.go │ │ │ │ └── lookerquerysql.go │ │ │ ├── lookerqueryurl │ │ │ │ ├── lookerqueryurl_test.go │ │ │ │ └── lookerqueryurl.go │ │ │ └── lookerrunlook │ │ │ ├── lookerrunlook_test.go │ │ │ └── lookerrunlook.go │ │ ├── mongodb │ │ │ ├── mongodbaggregate │ │ │ │ ├── mongodbaggregate_test.go │ │ │ │ └── mongodbaggregate.go │ │ │ ├── mongodbdeletemany │ │ │ │ ├── mongodbdeletemany_test.go │ │ │ │ └── mongodbdeletemany.go │ │ │ ├── mongodbdeleteone │ │ │ │ ├── mongodbdeleteone_test.go │ │ │ │ └── mongodbdeleteone.go │ │ │ ├── mongodbfind │ │ │ │ ├── mongodbfind_test.go │ │ │ │ └── mongodbfind.go │ │ │ ├── mongodbfindone │ │ │ │ ├── mongodbfindone_test.go │ │ │ │ └── mongodbfindone.go │ │ │ ├── mongodbinsertmany │ │ │ │ ├── mongodbinsertmany_test.go │ │ │ │ └── mongodbinsertmany.go │ │ │ ├── mongodbinsertone │ │ │ │ ├── mongodbinsertone_test.go │ │ │ │ └── mongodbinsertone.go │ │ │ ├── mongodbupdatemany │ │ │ │ ├── mongodbupdatemany_test.go │ │ │ │ └── mongodbupdatemany.go │ │ │ └── mongodbupdateone │ │ │ ├── mongodbupdateone_test.go │ │ │ └── mongodbupdateone.go │ │ ├── mssql │ │ │ ├── mssqlexecutesql │ │ │ │ ├── mssqlexecutesql_test.go │ │ │ │ └── mssqlexecutesql.go │ │ │ ├── mssqllisttables │ │ │ │ ├── mssqllisttables_test.go │ │ │ │ └── mssqllisttables.go │ │ │ └── mssqlsql │ │ │ ├── mssqlsql_test.go │ │ │ └── mssqlsql.go │ │ ├── mysql │ │ │ ├── mysqlcommon │ │ │ │ └── mysqlcommon.go │ │ │ ├── mysqlexecutesql │ │ │ │ ├── mysqlexecutesql_test.go │ │ │ │ └── mysqlexecutesql.go │ │ │ ├── mysqllistactivequeries │ │ │ │ ├── mysqllistactivequeries_test.go │ │ │ │ └── mysqllistactivequeries.go │ │ │ ├── mysqllisttablefragmentation │ │ │ │ ├── mysqllisttablefragmentation_test.go │ │ │ │ └── mysqllisttablefragmentation.go │ │ │ ├── mysqllisttables │ │ │ │ ├── mysqllisttables_test.go │ │ │ │ └── mysqllisttables.go │ │ │ ├── mysqllisttablesmissinguniqueindexes │ │ │ │ ├── mysqllisttablesmissinguniqueindexes_test.go │ │ │ │ └── mysqllisttablesmissinguniqueindexes.go │ │ │ └── mysqlsql │ │ │ ├── mysqlsql_test.go │ │ │ └── mysqlsql.go │ │ ├── neo4j │ │ │ ├── neo4jcypher │ │ │ │ ├── neo4jcypher_test.go │ │ │ │ └── neo4jcypher.go │ │ │ ├── neo4jexecutecypher │ │ │ │ ├── classifier │ │ │ │ │ ├── classifier_test.go │ │ │ │ │ └── classifier.go │ │ │ │ ├── neo4jexecutecypher_test.go │ │ │ │ └── neo4jexecutecypher.go │ │ │ └── neo4jschema │ │ │ ├── cache │ │ │ │ ├── cache_test.go │ │ │ │ └── cache.go │ │ │ ├── helpers │ │ │ │ ├── helpers_test.go │ │ │ │ └── helpers.go │ │ │ ├── neo4jschema_test.go │ │ │ ├── neo4jschema.go │ │ │ └── types │ │ │ └── types.go │ │ ├── oceanbase │ │ │ ├── oceanbaseexecutesql │ │ │ │ ├── oceanbaseexecutesql_test.go │ │ │ │ └── oceanbaseexecutesql.go │ │ │ └── oceanbasesql │ │ │ ├── oceanbasesql_test.go │ │ │ └── oceanbasesql.go │ │ ├── oracle │ │ │ ├── oracleexecutesql │ │ │ │ └── oracleexecutesql.go │ │ │ └── oraclesql │ │ │ └── oraclesql.go │ │ ├── parameters_test.go │ │ ├── parameters.go │ │ ├── postgres │ │ │ ├── postgresexecutesql │ │ │ │ ├── postgresexecutesql_test.go │ │ │ │ └── postgresexecutesql.go │ │ │ ├── postgreslistactivequeries │ │ │ │ ├── postgreslistactivequeries_test.go │ │ │ │ └── postgreslistactivequeries.go │ │ │ ├── postgreslistavailableextensions │ │ │ │ ├── postgreslistavailableextensions_test.go │ │ │ │ └── postgreslistavailableextensions.go │ │ │ ├── postgreslistinstalledextensions │ │ │ │ ├── postgreslistinstalledextensions_test.go │ │ │ │ └── postgreslistinstalledextensions.go │ │ │ ├── postgreslisttables │ │ │ │ ├── postgreslisttables_test.go │ │ │ │ └── postgreslisttables.go │ │ │ └── postgressql │ │ │ ├── postgressql_test.go │ │ │ └── postgressql.go │ │ ├── redis │ │ │ ├── redis_test.go │ │ │ └── redis.go │ │ ├── spanner │ │ │ ├── spannerexecutesql │ │ │ │ ├── spannerexecutesql_test.go │ │ │ │ └── spannerexecutesql.go │ │ │ ├── spannerlisttables │ │ │ │ ├── spannerlisttables_test.go │ │ │ │ └── spannerlisttables.go │ │ │ └── spannersql │ │ │ ├── spanner_test.go │ │ │ └── spannersql.go │ │ ├── sqlite │ │ │ ├── sqliteexecutesql │ │ │ │ ├── sqliteexecutesql_test.go │ │ │ │ └── sqliteexecutesql.go │ │ │ └── sqlitesql │ │ │ ├── sqlitesql_test.go │ │ │ └── sqlitesql.go │ │ ├── tidb │ │ │ ├── tidbexecutesql │ │ │ │ ├── tidbexecutesql_test.go │ │ │ │ └── tidbexecutesql.go │ │ │ └── tidbsql │ │ │ ├── tidbsql_test.go │ │ │ └── tidbsql.go │ │ ├── tools_test.go │ │ ├── tools.go │ │ ├── toolsets.go │ │ ├── trino │ │ │ ├── trinoexecutesql │ │ │ │ ├── trinoexecutesql_test.go │ │ │ │ └── trinoexecutesql.go │ │ │ └── trinosql │ │ │ ├── trinosql_test.go │ │ │ └── trinosql.go │ │ ├── utility │ │ │ └── wait │ │ │ ├── wait_test.go │ │ │ └── wait.go │ │ ├── valkey │ │ │ ├── valkey_test.go │ │ │ └── valkey.go │ │ └── yugabytedbsql │ │ ├── yugabytedbsql_test.go │ │ └── yugabytedbsql.go │ └── util │ └── util.go ├── LICENSE ├── logo.png ├── main.go ├── README.md └── tests ├── alloydb │ ├── alloydb_integration_test.go │ └── alloydb_wait_for_operation_test.go ├── alloydbainl │ └── alloydb_ai_nl_integration_test.go ├── alloydbpg │ └── alloydb_pg_integration_test.go ├── auth.go ├── bigquery │ └── bigquery_integration_test.go ├── bigtable │ └── bigtable_integration_test.go ├── cassandra │ └── cassandra_integration_test.go ├── clickhouse │ └── clickhouse_integration_test.go ├── cloudmonitoring │ └── cloud_monitoring_integration_test.go ├── cloudsql │ ├── cloud_sql_create_database_test.go │ ├── cloud_sql_create_users_test.go │ ├── cloud_sql_get_instances_test.go │ ├── cloud_sql_list_databases_test.go │ ├── cloudsql_list_instances_test.go │ └── cloudsql_wait_for_operation_test.go ├── cloudsqlmssql │ ├── cloud_sql_mssql_create_instance_integration_test.go │ └── cloud_sql_mssql_integration_test.go ├── cloudsqlmysql │ ├── cloud_sql_mysql_create_instance_integration_test.go │ └── cloud_sql_mysql_integration_test.go ├── cloudsqlpg │ ├── cloud_sql_pg_create_instances_test.go │ └── cloud_sql_pg_integration_test.go ├── common.go ├── couchbase │ └── couchbase_integration_test.go ├── dataform │ └── dataform_integration_test.go ├── dataplex │ └── dataplex_integration_test.go ├── dgraph │ └── dgraph_integration_test.go ├── firebird │ └── firebird_integration_test.go ├── firestore │ └── firestore_integration_test.go ├── http │ └── http_integration_test.go ├── looker │ └── looker_integration_test.go ├── mongodb │ └── mongodb_integration_test.go ├── mssql │ └── mssql_integration_test.go ├── mysql │ └── mysql_integration_test.go ├── neo4j │ └── neo4j_integration_test.go ├── oceanbase │ └── oceanbase_integration_test.go ├── option.go ├── oracle │ └── oracle_integration_test.go ├── postgres │ └── postgres_integration_test.go ├── redis │ └── redis_test.go ├── server.go ├── source.go ├── spanner │ └── spanner_integration_test.go ├── sqlite │ └── sqlite_integration_test.go ├── tidb │ └── tidb_integration_test.go ├── tool.go ├── trino │ └── trino_integration_test.go ├── utility │ └── wait_integration_test.go ├── valkey │ └── valkey_test.go └── yugabytedb └── yugabytedb_integration_test.go ``` # Files -------------------------------------------------------------------------------- /internal/tools/cloudsql/cloudsqllistdatabases/cloudsqllistdatabases_test.go: -------------------------------------------------------------------------------- ```go 1 | // Copyright 2025 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cloudsqllistdatabases_test 16 | 17 | import ( 18 | "testing" 19 | 20 | "github.com/goccy/go-yaml" 21 | "github.com/google/go-cmp/cmp" 22 | "github.com/googleapis/genai-toolbox/internal/server" 23 | "github.com/googleapis/genai-toolbox/internal/testutils" 24 | "github.com/googleapis/genai-toolbox/internal/tools/cloudsql/cloudsqllistdatabases" 25 | ) 26 | 27 | func TestParseFromYaml(t *testing.T) { 28 | ctx, err := testutils.ContextWithNewLogger() 29 | if err != nil { 30 | t.Fatalf("unexpected error: %s", err) 31 | } 32 | tcs := []struct { 33 | desc string 34 | in string 35 | want server.ToolConfigs 36 | }{ 37 | { 38 | desc: "basic example", 39 | in: ` 40 | tools: 41 | list-my-databases: 42 | kind: cloud-sql-list-databases 43 | description: some description 44 | source: some-source 45 | `, 46 | want: server.ToolConfigs{ 47 | "list-my-databases": cloudsqllistdatabases.Config{ 48 | Name: "list-my-databases", 49 | Kind: "cloud-sql-list-databases", 50 | Description: "some description", 51 | AuthRequired: []string{}, 52 | Source: "some-source", 53 | }, 54 | }, 55 | }, 56 | } 57 | for _, tc := range tcs { 58 | t.Run(tc.desc, func(t *testing.T) { 59 | got := struct { 60 | Tools server.ToolConfigs `yaml:"tools"` 61 | }{} 62 | // Parse contents 63 | err := yaml.UnmarshalContext(ctx, testutils.FormatYaml(tc.in), &got) 64 | if err != nil { 65 | t.Fatalf("unable to unmarshal: %s", err) 66 | } 67 | if diff := cmp.Diff(tc.want, got.Tools); diff != "" { 68 | t.Fatalf("incorrect parse: diff %v", diff) 69 | } 70 | }) 71 | } 72 | } 73 | ``` -------------------------------------------------------------------------------- /internal/tools/bigquery/bigquerysearchcatalog/bigquerysearchcatalog_test.go: -------------------------------------------------------------------------------- ```go 1 | // Copyright 2025 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package bigquerysearchcatalog_test 16 | 17 | import ( 18 | "testing" 19 | 20 | yaml "github.com/goccy/go-yaml" 21 | "github.com/google/go-cmp/cmp" 22 | "github.com/googleapis/genai-toolbox/internal/server" 23 | "github.com/googleapis/genai-toolbox/internal/testutils" 24 | "github.com/googleapis/genai-toolbox/internal/tools/bigquery/bigquerysearchcatalog" 25 | ) 26 | 27 | func TestParseFromYamlBigQuerySearch(t *testing.T) { 28 | ctx, err := testutils.ContextWithNewLogger() 29 | if err != nil { 30 | t.Fatalf("unexpected error: %s", err) 31 | } 32 | tcs := []struct { 33 | desc string 34 | in string 35 | want server.ToolConfigs 36 | }{ 37 | { 38 | desc: "basic example", 39 | in: ` 40 | tools: 41 | example_tool: 42 | kind: bigquery-search-catalog 43 | source: my-instance 44 | description: some description 45 | `, 46 | want: server.ToolConfigs{ 47 | "example_tool": bigquerysearchcatalog.Config{ 48 | Name: "example_tool", 49 | Kind: "bigquery-search-catalog", 50 | Source: "my-instance", 51 | Description: "some description", 52 | AuthRequired: []string{}, 53 | }, 54 | }, 55 | }, 56 | } 57 | for _, tc := range tcs { 58 | t.Run(tc.desc, func(t *testing.T) { 59 | got := struct { 60 | Tools server.ToolConfigs `yaml:"tools"` 61 | }{} 62 | // Parse contents 63 | err := yaml.UnmarshalContext(ctx, testutils.FormatYaml(tc.in), &got) 64 | if err != nil { 65 | t.Fatalf("unable to unmarshal: %s", err) 66 | } 67 | if diff := cmp.Diff(tc.want, got.Tools); diff != "" { 68 | t.Fatalf("incorrect parse: diff %v", diff) 69 | } 70 | }) 71 | } 72 | } 73 | ``` -------------------------------------------------------------------------------- /internal/tools/bigquery/bigquerygettableinfo/bigquerygettableinfo_test.go: -------------------------------------------------------------------------------- ```go 1 | // Copyright 2025 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package bigquerygettableinfo_test 16 | 17 | import ( 18 | "testing" 19 | 20 | yaml "github.com/goccy/go-yaml" 21 | "github.com/google/go-cmp/cmp" 22 | "github.com/googleapis/genai-toolbox/internal/server" 23 | "github.com/googleapis/genai-toolbox/internal/testutils" 24 | "github.com/googleapis/genai-toolbox/internal/tools/bigquery/bigquerygettableinfo" 25 | ) 26 | 27 | func TestParseFromYamlBigQueryGetTableInfo(t *testing.T) { 28 | ctx, err := testutils.ContextWithNewLogger() 29 | if err != nil { 30 | t.Fatalf("unexpected error: %s", err) 31 | } 32 | tcs := []struct { 33 | desc string 34 | in string 35 | want server.ToolConfigs 36 | }{ 37 | { 38 | desc: "basic example", 39 | in: ` 40 | tools: 41 | example_tool: 42 | kind: bigquery-get-table-info 43 | source: my-instance 44 | description: some description 45 | `, 46 | want: server.ToolConfigs{ 47 | "example_tool": bigquerygettableinfo.Config{ 48 | Name: "example_tool", 49 | Kind: "bigquery-get-table-info", 50 | Source: "my-instance", 51 | Description: "some description", 52 | AuthRequired: []string{}, 53 | }, 54 | }, 55 | }, 56 | } 57 | for _, tc := range tcs { 58 | t.Run(tc.desc, func(t *testing.T) { 59 | got := struct { 60 | Tools server.ToolConfigs `yaml:"tools"` 61 | }{} 62 | // Parse contents 63 | err := yaml.UnmarshalContext(ctx, testutils.FormatYaml(tc.in), &got) 64 | if err != nil { 65 | t.Fatalf("unable to unmarshal: %s", err) 66 | } 67 | if diff := cmp.Diff(tc.want, got.Tools); diff != "" { 68 | t.Fatalf("incorrect parse: diff %v", diff) 69 | } 70 | }) 71 | } 72 | 73 | } 74 | ``` -------------------------------------------------------------------------------- /internal/tools/bigquery/bigquerylisttableids/bigquerylisttableids_test.go: -------------------------------------------------------------------------------- ```go 1 | // Copyright 2025 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package bigquerylisttableids_test 16 | 17 | import ( 18 | "testing" 19 | 20 | yaml "github.com/goccy/go-yaml" 21 | "github.com/google/go-cmp/cmp" 22 | "github.com/googleapis/genai-toolbox/internal/server" 23 | "github.com/googleapis/genai-toolbox/internal/testutils" 24 | "github.com/googleapis/genai-toolbox/internal/tools/bigquery/bigquerylisttableids" 25 | ) 26 | 27 | func TestParseFromYamlBigQueryListTableIds(t *testing.T) { 28 | ctx, err := testutils.ContextWithNewLogger() 29 | if err != nil { 30 | t.Fatalf("unexpected error: %s", err) 31 | } 32 | tcs := []struct { 33 | desc string 34 | in string 35 | want server.ToolConfigs 36 | }{ 37 | { 38 | desc: "basic example", 39 | in: ` 40 | tools: 41 | example_tool: 42 | kind: bigquery-list-table-ids 43 | source: my-instance 44 | description: some description 45 | `, 46 | want: server.ToolConfigs{ 47 | "example_tool": bigquerylisttableids.Config{ 48 | Name: "example_tool", 49 | Kind: "bigquery-list-table-ids", 50 | Source: "my-instance", 51 | Description: "some description", 52 | AuthRequired: []string{}, 53 | }, 54 | }, 55 | }, 56 | } 57 | for _, tc := range tcs { 58 | t.Run(tc.desc, func(t *testing.T) { 59 | got := struct { 60 | Tools server.ToolConfigs `yaml:"tools"` 61 | }{} 62 | // Parse contents 63 | err := yaml.UnmarshalContext(ctx, testutils.FormatYaml(tc.in), &got) 64 | if err != nil { 65 | t.Fatalf("unable to unmarshal: %s", err) 66 | } 67 | if diff := cmp.Diff(tc.want, got.Tools); diff != "" { 68 | t.Fatalf("incorrect parse: diff %v", diff) 69 | } 70 | }) 71 | } 72 | 73 | } 74 | ``` -------------------------------------------------------------------------------- /internal/tools/dataplex/dataplexsearchentries/dataplexsearchentries_test.go: -------------------------------------------------------------------------------- ```go 1 | // Copyright 2025 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package dataplexsearchentries_test 16 | 17 | import ( 18 | "testing" 19 | 20 | yaml "github.com/goccy/go-yaml" 21 | "github.com/google/go-cmp/cmp" 22 | "github.com/googleapis/genai-toolbox/internal/server" 23 | "github.com/googleapis/genai-toolbox/internal/testutils" 24 | "github.com/googleapis/genai-toolbox/internal/tools/dataplex/dataplexsearchentries" 25 | ) 26 | 27 | func TestParseFromYamlDataplexSearchEntries(t *testing.T) { 28 | ctx, err := testutils.ContextWithNewLogger() 29 | if err != nil { 30 | t.Fatalf("unexpected error: %s", err) 31 | } 32 | tcs := []struct { 33 | desc string 34 | in string 35 | want server.ToolConfigs 36 | }{ 37 | { 38 | desc: "basic example", 39 | in: ` 40 | tools: 41 | example_tool: 42 | kind: dataplex-search-entries 43 | source: my-instance 44 | description: some description 45 | `, 46 | want: server.ToolConfigs{ 47 | "example_tool": dataplexsearchentries.Config{ 48 | Name: "example_tool", 49 | Kind: "dataplex-search-entries", 50 | Source: "my-instance", 51 | Description: "some description", 52 | AuthRequired: []string{}, 53 | }, 54 | }, 55 | }, 56 | } 57 | for _, tc := range tcs { 58 | t.Run(tc.desc, func(t *testing.T) { 59 | got := struct { 60 | Tools server.ToolConfigs `yaml:"tools"` 61 | }{} 62 | // Parse contents 63 | err := yaml.UnmarshalContext(ctx, testutils.FormatYaml(tc.in), &got) 64 | if err != nil { 65 | t.Fatalf("unable to unmarshal: %s", err) 66 | } 67 | if diff := cmp.Diff(tc.want, got.Tools); diff != "" { 68 | t.Fatalf("incorrect parse: diff %v", diff) 69 | } 70 | }) 71 | } 72 | 73 | } 74 | ``` -------------------------------------------------------------------------------- /docs/en/resources/tools/looker/looker-make-dashboard.md: -------------------------------------------------------------------------------- ```markdown 1 | --- 2 | title: "looker-make-dashboard" 3 | type: docs 4 | weight: 1 5 | description: > 6 | "looker-make-dashboard" generates a Looker dashboard in the users personal folder in 7 | Looker 8 | aliases: 9 | - /resources/tools/looker-make-dashboard 10 | --- 11 | 12 | ## About 13 | 14 | The `looker-make-dashboard` creates a dashboard in the user's 15 | Looker personal folder. 16 | 17 | It's compatible with the following sources: 18 | 19 | - [looker](../../sources/looker.md) 20 | 21 | `looker-make-dashboard` takes one parameter: 22 | 23 | 1. the `title` 24 | 25 | ## Example 26 | 27 | ```yaml 28 | tools: 29 | make_dashboard: 30 | kind: looker-make-dashboard 31 | source: looker-source 32 | description: | 33 | make_dashboard Tool 34 | 35 | This tool creates a new dashboard in Looker. The dashboard is 36 | initially empty and the add_dashboard_element tool is used to 37 | add content to the dashboard. 38 | 39 | The newly created dashboard will be created in the user's 40 | personal folder in looker. The dashboard name must be unique. 41 | 42 | The result is a json document with a link to the newly 43 | created dashboard and the id of the dashboard. Use the id 44 | when calling add_dashboard_element. 45 | ``` 46 | 47 | ## Reference 48 | 49 | | **field** | **type** | **required** | **description** | 50 | |-------------|:------------------------------------------:|:------------:|--------------------------------------------------------------------------------------------------| 51 | | kind | string | true | Must be "looker-make-dashboard" | 52 | | source | string | true | Name of the source the SQL should execute on. | 53 | | description | string | true | Description of the tool that is passed to the LLM. | 54 | ``` -------------------------------------------------------------------------------- /internal/tools/bigquery/bigquerygetdatasetinfo/bigquerygetdatasetinfo_test.go: -------------------------------------------------------------------------------- ```go 1 | // Copyright 2025 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package bigquerygetdatasetinfo_test 16 | 17 | import ( 18 | "testing" 19 | 20 | yaml "github.com/goccy/go-yaml" 21 | "github.com/google/go-cmp/cmp" 22 | "github.com/googleapis/genai-toolbox/internal/server" 23 | "github.com/googleapis/genai-toolbox/internal/testutils" 24 | "github.com/googleapis/genai-toolbox/internal/tools/bigquery/bigquerygetdatasetinfo" 25 | ) 26 | 27 | func TestParseFromYamlBigQueryGetDatasetInfo(t *testing.T) { 28 | ctx, err := testutils.ContextWithNewLogger() 29 | if err != nil { 30 | t.Fatalf("unexpected error: %s", err) 31 | } 32 | tcs := []struct { 33 | desc string 34 | in string 35 | want server.ToolConfigs 36 | }{ 37 | { 38 | desc: "basic example", 39 | in: ` 40 | tools: 41 | example_tool: 42 | kind: bigquery-get-dataset-info 43 | source: my-instance 44 | description: some description 45 | `, 46 | want: server.ToolConfigs{ 47 | "example_tool": bigquerygetdatasetinfo.Config{ 48 | Name: "example_tool", 49 | Kind: "bigquery-get-dataset-info", 50 | Source: "my-instance", 51 | Description: "some description", 52 | AuthRequired: []string{}, 53 | }, 54 | }, 55 | }, 56 | } 57 | for _, tc := range tcs { 58 | t.Run(tc.desc, func(t *testing.T) { 59 | got := struct { 60 | Tools server.ToolConfigs `yaml:"tools"` 61 | }{} 62 | // Parse contents 63 | err := yaml.UnmarshalContext(ctx, testutils.FormatYaml(tc.in), &got) 64 | if err != nil { 65 | t.Fatalf("unable to unmarshal: %s", err) 66 | } 67 | if diff := cmp.Diff(tc.want, got.Tools); diff != "" { 68 | t.Fatalf("incorrect parse: diff %v", diff) 69 | } 70 | }) 71 | } 72 | 73 | } 74 | ``` -------------------------------------------------------------------------------- /internal/tools/bigquery/bigquerylistdatasetids/bigquerylistdatasetids_test.go: -------------------------------------------------------------------------------- ```go 1 | // Copyright 2025 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package bigquerylistdatasetids_test 16 | 17 | import ( 18 | "testing" 19 | 20 | yaml "github.com/goccy/go-yaml" 21 | "github.com/google/go-cmp/cmp" 22 | "github.com/googleapis/genai-toolbox/internal/server" 23 | "github.com/googleapis/genai-toolbox/internal/testutils" 24 | "github.com/googleapis/genai-toolbox/internal/tools/bigquery/bigquerylistdatasetids" 25 | ) 26 | 27 | func TestParseFromYamlBigQueryListDatasetIds(t *testing.T) { 28 | ctx, err := testutils.ContextWithNewLogger() 29 | if err != nil { 30 | t.Fatalf("unexpected error: %s", err) 31 | } 32 | tcs := []struct { 33 | desc string 34 | in string 35 | want server.ToolConfigs 36 | }{ 37 | { 38 | desc: "basic example", 39 | in: ` 40 | tools: 41 | example_tool: 42 | kind: bigquery-list-dataset-ids 43 | source: my-instance 44 | description: some description 45 | `, 46 | want: server.ToolConfigs{ 47 | "example_tool": bigquerylistdatasetids.Config{ 48 | Name: "example_tool", 49 | Kind: "bigquery-list-dataset-ids", 50 | Source: "my-instance", 51 | Description: "some description", 52 | AuthRequired: []string{}, 53 | }, 54 | }, 55 | }, 56 | } 57 | for _, tc := range tcs { 58 | t.Run(tc.desc, func(t *testing.T) { 59 | got := struct { 60 | Tools server.ToolConfigs `yaml:"tools"` 61 | }{} 62 | // Parse contents 63 | err := yaml.UnmarshalContext(ctx, testutils.FormatYaml(tc.in), &got) 64 | if err != nil { 65 | t.Fatalf("unable to unmarshal: %s", err) 66 | } 67 | if diff := cmp.Diff(tc.want, got.Tools); diff != "" { 68 | t.Fatalf("incorrect parse: diff %v", diff) 69 | } 70 | }) 71 | } 72 | 73 | } 74 | ``` -------------------------------------------------------------------------------- /internal/tools/dataplex/dataplexsearchaspecttypes/dataplexsearchaspecttypes_test.go: -------------------------------------------------------------------------------- ```go 1 | // Copyright 2025 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package dataplexsearchaspecttypes_test 16 | 17 | import ( 18 | "testing" 19 | 20 | yaml "github.com/goccy/go-yaml" 21 | "github.com/google/go-cmp/cmp" 22 | "github.com/googleapis/genai-toolbox/internal/server" 23 | "github.com/googleapis/genai-toolbox/internal/testutils" 24 | "github.com/googleapis/genai-toolbox/internal/tools/dataplex/dataplexsearchaspecttypes" 25 | ) 26 | 27 | func TestParseFromYamlDataplexSearchAspectTypes(t *testing.T) { 28 | ctx, err := testutils.ContextWithNewLogger() 29 | if err != nil { 30 | t.Fatalf("unexpected error: %s", err) 31 | } 32 | tcs := []struct { 33 | desc string 34 | in string 35 | want server.ToolConfigs 36 | }{ 37 | { 38 | desc: "basic example", 39 | in: ` 40 | tools: 41 | example_tool: 42 | kind: dataplex-search-aspect-types 43 | source: my-instance 44 | description: some description 45 | `, 46 | want: server.ToolConfigs{ 47 | "example_tool": dataplexsearchaspecttypes.Config{ 48 | Name: "example_tool", 49 | Kind: "dataplex-search-aspect-types", 50 | Source: "my-instance", 51 | Description: "some description", 52 | AuthRequired: []string{}, 53 | }, 54 | }, 55 | }, 56 | } 57 | for _, tc := range tcs { 58 | t.Run(tc.desc, func(t *testing.T) { 59 | got := struct { 60 | Tools server.ToolConfigs `yaml:"tools"` 61 | }{} 62 | // Parse contents 63 | err := yaml.UnmarshalContext(ctx, testutils.FormatYaml(tc.in), &got) 64 | if err != nil { 65 | t.Fatalf("unable to unmarshal: %s", err) 66 | } 67 | if diff := cmp.Diff(tc.want, got.Tools); diff != "" { 68 | t.Fatalf("incorrect parse: diff %v", diff) 69 | } 70 | }) 71 | } 72 | 73 | } 74 | ``` -------------------------------------------------------------------------------- /internal/tools/bigquery/bigqueryanalyzecontribution/bigqueryanalyzecontribution_test.go: -------------------------------------------------------------------------------- ```go 1 | // Copyright 2025 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package bigqueryanalyzecontribution_test 16 | 17 | import ( 18 | "testing" 19 | 20 | yaml "github.com/goccy/go-yaml" 21 | "github.com/google/go-cmp/cmp" 22 | "github.com/googleapis/genai-toolbox/internal/server" 23 | "github.com/googleapis/genai-toolbox/internal/testutils" 24 | "github.com/googleapis/genai-toolbox/internal/tools/bigquery/bigqueryanalyzecontribution" 25 | ) 26 | 27 | func TestParseFromYamlBigQueryAnalyzeContribution(t *testing.T) { 28 | ctx, err := testutils.ContextWithNewLogger() 29 | if err != nil { 30 | t.Fatalf("unexpected error: %s", err) 31 | } 32 | tcs := []struct { 33 | desc string 34 | in string 35 | want server.ToolConfigs 36 | }{ 37 | { 38 | desc: "basic example", 39 | in: ` 40 | tools: 41 | example_tool: 42 | kind: bigquery-analyze-contribution 43 | source: my-instance 44 | description: some description 45 | `, 46 | want: server.ToolConfigs{ 47 | "example_tool": bigqueryanalyzecontribution.Config{ 48 | Name: "example_tool", 49 | Kind: "bigquery-analyze-contribution", 50 | Source: "my-instance", 51 | Description: "some description", 52 | AuthRequired: []string{}, 53 | }, 54 | }, 55 | }, 56 | } 57 | for _, tc := range tcs { 58 | t.Run(tc.desc, func(t *testing.T) { 59 | got := struct { 60 | Tools server.ToolConfigs `yaml:"tools"` 61 | }{} 62 | // Parse contents 63 | err := yaml.UnmarshalContext(ctx, testutils.FormatYaml(tc.in), &got) 64 | if err != nil { 65 | t.Fatalf("unable to unmarshal: %s", err) 66 | } 67 | if diff := cmp.Diff(tc.want, got.Tools); diff != "" { 68 | t.Fatalf("incorrect parse: diff %v", diff) 69 | } 70 | }) 71 | } 72 | } 73 | ``` -------------------------------------------------------------------------------- /internal/tools/cloudsqlpg/cloudsqlpgcreateinstances/cloudsqlpgcreateinstances_test.go: -------------------------------------------------------------------------------- ```go 1 | // Copyright 2025 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cloudsqlpgcreateinstances_test 16 | 17 | import ( 18 | "testing" 19 | 20 | yaml "github.com/goccy/go-yaml" 21 | "github.com/google/go-cmp/cmp" 22 | "github.com/googleapis/genai-toolbox/internal/server" 23 | "github.com/googleapis/genai-toolbox/internal/testutils" 24 | "github.com/googleapis/genai-toolbox/internal/tools/cloudsqlpg/cloudsqlpgcreateinstances" 25 | ) 26 | 27 | func TestParseFromYaml(t *testing.T) { 28 | ctx, err := testutils.ContextWithNewLogger() 29 | if err != nil { 30 | t.Fatalf("unexpected error: %s", err) 31 | } 32 | tcs := []struct { 33 | desc string 34 | in string 35 | want server.ToolConfigs 36 | }{ 37 | { 38 | desc: "basic example", 39 | in: ` 40 | tools: 41 | create-instance-tool: 42 | kind: cloud-sql-postgres-create-instance 43 | description: a test description 44 | source: a-source 45 | `, 46 | want: server.ToolConfigs{ 47 | "create-instance-tool": cloudsqlpgcreateinstances.Config{ 48 | Name: "create-instance-tool", 49 | Kind: "cloud-sql-postgres-create-instance", 50 | Description: "a test description", 51 | Source: "a-source", 52 | AuthRequired: []string{}, 53 | }, 54 | }, 55 | }, 56 | } 57 | for _, tc := range tcs { 58 | t.Run(tc.desc, func(t *testing.T) { 59 | got := struct { 60 | Tools server.ToolConfigs `yaml:"tools"` 61 | }{} 62 | // Parse contents 63 | err := yaml.UnmarshalContext(ctx, testutils.FormatYaml(tc.in), &got) 64 | if err != nil { 65 | t.Fatalf("unable to unmarshal: %s", err) 66 | } 67 | if diff := cmp.Diff(tc.want, got.Tools); diff != "" { 68 | t.Fatalf("incorrect parse: diff %v", diff) 69 | } 70 | }) 71 | } 72 | } 73 | ``` -------------------------------------------------------------------------------- /internal/tools/cloudsql/cloudsqlgetinstances/cloudsqlgetinstances_test.go: -------------------------------------------------------------------------------- ```go 1 | // Copyright 2025 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cloudsqlgetinstances_test 16 | 17 | import ( 18 | "testing" 19 | 20 | yaml "github.com/goccy/go-yaml" 21 | "github.com/google/go-cmp/cmp" 22 | "github.com/googleapis/genai-toolbox/internal/server" 23 | "github.com/googleapis/genai-toolbox/internal/testutils" 24 | cloudsqlgetinstances "github.com/googleapis/genai-toolbox/internal/tools/cloudsql/cloudsqlgetinstances" 25 | ) 26 | 27 | func TestParseFromYaml(t *testing.T) { 28 | ctx, err := testutils.ContextWithNewLogger() 29 | if err != nil { 30 | t.Fatalf("unexpected error: %s", err) 31 | } 32 | tcs := []struct { 33 | desc string 34 | in string 35 | want server.ToolConfigs 36 | }{ 37 | { 38 | desc: "basic example", 39 | in: ` 40 | tools: 41 | get-instances: 42 | kind: cloud-sql-get-instance 43 | description: "A tool to get cloud sql instances" 44 | source: "my-gcp-source" 45 | `, 46 | want: server.ToolConfigs{ 47 | "get-instances": cloudsqlgetinstances.Config{ 48 | Name: "get-instances", 49 | Kind: "cloud-sql-get-instance", 50 | Description: "A tool to get cloud sql instances", 51 | Source: "my-gcp-source", 52 | AuthRequired: []string{}, 53 | }, 54 | }, 55 | }, 56 | } 57 | for _, tc := range tcs { 58 | t.Run(tc.desc, func(t *testing.T) { 59 | got := struct { 60 | Tools server.ToolConfigs `yaml:"tools"` 61 | }{} 62 | // Parse contents 63 | err := yaml.UnmarshalContext(ctx, testutils.FormatYaml(tc.in), &got) 64 | if err != nil { 65 | t.Fatalf("unable to unmarshal: %s", err) 66 | } 67 | if diff := cmp.Diff(tc.want, got.Tools); diff != "" { 68 | t.Fatalf("incorrect parse: diff %v", diff) 69 | } 70 | }) 71 | } 72 | } 73 | ``` -------------------------------------------------------------------------------- /internal/tools/cloudsqlmssql/cloudsqlmssqlcreateinstance/cloudsqlmssqlcreateinstance_test.go: -------------------------------------------------------------------------------- ```go 1 | // Copyright 2025 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cloudsqlmssqlcreateinstance_test 16 | 17 | import ( 18 | "testing" 19 | 20 | yaml "github.com/goccy/go-yaml" 21 | "github.com/google/go-cmp/cmp" 22 | "github.com/googleapis/genai-toolbox/internal/server" 23 | "github.com/googleapis/genai-toolbox/internal/testutils" 24 | "github.com/googleapis/genai-toolbox/internal/tools/cloudsqlmssql/cloudsqlmssqlcreateinstance" 25 | ) 26 | 27 | func TestParseFromYaml(t *testing.T) { 28 | ctx, err := testutils.ContextWithNewLogger() 29 | if err != nil { 30 | t.Fatalf("unexpected error: %s", err) 31 | } 32 | tcs := []struct { 33 | desc string 34 | in string 35 | want server.ToolConfigs 36 | }{ 37 | { 38 | desc: "basic example", 39 | in: ` 40 | tools: 41 | create-instance-tool: 42 | kind: cloud-sql-mssql-create-instance 43 | description: a test description 44 | source: a-source 45 | `, 46 | want: server.ToolConfigs{ 47 | "create-instance-tool": cloudsqlmssqlcreateinstance.Config{ 48 | Name: "create-instance-tool", 49 | Kind: "cloud-sql-mssql-create-instance", 50 | Description: "a test description", 51 | Source: "a-source", 52 | AuthRequired: []string{}, 53 | }, 54 | }, 55 | }, 56 | } 57 | for _, tc := range tcs { 58 | t.Run(tc.desc, func(t *testing.T) { 59 | got := struct { 60 | Tools server.ToolConfigs `yaml:"tools"` 61 | }{} 62 | // Parse contents 63 | err := yaml.UnmarshalContext(ctx, testutils.FormatYaml(tc.in), &got) 64 | if err != nil { 65 | t.Fatalf("unable to unmarshal: %s", err) 66 | } 67 | if diff := cmp.Diff(tc.want, got.Tools); diff != "" { 68 | t.Fatalf("incorrect parse: diff %v", diff) 69 | } 70 | }) 71 | } 72 | } 73 | ``` -------------------------------------------------------------------------------- /internal/tools/cloudsqlmysql/cloudsqlmysqlcreateinstance/cloudsqlmysqlcreateinstance_test.go: -------------------------------------------------------------------------------- ```go 1 | // Copyright 2025 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cloudsqlmysqlcreateinstance_test 16 | 17 | import ( 18 | "testing" 19 | 20 | yaml "github.com/goccy/go-yaml" 21 | "github.com/google/go-cmp/cmp" 22 | "github.com/googleapis/genai-toolbox/internal/server" 23 | "github.com/googleapis/genai-toolbox/internal/testutils" 24 | "github.com/googleapis/genai-toolbox/internal/tools/cloudsqlmysql/cloudsqlmysqlcreateinstance" 25 | ) 26 | 27 | func TestParseFromYaml(t *testing.T) { 28 | ctx, err := testutils.ContextWithNewLogger() 29 | if err != nil { 30 | t.Fatalf("unexpected error: %s", err) 31 | } 32 | tcs := []struct { 33 | desc string 34 | in string 35 | want server.ToolConfigs 36 | }{ 37 | { 38 | desc: "basic example", 39 | in: ` 40 | tools: 41 | create-instance-tool: 42 | kind: cloud-sql-mysql-create-instance 43 | description: a test description 44 | source: a-source 45 | `, 46 | want: server.ToolConfigs{ 47 | "create-instance-tool": cloudsqlmysqlcreateinstance.Config{ 48 | Name: "create-instance-tool", 49 | Kind: "cloud-sql-mysql-create-instance", 50 | Description: "a test description", 51 | Source: "a-source", 52 | AuthRequired: []string{}, 53 | }, 54 | }, 55 | }, 56 | } 57 | for _, tc := range tcs { 58 | t.Run(tc.desc, func(t *testing.T) { 59 | got := struct { 60 | Tools server.ToolConfigs `yaml:"tools"` 61 | }{} 62 | // Parse contents 63 | err := yaml.UnmarshalContext(ctx, testutils.FormatYaml(tc.in), &got) 64 | if err != nil { 65 | t.Fatalf("unable to unmarshal: %s", err) 66 | } 67 | if diff := cmp.Diff(tc.want, got.Tools); diff != "" { 68 | t.Fatalf("incorrect parse: diff %v", diff) 69 | } 70 | }) 71 | } 72 | } 73 | ``` -------------------------------------------------------------------------------- /internal/tools/looker/lookerconversationalanalytics/lookerconversationalanalytics_test.go: -------------------------------------------------------------------------------- ```go 1 | // Copyright 2025 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package lookerconversationalanalytics_test 16 | 17 | import ( 18 | "testing" 19 | 20 | yaml "github.com/goccy/go-yaml" 21 | "github.com/google/go-cmp/cmp" 22 | "github.com/googleapis/genai-toolbox/internal/server" 23 | "github.com/googleapis/genai-toolbox/internal/testutils" 24 | "github.com/googleapis/genai-toolbox/internal/tools/looker/lookerconversationalanalytics" 25 | ) 26 | 27 | func TestParseFromYamlLookerConversationalAnalytics(t *testing.T) { 28 | ctx, err := testutils.ContextWithNewLogger() 29 | if err != nil { 30 | t.Fatalf("unexpected error: %s", err) 31 | } 32 | tcs := []struct { 33 | desc string 34 | in string 35 | want server.ToolConfigs 36 | }{ 37 | { 38 | desc: "basic example", 39 | in: ` 40 | tools: 41 | example_tool: 42 | kind: looker-conversational-analytics 43 | source: my-instance 44 | description: some description 45 | `, 46 | want: server.ToolConfigs{ 47 | "example_tool": lookerconversationalanalytics.Config{ 48 | Name: "example_tool", 49 | Kind: "looker-conversational-analytics", 50 | Source: "my-instance", 51 | Description: "some description", 52 | AuthRequired: []string{}, 53 | }, 54 | }, 55 | }, 56 | } 57 | for _, tc := range tcs { 58 | t.Run(tc.desc, func(t *testing.T) { 59 | got := struct { 60 | Tools server.ToolConfigs `yaml:"tools"` 61 | }{} 62 | // Parse contents 63 | err := yaml.UnmarshalContext(ctx, testutils.FormatYaml(tc.in), &got) 64 | if err != nil { 65 | t.Fatalf("unable to unmarshal: %s", err) 66 | } 67 | if diff := cmp.Diff(tc.want, got.Tools); diff != "" { 68 | t.Fatalf("incorrect parse: diff %v", diff) 69 | } 70 | }) 71 | } 72 | } 73 | ``` -------------------------------------------------------------------------------- /docs/en/resources/tools/looker/looker-get-measures.md: -------------------------------------------------------------------------------- ```markdown 1 | --- 2 | title: "looker-get-measures" 3 | type: docs 4 | weight: 1 5 | description: > 6 | A "looker-get-measures" tool returns all the measures from a given explore 7 | in a given model in the source. 8 | aliases: 9 | - /resources/tools/looker-get-measures 10 | --- 11 | 12 | ## About 13 | 14 | A `looker-get-measures` tool returns all the measures from a given explore 15 | in a given model in the source. 16 | 17 | It's compatible with the following sources: 18 | 19 | - [looker](../../sources/looker.md) 20 | 21 | `looker-get-measures` accepts two parameters, the `model` and the `explore`. 22 | 23 | ## Example 24 | 25 | ```yaml 26 | tools: 27 | get_measures: 28 | kind: looker-get-measures 29 | source: looker-source 30 | description: | 31 | The get_measures tool retrieves the list of measures defined in 32 | an explore. 33 | 34 | It takes two parameters, the model_name looked up from get_models and the 35 | explore_name looked up from get_explores. 36 | 37 | If this returns a suggestions field for a measure, the contents of suggestions 38 | can be used as filters for this field. If this returns a suggest_explore and 39 | suggest_dimension, a query against that explore and dimension can be used to find 40 | valid filters for this field. 41 | 42 | ``` 43 | 44 | The response is a json array with the following elements: 45 | 46 | ```json 47 | { 48 | "name": "field name", 49 | "description": "field description", 50 | "type": "field type", 51 | "label": "field label", 52 | "label_short": "field short label", 53 | "tags": ["tags", ...], 54 | "synonyms": ["synonyms", ...], 55 | "suggestions": ["suggestion", ...], 56 | "suggest_explore": "explore", 57 | "suggest_dimension": "dimension" 58 | } 59 | ``` 60 | 61 | 62 | ## Reference 63 | 64 | | **field** | **type** | **required** | **description** | 65 | |-------------|:--------:|:------------:|----------------------------------------------------| 66 | | kind | string | true | Must be "looker-get-measures". | 67 | | source | string | true | Name of the source the SQL should execute on. | 68 | | description | string | true | Description of the tool that is passed to the LLM. | 69 | ``` -------------------------------------------------------------------------------- /internal/tools/bigquery/bigqueryconversationalanalytics/bigqueryconversationalanalytics_test.go: -------------------------------------------------------------------------------- ```go 1 | // Copyright 2025 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package bigqueryconversationalanalytics_test 16 | 17 | import ( 18 | "testing" 19 | 20 | yaml "github.com/goccy/go-yaml" 21 | "github.com/google/go-cmp/cmp" 22 | "github.com/googleapis/genai-toolbox/internal/server" 23 | "github.com/googleapis/genai-toolbox/internal/testutils" 24 | "github.com/googleapis/genai-toolbox/internal/tools/bigquery/bigqueryconversationalanalytics" 25 | ) 26 | 27 | func TestParseFromYamlBigQueryConversationalAnalytics(t *testing.T) { 28 | ctx, err := testutils.ContextWithNewLogger() 29 | if err != nil { 30 | t.Fatalf("unexpected error: %s", err) 31 | } 32 | tcs := []struct { 33 | desc string 34 | in string 35 | want server.ToolConfigs 36 | }{ 37 | { 38 | desc: "basic example", 39 | in: ` 40 | tools: 41 | example_tool: 42 | kind: bigquery-conversational-analytics 43 | source: my-instance 44 | description: some description 45 | `, 46 | want: server.ToolConfigs{ 47 | "example_tool": bigqueryconversationalanalytics.Config{ 48 | Name: "example_tool", 49 | Kind: "bigquery-conversational-analytics", 50 | Source: "my-instance", 51 | Description: "some description", 52 | AuthRequired: []string{}, 53 | }, 54 | }, 55 | }, 56 | } 57 | for _, tc := range tcs { 58 | t.Run(tc.desc, func(t *testing.T) { 59 | got := struct { 60 | Tools server.ToolConfigs `yaml:"tools"` 61 | }{} 62 | // Parse contents 63 | err := yaml.UnmarshalContext(ctx, testutils.FormatYaml(tc.in), &got) 64 | if err != nil { 65 | t.Fatalf("unable to unmarshal: %s", err) 66 | } 67 | if diff := cmp.Diff(tc.want, got.Tools); diff != "" { 68 | t.Fatalf("incorrect parse: diff %v", diff) 69 | } 70 | }) 71 | } 72 | } 73 | ``` -------------------------------------------------------------------------------- /docs/en/resources/tools/bigquery/bigquery-list-dataset-ids.md: -------------------------------------------------------------------------------- ```markdown 1 | --- 2 | title: "bigquery-list-dataset-ids" 3 | type: docs 4 | weight: 1 5 | description: > 6 | A "bigquery-list-dataset-ids" tool returns all dataset IDs from the source. 7 | aliases: 8 | - /resources/tools/bigquery-list-dataset-ids 9 | --- 10 | 11 | ## About 12 | 13 | A `bigquery-list-dataset-ids` tool returns all dataset IDs from the source. 14 | It's compatible with the following sources: 15 | 16 | - [bigquery](../../sources/bigquery.md) 17 | 18 | `bigquery-list-dataset-ids` accepts the following parameter: 19 | - **`project`** (optional): Defines the Google Cloud project ID. If not provided, 20 | the tool defaults to the project from the source configuration. 21 | 22 | The tool's behavior regarding this parameter is influenced by the 23 | `allowedDatasets` restriction on the `bigquery` source: 24 | - **Without `allowedDatasets` restriction:** The tool can list datasets from any 25 | project specified by the `project` parameter. 26 | - **With `allowedDatasets` restriction:** The tool directly returns the 27 | pre-configured list of dataset IDs from the source, and the `project` 28 | parameter is ignored. 29 | 30 | ## Example 31 | 32 | ```yaml 33 | tools: 34 | bigquery_list_dataset_ids: 35 | kind: bigquery-list-dataset-ids 36 | source: my-bigquery-source 37 | description: Use this tool to get dataset metadata. 38 | ``` 39 | 40 | ## Reference 41 | 42 | | **field** | **type** | **required** | **description** | 43 | |-------------|:------------------------------------------:|:------------:|--------------------------------------------------------------------------------------------------| 44 | | kind | string | true | Must be "bigquery-list-dataset-ids". | 45 | | source | string | true | Name of the source the SQL should execute on. | 46 | | description | string | true | Description of the tool that is passed to the LLM. | 47 | ``` -------------------------------------------------------------------------------- /internal/tools/tidb/tidbexecutesql/tidbexecutesql_test.go: -------------------------------------------------------------------------------- ```go 1 | // Copyright 2025 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package tidbexecutesql_test 16 | 17 | import ( 18 | "testing" 19 | 20 | yaml "github.com/goccy/go-yaml" 21 | "github.com/google/go-cmp/cmp" 22 | "github.com/googleapis/genai-toolbox/internal/server" 23 | "github.com/googleapis/genai-toolbox/internal/testutils" 24 | "github.com/googleapis/genai-toolbox/internal/tools/tidb/tidbexecutesql" 25 | ) 26 | 27 | func TestParseFromYamlExecuteSql(t *testing.T) { 28 | ctx, err := testutils.ContextWithNewLogger() 29 | if err != nil { 30 | t.Fatalf("unexpected error: %s", err) 31 | } 32 | tcs := []struct { 33 | desc string 34 | in string 35 | want server.ToolConfigs 36 | }{ 37 | { 38 | desc: "basic example", 39 | in: ` 40 | tools: 41 | example_tool: 42 | kind: tidb-execute-sql 43 | source: my-instance 44 | description: some description 45 | authRequired: 46 | - my-google-auth-service 47 | - other-auth-service 48 | `, 49 | want: server.ToolConfigs{ 50 | "example_tool": tidbexecutesql.Config{ 51 | Name: "example_tool", 52 | Kind: "tidb-execute-sql", 53 | Source: "my-instance", 54 | Description: "some description", 55 | AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, 56 | }, 57 | }, 58 | }, 59 | } 60 | for _, tc := range tcs { 61 | t.Run(tc.desc, func(t *testing.T) { 62 | got := struct { 63 | Tools server.ToolConfigs `yaml:"tools"` 64 | }{} 65 | // Parse contents 66 | err := yaml.UnmarshalContext(ctx, testutils.FormatYaml(tc.in), &got) 67 | if err != nil { 68 | t.Fatalf("unable to unmarshal: %s", err) 69 | } 70 | if diff := cmp.Diff(tc.want, got.Tools); diff != "" { 71 | t.Fatalf("incorrect parse: diff %v", diff) 72 | } 73 | }) 74 | } 75 | 76 | } 77 | ``` -------------------------------------------------------------------------------- /internal/tools/mssql/mssqlexecutesql/mssqlexecutesql_test.go: -------------------------------------------------------------------------------- ```go 1 | // Copyright 2025 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package mssqlexecutesql_test 16 | 17 | import ( 18 | "testing" 19 | 20 | yaml "github.com/goccy/go-yaml" 21 | "github.com/google/go-cmp/cmp" 22 | "github.com/googleapis/genai-toolbox/internal/server" 23 | "github.com/googleapis/genai-toolbox/internal/testutils" 24 | "github.com/googleapis/genai-toolbox/internal/tools/mssql/mssqlexecutesql" 25 | ) 26 | 27 | func TestParseFromYamlExecuteSql(t *testing.T) { 28 | ctx, err := testutils.ContextWithNewLogger() 29 | if err != nil { 30 | t.Fatalf("unexpected error: %s", err) 31 | } 32 | tcs := []struct { 33 | desc string 34 | in string 35 | want server.ToolConfigs 36 | }{ 37 | { 38 | desc: "basic example", 39 | in: ` 40 | tools: 41 | example_tool: 42 | kind: mssql-execute-sql 43 | source: my-instance 44 | description: some description 45 | authRequired: 46 | - my-google-auth-service 47 | - other-auth-service 48 | `, 49 | want: server.ToolConfigs{ 50 | "example_tool": mssqlexecutesql.Config{ 51 | Name: "example_tool", 52 | Kind: "mssql-execute-sql", 53 | Source: "my-instance", 54 | Description: "some description", 55 | AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, 56 | }, 57 | }, 58 | }, 59 | } 60 | for _, tc := range tcs { 61 | t.Run(tc.desc, func(t *testing.T) { 62 | got := struct { 63 | Tools server.ToolConfigs `yaml:"tools"` 64 | }{} 65 | // Parse contents 66 | err := yaml.UnmarshalContext(ctx, testutils.FormatYaml(tc.in), &got) 67 | if err != nil { 68 | t.Fatalf("unable to unmarshal: %s", err) 69 | } 70 | if diff := cmp.Diff(tc.want, got.Tools); diff != "" { 71 | t.Fatalf("incorrect parse: diff %v", diff) 72 | } 73 | }) 74 | } 75 | 76 | } 77 | ``` -------------------------------------------------------------------------------- /internal/tools/mysql/mysqlexecutesql/mysqlexecutesql_test.go: -------------------------------------------------------------------------------- ```go 1 | // Copyright 2025 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package mysqlexecutesql_test 16 | 17 | import ( 18 | "testing" 19 | 20 | yaml "github.com/goccy/go-yaml" 21 | "github.com/google/go-cmp/cmp" 22 | "github.com/googleapis/genai-toolbox/internal/server" 23 | "github.com/googleapis/genai-toolbox/internal/testutils" 24 | "github.com/googleapis/genai-toolbox/internal/tools/mysql/mysqlexecutesql" 25 | ) 26 | 27 | func TestParseFromYamlExecuteSql(t *testing.T) { 28 | ctx, err := testutils.ContextWithNewLogger() 29 | if err != nil { 30 | t.Fatalf("unexpected error: %s", err) 31 | } 32 | tcs := []struct { 33 | desc string 34 | in string 35 | want server.ToolConfigs 36 | }{ 37 | { 38 | desc: "basic example", 39 | in: ` 40 | tools: 41 | example_tool: 42 | kind: mysql-execute-sql 43 | source: my-instance 44 | description: some description 45 | authRequired: 46 | - my-google-auth-service 47 | - other-auth-service 48 | `, 49 | want: server.ToolConfigs{ 50 | "example_tool": mysqlexecutesql.Config{ 51 | Name: "example_tool", 52 | Kind: "mysql-execute-sql", 53 | Source: "my-instance", 54 | Description: "some description", 55 | AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, 56 | }, 57 | }, 58 | }, 59 | } 60 | for _, tc := range tcs { 61 | t.Run(tc.desc, func(t *testing.T) { 62 | got := struct { 63 | Tools server.ToolConfigs `yaml:"tools"` 64 | }{} 65 | // Parse contents 66 | err := yaml.UnmarshalContext(ctx, testutils.FormatYaml(tc.in), &got) 67 | if err != nil { 68 | t.Fatalf("unable to unmarshal: %s", err) 69 | } 70 | if diff := cmp.Diff(tc.want, got.Tools); diff != "" { 71 | t.Fatalf("incorrect parse: diff %v", diff) 72 | } 73 | }) 74 | } 75 | 76 | } 77 | ``` -------------------------------------------------------------------------------- /docs/en/resources/tools/postgres/postgres-list-available-extensions.md: -------------------------------------------------------------------------------- ```markdown 1 | --- 2 | title: "postgres-list-available-extensions" 3 | type: docs 4 | weight: 1 5 | description: > 6 | The "postgres-list-available-extensions" tool retrieves all PostgreSQL 7 | extensions available for installation on a Postgres database. 8 | aliases: 9 | - /resources/tools/postgres-list-available-extensions 10 | --- 11 | 12 | ## About 13 | 14 | The `postgres-list-available-extensions` tool retrieves all PostgreSQL 15 | extensions available for installation on a Postgres database. It's compatible 16 | with any of the following sources: 17 | 18 | - [alloydb-postgres](../../sources/alloydb-pg.md) 19 | - [cloud-sql-postgres](../../sources/cloud-sql-pg.md) 20 | - [postgres](../../sources/postgres.md) 21 | 22 | `postgres-list-available-extensions` lists all PostgreSQL extensions available 23 | for installation (extension name, default version description) as JSON. The does 24 | not support any input parameter. 25 | 26 | ## Example 27 | 28 | ```yaml 29 | tools: 30 | list_available_extensions: 31 | kind: postgres-list-available-extensions 32 | source: postgres-source 33 | description: Discover all PostgreSQL extensions available for installation on this server, returning name, default_version, and description. 34 | ``` 35 | 36 | ## Reference 37 | 38 | | **name** | **default_version** | **description** | 39 | |----------------------|---------------------|---------------------------------------------------------------------------------------------------------------------| 40 | | address_standardizer | 3.5.2 | Used to parse an address into constituent elements. Generally used to support geocoding address normalization step. | 41 | | amcheck | 1.4 | functions for verifying relation integrity | 42 | | anon | 1.0.0 | Data anonymization tools | 43 | | autoinc | 1.0 | functions for autoincrementing fields | 44 | ``` -------------------------------------------------------------------------------- /.ci/test_with_coverage.sh: -------------------------------------------------------------------------------- ```bash 1 | #!/bin/bash 2 | 3 | # Arguments: 4 | # $1: Display name for logs (e.g., "Cloud SQL Postgres") 5 | # $2: Integration test's package name (e.g., cloudsqlpg) 6 | # $3, $4, ...: Tool package names for grep (e.g., postgressql), if the 7 | # integration test specifically check a separate package inside a folder, please 8 | # specify the full path instead (e.g., postgressql/postgresexecutesql) 9 | 10 | DISPLAY_NAME="$1" 11 | SOURCE_PACKAGE_NAME="$2" 12 | 13 | # Construct the test binary name 14 | TEST_BINARY="${SOURCE_PACKAGE_NAME}.test" 15 | 16 | # Construct the full source path 17 | SOURCE_PATH="sources/${SOURCE_PACKAGE_NAME}/" 18 | 19 | # Shift arguments so that $3 and onwards become the list of tool package names 20 | shift 2 21 | TOOL_PACKAGE_NAMES=("$@") 22 | 23 | COVERAGE_FILE="${TEST_BINARY%.test}_coverage.out" 24 | FILTERED_COVERAGE_FILE="${TEST_BINARY%.test}_filtered_coverage.out" 25 | 26 | export path="github.com/googleapis/genai-toolbox/internal/" 27 | 28 | GREP_PATTERN="^mode:|${path}${SOURCE_PATH}" 29 | # Add each tool package path to the grep pattern 30 | for tool_name in "${TOOL_PACKAGE_NAMES[@]}"; do 31 | if [ -n "$tool_name" ]; then 32 | full_tool_path="tools/${tool_name}/" 33 | GREP_PATTERN="${GREP_PATTERN}|${path}${full_tool_path}" 34 | fi 35 | done 36 | 37 | # Run integration test 38 | if ! ./"${TEST_BINARY}" -test.v -test.coverprofile="${COVERAGE_FILE}"; then 39 | echo "Error: Tests for ${DISPLAY_NAME} failed. Exiting." 40 | exit 1 41 | fi 42 | 43 | # Filter source/tool packages 44 | if ! grep -E "${GREP_PATTERN}" "${COVERAGE_FILE}" > "${FILTERED_COVERAGE_FILE}"; then 45 | echo "Warning: Could not filter coverage for ${DISPLAY_NAME}. Filtered file might be empty or invalid." 46 | fi 47 | 48 | # Calculate coverage 49 | echo "Calculating coverage for ${DISPLAY_NAME}..." 50 | total_coverage=$(go tool cover -func="${FILTERED_COVERAGE_FILE}" 2>/dev/null | grep "total:" | awk '{print $3}') 51 | 52 | 53 | echo "${DISPLAY_NAME} total coverage: $total_coverage" 54 | coverage_numeric=$(echo "$total_coverage" | sed 's/%//') 55 | 56 | # Check coverage threshold 57 | if awk -v coverage="$coverage_numeric" 'BEGIN {exit !(coverage < 50)}'; then 58 | echo "Coverage failure: ${DISPLAY_NAME} total coverage($total_coverage) is below 50%." 59 | exit 1 60 | else 61 | echo "Coverage for ${DISPLAY_NAME} is sufficient." 62 | fi 63 | ``` -------------------------------------------------------------------------------- /docs/en/resources/tools/looker/looker-health-vacuum.md: -------------------------------------------------------------------------------- ```markdown 1 | --- 2 | title: "looker-health-vacuum" 3 | type: docs 4 | weight: 1 5 | description: > 6 | "looker-health-vacuum" provides a set of commands to audit and identify unused LookML objects in a Looker instance. 7 | aliases: 8 | - /resources/tools/looker-health-vacuum 9 | --- 10 | 11 | ## About 12 | 13 | The `looker-health-vacuum` tool helps you identify unused LookML objects such as models, explores, joins, and fields. The `action` parameter selects the type of vacuum to perform: 14 | 15 | - `models`: Identifies unused explores within a model. 16 | - `explores`: Identifies unused joins and fields within an explore. 17 | 18 | ## Parameters 19 | 20 | | **field** | **type** | **required** | **description** | 21 | | :--- | :--- | :--- | :--- | 22 | | kind | string | true | Must be "looker-health-vacuum" | 23 | | source | string | true | Looker source name | 24 | | action | string | true | The vacuum to perform: `models`, or `explores`. | 25 | | project | string | false | The name of the Looker project to vacuum. | 26 | | model | string | false | The name of the Looker model to vacuum. | 27 | | explore | string | false | The name of the Looker explore to vacuum. | 28 | | timeframe | int | false | The timeframe in days to analyze for usage. Defaults to 90. | 29 | | min_queries | int | false | The minimum number of queries for an object to be considered used. Defaults to 1. | 30 | 31 | ## Example 32 | 33 | Identify unnused fields (*in this case, less than 1 query in the last 20 days*) and joins in the `order_items` explore and `thelook` model 34 | 35 | ```yaml 36 | tools: 37 | vacuum-tool: 38 | kind: looker-health-vacuum 39 | source: looker-source 40 | description: | 41 | Vacuums the Looker instance by identifying unused explores, fields, and joins. 42 | parameters: 43 | action: explores 44 | project: "thelook_core" 45 | model: "thelook" 46 | explore: "order_items" 47 | timeframe: 20 48 | min_queries: 1 49 | ``` 50 | 51 | Identify unnused explores across all models in `thelook_core` project. 52 | 53 | ```yaml 54 | tools: 55 | vacuum-tool: 56 | kind: looker-health-vacuum 57 | source: looker-source 58 | description: | 59 | Vacuums the Looker instance by identifying unused explores, fields, and joins. 60 | parameters: 61 | action: models 62 | project: "thelook_core" 63 | ``` -------------------------------------------------------------------------------- /internal/tools/trino/trinoexecutesql/trinoexecutesql_test.go: -------------------------------------------------------------------------------- ```go 1 | // Copyright 2025 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package trinoexecutesql_test 16 | 17 | import ( 18 | "testing" 19 | 20 | yaml "github.com/goccy/go-yaml" 21 | "github.com/google/go-cmp/cmp" 22 | "github.com/googleapis/genai-toolbox/internal/server" 23 | "github.com/googleapis/genai-toolbox/internal/testutils" 24 | "github.com/googleapis/genai-toolbox/internal/tools/trino/trinoexecutesql" 25 | ) 26 | 27 | func TestParseFromYamlTrinoExecuteSQL(t *testing.T) { 28 | ctx, err := testutils.ContextWithNewLogger() 29 | if err != nil { 30 | t.Fatalf("unexpected error: %s", err) 31 | } 32 | tcs := []struct { 33 | desc string 34 | in string 35 | want server.ToolConfigs 36 | }{ 37 | { 38 | desc: "basic example", 39 | in: ` 40 | tools: 41 | example_tool: 42 | kind: trino-execute-sql 43 | source: my-trino-instance 44 | description: some description 45 | authRequired: 46 | - my-google-auth-service 47 | - other-auth-service 48 | `, 49 | want: server.ToolConfigs{ 50 | "example_tool": trinoexecutesql.Config{ 51 | Name: "example_tool", 52 | Kind: "trino-execute-sql", 53 | Source: "my-trino-instance", 54 | Description: "some description", 55 | AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, 56 | }, 57 | }, 58 | }, 59 | } 60 | for _, tc := range tcs { 61 | t.Run(tc.desc, func(t *testing.T) { 62 | got := struct { 63 | Tools server.ToolConfigs `yaml:"tools"` 64 | }{} 65 | // Parse contents 66 | err := yaml.UnmarshalContext(ctx, testutils.FormatYaml(tc.in), &got) 67 | if err != nil { 68 | t.Fatalf("unable to unmarshal: %s", err) 69 | } 70 | if diff := cmp.Diff(tc.want, got.Tools); diff != "" { 71 | t.Fatalf("incorrect parse: diff %v", diff) 72 | } 73 | }) 74 | } 75 | } 76 | ``` -------------------------------------------------------------------------------- /internal/tools/firebird/firebirdexecutesql/firebirdexecutesql_test.go: -------------------------------------------------------------------------------- ```go 1 | // Copyright 2025 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package firebirdexecutesql_test 16 | 17 | import ( 18 | "testing" 19 | 20 | yaml "github.com/goccy/go-yaml" 21 | "github.com/google/go-cmp/cmp" 22 | "github.com/googleapis/genai-toolbox/internal/server" 23 | "github.com/googleapis/genai-toolbox/internal/testutils" 24 | "github.com/googleapis/genai-toolbox/internal/tools/firebird/firebirdexecutesql" 25 | ) 26 | 27 | func TestParseFromYamlExecuteSql(t *testing.T) { 28 | ctx, err := testutils.ContextWithNewLogger() 29 | if err != nil { 30 | t.Fatalf("unexpected error: %s", err) 31 | } 32 | tcs := []struct { 33 | desc string 34 | in string 35 | want server.ToolConfigs 36 | }{ 37 | { 38 | desc: "basic example", 39 | in: ` 40 | tools: 41 | example_tool: 42 | kind: firebird-execute-sql 43 | source: my-instance 44 | description: some description 45 | authRequired: 46 | - my-google-auth-service 47 | - other-auth-service 48 | `, 49 | want: server.ToolConfigs{ 50 | "example_tool": firebirdexecutesql.Config{ 51 | Name: "example_tool", 52 | Kind: "firebird-execute-sql", 53 | Source: "my-instance", 54 | Description: "some description", 55 | AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, 56 | }, 57 | }, 58 | }, 59 | } 60 | for _, tc := range tcs { 61 | t.Run(tc.desc, func(t *testing.T) { 62 | got := struct { 63 | Tools server.ToolConfigs `yaml:"tools"` 64 | }{} 65 | // Parse contents 66 | err := yaml.UnmarshalContext(ctx, testutils.FormatYaml(tc.in), &got) 67 | if err != nil { 68 | t.Fatalf("unable to unmarshal: %s", err) 69 | } 70 | if diff := cmp.Diff(tc.want, got.Tools); diff != "" { 71 | t.Fatalf("incorrect parse: diff %v", diff) 72 | } 73 | }) 74 | } 75 | 76 | } 77 | ``` -------------------------------------------------------------------------------- /internal/tools/postgres/postgresexecutesql/postgresexecutesql_test.go: -------------------------------------------------------------------------------- ```go 1 | // Copyright 2025 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package postgresexecutesql_test 16 | 17 | import ( 18 | "testing" 19 | 20 | yaml "github.com/goccy/go-yaml" 21 | "github.com/google/go-cmp/cmp" 22 | "github.com/googleapis/genai-toolbox/internal/server" 23 | "github.com/googleapis/genai-toolbox/internal/testutils" 24 | "github.com/googleapis/genai-toolbox/internal/tools/postgres/postgresexecutesql" 25 | ) 26 | 27 | func TestParseFromYamlExecuteSql(t *testing.T) { 28 | ctx, err := testutils.ContextWithNewLogger() 29 | if err != nil { 30 | t.Fatalf("unexpected error: %s", err) 31 | } 32 | tcs := []struct { 33 | desc string 34 | in string 35 | want server.ToolConfigs 36 | }{ 37 | { 38 | desc: "basic example", 39 | in: ` 40 | tools: 41 | example_tool: 42 | kind: postgres-execute-sql 43 | source: my-instance 44 | description: some description 45 | authRequired: 46 | - my-google-auth-service 47 | - other-auth-service 48 | `, 49 | want: server.ToolConfigs{ 50 | "example_tool": postgresexecutesql.Config{ 51 | Name: "example_tool", 52 | Kind: "postgres-execute-sql", 53 | Source: "my-instance", 54 | Description: "some description", 55 | AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, 56 | }, 57 | }, 58 | }, 59 | } 60 | for _, tc := range tcs { 61 | t.Run(tc.desc, func(t *testing.T) { 62 | got := struct { 63 | Tools server.ToolConfigs `yaml:"tools"` 64 | }{} 65 | // Parse contents 66 | err := yaml.UnmarshalContext(ctx, testutils.FormatYaml(tc.in), &got) 67 | if err != nil { 68 | t.Fatalf("unable to unmarshal: %s", err) 69 | } 70 | if diff := cmp.Diff(tc.want, got.Tools); diff != "" { 71 | t.Fatalf("incorrect parse: diff %v", diff) 72 | } 73 | }) 74 | } 75 | 76 | } 77 | ``` -------------------------------------------------------------------------------- /docs/en/resources/tools/neo4j/neo4j-schema.md: -------------------------------------------------------------------------------- ```markdown 1 | --- 2 | title: "neo4j-schema" 3 | type: "docs" 4 | weight: 1 5 | description: > 6 | A "neo4j-schema" tool extracts a comprehensive schema from a Neo4j 7 | database. 8 | aliases: 9 | - /resources/tools/neo4j-schema 10 | --- 11 | 12 | ## About 13 | 14 | A `neo4j-schema` tool connects to a Neo4j database and extracts its complete 15 | schema information. It runs multiple queries concurrently to efficiently gather 16 | details about node labels, relationships, properties, constraints, and indexes. 17 | 18 | The tool automatically detects if the APOC (Awesome Procedures on Cypher) 19 | library is available. If so, it uses APOC procedures like `apoc.meta.schema` for 20 | a highly detailed overview of the database structure; otherwise, it falls back 21 | to using native Cypher queries. 22 | 23 | The extracted schema is **cached** to improve performance for subsequent 24 | requests. The output is a structured JSON object containing all the schema 25 | details, which can be invaluable for providing database context to an LLM. This 26 | tool is compatible with a `neo4j` source and takes no parameters. 27 | 28 | ## Example 29 | 30 | ```yaml 31 | tools: 32 | get_movie_db_schema: 33 | kind: neo4j-schema 34 | source: my-neo4j-movies-instance 35 | description: | 36 | Use this tool to get the full schema of the movie database. 37 | This provides information on all available node labels (like Movie, Person), 38 | relationships (like ACTED_IN), and the properties on each. 39 | This tool takes no parameters. 40 | # Optional configuration to cache the schema for 2 hours 41 | cacheExpireMinutes: 120 42 | ``` 43 | 44 | ## Reference 45 | | **field** | **type** | **required** | **description** | 46 | |--------------------|:--------:|:------------:|---------------------------------------------------------| 47 | | kind | string | true | Must be `neo4j-schema`. | 48 | | source | string | true | Name of the source the schema should be extracted from. | 49 | | description | string | true | Description of the tool that is passed to the LLM. | 50 | | cacheExpireMinutes | integer | false | Cache expiration time in minutes. Defaults to 60. | 51 | ``` -------------------------------------------------------------------------------- /internal/tools/mysql/mysqllisttables/mysqllisttables_test.go: -------------------------------------------------------------------------------- ```go 1 | // Copyright 2025 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package mysqllisttables_test 16 | 17 | import ( 18 | "testing" 19 | 20 | yaml "github.com/goccy/go-yaml" 21 | "github.com/google/go-cmp/cmp" 22 | "github.com/googleapis/genai-toolbox/internal/server" 23 | "github.com/googleapis/genai-toolbox/internal/testutils" 24 | mysqllisttables "github.com/googleapis/genai-toolbox/internal/tools/mysql/mysqllisttables" 25 | ) 26 | 27 | func TestParseFromYamlMySQLListTables(t *testing.T) { 28 | ctx, err := testutils.ContextWithNewLogger() 29 | if err != nil { 30 | t.Fatalf("unexpected error: %s", err) 31 | } 32 | tcs := []struct { 33 | desc string 34 | in string 35 | want server.ToolConfigs 36 | }{ 37 | { 38 | desc: "basic example", 39 | in: ` 40 | tools: 41 | example_tool: 42 | kind: mysql-list-tables 43 | source: my-mysql-instance 44 | description: some description 45 | authRequired: 46 | - my-google-auth-service 47 | - other-auth-service 48 | `, 49 | want: server.ToolConfigs{ 50 | "example_tool": mysqllisttables.Config{ 51 | Name: "example_tool", 52 | Kind: "mysql-list-tables", 53 | Source: "my-mysql-instance", 54 | Description: "some description", 55 | AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, 56 | }, 57 | }, 58 | }, 59 | } 60 | for _, tc := range tcs { 61 | t.Run(tc.desc, func(t *testing.T) { 62 | got := struct { 63 | Tools server.ToolConfigs `yaml:"tools"` 64 | }{} 65 | // Parse contents 66 | err := yaml.UnmarshalContext(ctx, testutils.FormatYaml(tc.in), &got) 67 | if err != nil { 68 | t.Fatalf("unable to unmarshal: %s", err) 69 | } 70 | if diff := cmp.Diff(tc.want, got.Tools); diff != "" { 71 | t.Fatalf("incorrect parse: diff %v", diff) 72 | } 73 | }) 74 | } 75 | } 76 | ``` -------------------------------------------------------------------------------- /docs/en/resources/tools/alloydb/alloydb-list-instances.md: -------------------------------------------------------------------------------- ```markdown 1 | --- 2 | title: alloydb-list-instances 3 | type: docs 4 | weight: 1 5 | description: "The \"alloydb-list-instances\" tool lists the AlloyDB instances for a given project, cluster and location.\n" 6 | aliases: [/resources/tools/alloydb-list-instances] 7 | --- 8 | 9 | ## About 10 | 11 | The `alloydb-list-instances` tool retrieves AlloyDB instance information for all 12 | or specified clusters and locations in a given project. It is compatible with 13 | [alloydb-admin](../../sources/alloydb-admin.md) source. 14 | 15 | `alloydb-list-instances` tool lists the detailed information of AlloyDB 16 | instances (instance name, type, IP address, state, configuration, etc) for a 17 | given project, cluster and location. The tool takes the following input 18 | parameters: 19 | 20 | | Parameter | Type | Description | Required | 21 | | :--------- | :----- | :--------------------------------------------------------------------------------------------------------- | :------- | 22 | | `project` | string | The GCP project ID to list instances for. | Yes | 23 | | `cluster` | string | The ID of the cluster to list instances from. Use '-' to get results for all clusters. Default: `-`. | No | 24 | | `location` | string | The location of the cluster (e.g., 'us-central1'). Use '-' to get results for all locations. Default: `-`. | No | 25 | 26 | ## Example 27 | 28 | ```yaml 29 | tools: 30 | list_instances: 31 | kind: alloydb-list-instances 32 | source: alloydb-admin-source 33 | description: Use this tool to list all AlloyDB instances for a given project, cluster and location. 34 | ``` 35 | 36 | ## Reference 37 | 38 | | **field** | **type** | **required** | **description** | 39 | | ----------- | :------: | :----------: | ---------------------------------------------------- | 40 | | kind | string | true | Must be alloydb-list-instances. | 41 | | source | string | true | The name of an `alloydb-admin` source. | 42 | | description | string | false | Description of the tool that is passed to the agent. | 43 | ``` -------------------------------------------------------------------------------- /internal/tools/mssql/mssqllisttables/mssqllisttables_test.go: -------------------------------------------------------------------------------- ```go 1 | // Copyright 2025 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package mssqllisttables_test 16 | 17 | import ( 18 | "testing" 19 | 20 | yaml "github.com/goccy/go-yaml" 21 | "github.com/google/go-cmp/cmp" 22 | "github.com/googleapis/genai-toolbox/internal/server" 23 | "github.com/googleapis/genai-toolbox/internal/testutils" 24 | mssqllisttables "github.com/googleapis/genai-toolbox/internal/tools/mssql/mssqllisttables" 25 | ) 26 | 27 | func TestParseFromYamlmssqlListTables(t *testing.T) { 28 | ctx, err := testutils.ContextWithNewLogger() 29 | if err != nil { 30 | t.Fatalf("unexpected error: %s", err) 31 | } 32 | tcs := []struct { 33 | desc string 34 | in string 35 | want server.ToolConfigs 36 | }{ 37 | { 38 | desc: "basic example", 39 | in: ` 40 | tools: 41 | example_tool: 42 | kind: mssql-list-tables 43 | source: my-mssql-instance 44 | description: some description 45 | authRequired: 46 | - my-google-auth-service 47 | - other-auth-service 48 | `, 49 | want: server.ToolConfigs{ 50 | "example_tool": mssqllisttables.Config{ 51 | Name: "example_tool", 52 | Kind: "mssql-list-tables", 53 | Source: "my-mssql-instance", 54 | Description: "some description", 55 | AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, 56 | }, 57 | }, 58 | }, 59 | } 60 | for _, tc := range tcs { 61 | t.Run(tc.desc, func(t *testing.T) { 62 | got := struct { 63 | Tools server.ToolConfigs `yaml:"tools"` 64 | }{} 65 | // Parse contents 66 | err := yaml.UnmarshalContext(ctx, testutils.FormatYaml(tc.in), &got) 67 | if err != nil { 68 | t.Fatalf("unable to unmarshal: %s", err) 69 | } 70 | if diff := cmp.Diff(tc.want, got.Tools); diff != "" { 71 | t.Fatalf("incorrect parse: diff %v", diff) 72 | } 73 | }) 74 | } 75 | 76 | } 77 | ``` -------------------------------------------------------------------------------- /internal/tools/mysql/mysqllistactivequeries/mysqllistactivequeries_test.go: -------------------------------------------------------------------------------- ```go 1 | // Copyright 2025 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package mysqllistactivequeries_test 16 | 17 | import ( 18 | "testing" 19 | 20 | yaml "github.com/goccy/go-yaml" 21 | "github.com/google/go-cmp/cmp" 22 | "github.com/googleapis/genai-toolbox/internal/server" 23 | "github.com/googleapis/genai-toolbox/internal/testutils" 24 | "github.com/googleapis/genai-toolbox/internal/tools/mysql/mysqllistactivequeries" 25 | ) 26 | 27 | func TestParseFromYamlExecuteSql(t *testing.T) { 28 | ctx, err := testutils.ContextWithNewLogger() 29 | if err != nil { 30 | t.Fatalf("unexpected error: %s", err) 31 | } 32 | tcs := []struct { 33 | desc string 34 | in string 35 | want server.ToolConfigs 36 | }{ 37 | { 38 | desc: "basic example", 39 | in: ` 40 | tools: 41 | example_tool: 42 | kind: mysql-list-active-queries 43 | source: my-instance 44 | description: some description 45 | authRequired: 46 | - my-google-auth-service 47 | - other-auth-service 48 | `, 49 | want: server.ToolConfigs{ 50 | "example_tool": mysqllistactivequeries.Config{ 51 | Name: "example_tool", 52 | Kind: "mysql-list-active-queries", 53 | Source: "my-instance", 54 | Description: "some description", 55 | AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, 56 | }, 57 | }, 58 | }, 59 | } 60 | for _, tc := range tcs { 61 | t.Run(tc.desc, func(t *testing.T) { 62 | got := struct { 63 | Tools server.ToolConfigs `yaml:"tools"` 64 | }{} 65 | // Parse contents 66 | err := yaml.UnmarshalContext(ctx, testutils.FormatYaml(tc.in), &got) 67 | if err != nil { 68 | t.Fatalf("unable to unmarshal: %s", err) 69 | } 70 | if diff := cmp.Diff(tc.want, got.Tools); diff != "" { 71 | t.Fatalf("incorrect parse: diff %v", diff) 72 | } 73 | }) 74 | } 75 | 76 | } 77 | ``` -------------------------------------------------------------------------------- /docs/en/getting-started/quickstart/python/llamaindex/quickstart.py: -------------------------------------------------------------------------------- ```python 1 | import asyncio 2 | import os 3 | 4 | from llama_index.core.agent.workflow import AgentWorkflow 5 | 6 | from llama_index.core.workflow import Context 7 | 8 | # TODO(developer): replace this with another import if needed 9 | 10 | from llama_index.llms.google_genai import GoogleGenAI 11 | 12 | # from llama_index.llms.anthropic import Anthropic 13 | 14 | from toolbox_llamaindex import ToolboxClient 15 | 16 | project = os.environ.get("GCP_PROJECT") or "project-id" 17 | 18 | prompt = """ 19 | You're a helpful hotel assistant. You handle hotel searching, booking and 20 | cancellations. When the user searches for a hotel, mention it's name, id, 21 | location and price tier. Always mention hotel ids while performing any 22 | searches. This is very important for any operations. For any bookings or 23 | cancellations, please provide the appropriate confirmation. Be sure to 24 | update checkin or checkout dates if mentioned by the user. 25 | Don't ask for confirmations from the user. 26 | """ 27 | 28 | queries = [ 29 | "Find hotels in Basel with Basel in its name.", 30 | "Can you book the Hilton Basel for me?", 31 | "Oh wait, this is too expensive. Please cancel it and book the Hyatt Regency instead.", 32 | "My check in dates would be from April 10, 2024 to April 19, 2024.", 33 | ] 34 | 35 | async def main(): 36 | # TODO(developer): replace this with another model if needed 37 | llm = GoogleGenAI( 38 | model="gemini-2.0-flash-001", 39 | vertexai_config={"project": project, "location": "us-central1"}, 40 | ) 41 | # llm = GoogleGenAI( 42 | # api_key=os.getenv("GOOGLE_API_KEY"), 43 | # model="gemini-2.0-flash-001", 44 | # ) 45 | # llm = Anthropic( 46 | # model="claude-3-7-sonnet-latest", 47 | # api_key=os.getenv("ANTHROPIC_API_KEY") 48 | # ) 49 | 50 | # Load the tools from the Toolbox server 51 | async with ToolboxClient("http://127.0.0.1:5000") as client: 52 | tools = await client.aload_toolset() 53 | 54 | agent = AgentWorkflow.from_tools_or_functions( 55 | tools, 56 | llm=llm, 57 | system_prompt=prompt, 58 | ) 59 | ctx = Context(agent) 60 | for query in queries: 61 | response = await agent.run(user_msg=query, ctx=ctx) 62 | print(f"---- {query} ----") 63 | print(str(response)) 64 | 65 | asyncio.run(main()) 66 | ``` -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/question.yml: -------------------------------------------------------------------------------- ```yaml 1 | # Copyright 2025 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | name: 💬 Question 16 | description: Questions on how something works or the best way to do something? 17 | title: "<brief summary of the question>" 18 | labels: ["type: question"] 19 | 20 | body: 21 | - type: markdown 22 | attributes: 23 | value: | 24 | Thanks for helping us improve! 🙏 Please provide as much information as possible about your question. 25 | 26 | - id: preamble 27 | type: checkboxes 28 | attributes: 29 | label: Prerequisites 30 | description: | 31 | Please run through the following list and make sure you've tried the usual "quick fixes": 32 | options: 33 | - label: "Search the [current open issues](https://github.com/googleapis/genai-toolbox/issues)" 34 | required: true 35 | 36 | - type: textarea 37 | id: question 38 | attributes: 39 | label: Question 40 | description: "What's your question? Please provide as much relevant information as possible to reduce turnaround time. Include information like what environment, language, or framework you are using." 41 | placeholder: "Example: How do I connect using private IP with the AlloyDB source?" 42 | validations: 43 | required: true 44 | 45 | - type: textarea 46 | id: code 47 | attributes: 48 | label: Code 49 | description: "Please paste any useful application code that might be relevant to your question. (if your code is in a public repo, feel free to paste a link!)" 50 | 51 | - type: textarea 52 | id: additional-details 53 | attributes: 54 | label: Additional Details 55 | description: "Any other information you want us to know that might be helpful in answering your question? (link issues, PRs, descriptions, or screenshots)." 56 | ``` -------------------------------------------------------------------------------- /internal/tools/mysql/mysqllisttablefragmentation/mysqllisttablefragmentation_test.go: -------------------------------------------------------------------------------- ```go 1 | // Copyright 2025 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package mysqllisttablefragmentation_test 16 | 17 | import ( 18 | "testing" 19 | 20 | yaml "github.com/goccy/go-yaml" 21 | "github.com/google/go-cmp/cmp" 22 | "github.com/googleapis/genai-toolbox/internal/server" 23 | "github.com/googleapis/genai-toolbox/internal/testutils" 24 | "github.com/googleapis/genai-toolbox/internal/tools/mysql/mysqllisttablefragmentation" 25 | ) 26 | 27 | func TestParseFromYamlExecuteSql(t *testing.T) { 28 | ctx, err := testutils.ContextWithNewLogger() 29 | if err != nil { 30 | t.Fatalf("unexpected error: %s", err) 31 | } 32 | tcs := []struct { 33 | desc string 34 | in string 35 | want server.ToolConfigs 36 | }{ 37 | { 38 | desc: "basic example", 39 | in: ` 40 | tools: 41 | example_tool: 42 | kind: mysql-list-table-fragmentation 43 | source: my-instance 44 | description: some description 45 | authRequired: 46 | - my-google-auth-service 47 | - other-auth-service 48 | `, 49 | want: server.ToolConfigs{ 50 | "example_tool": mysqllisttablefragmentation.Config{ 51 | Name: "example_tool", 52 | Kind: "mysql-list-table-fragmentation", 53 | Source: "my-instance", 54 | Description: "some description", 55 | AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, 56 | }, 57 | }, 58 | }, 59 | } 60 | for _, tc := range tcs { 61 | t.Run(tc.desc, func(t *testing.T) { 62 | got := struct { 63 | Tools server.ToolConfigs `yaml:"tools"` 64 | }{} 65 | // Parse contents 66 | err := yaml.UnmarshalContext(ctx, testutils.FormatYaml(tc.in), &got) 67 | if err != nil { 68 | t.Fatalf("unable to unmarshal: %s", err) 69 | } 70 | if diff := cmp.Diff(tc.want, got.Tools); diff != "" { 71 | t.Fatalf("incorrect parse: diff %v", diff) 72 | } 73 | }) 74 | } 75 | 76 | } 77 | ``` -------------------------------------------------------------------------------- /internal/tools/postgres/postgreslisttables/postgreslisttables_test.go: -------------------------------------------------------------------------------- ```go 1 | // Copyright 2025 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package postgreslisttables_test 16 | 17 | import ( 18 | "testing" 19 | 20 | yaml "github.com/goccy/go-yaml" 21 | "github.com/google/go-cmp/cmp" 22 | "github.com/googleapis/genai-toolbox/internal/server" 23 | "github.com/googleapis/genai-toolbox/internal/testutils" 24 | postgreslisttables "github.com/googleapis/genai-toolbox/internal/tools/postgres/postgreslisttables" 25 | ) 26 | 27 | func TestParseFromYamlPostgresListTables(t *testing.T) { 28 | ctx, err := testutils.ContextWithNewLogger() 29 | if err != nil { 30 | t.Fatalf("unexpected error: %s", err) 31 | } 32 | tcs := []struct { 33 | desc string 34 | in string 35 | want server.ToolConfigs 36 | }{ 37 | { 38 | desc: "basic example", 39 | in: ` 40 | tools: 41 | example_tool: 42 | kind: postgres-list-tables 43 | source: my-postgres-instance 44 | description: some description 45 | authRequired: 46 | - my-google-auth-service 47 | - other-auth-service 48 | `, 49 | want: server.ToolConfigs{ 50 | "example_tool": postgreslisttables.Config{ 51 | Name: "example_tool", 52 | Kind: "postgres-list-tables", 53 | Source: "my-postgres-instance", 54 | Description: "some description", 55 | AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, 56 | }, 57 | }, 58 | }, 59 | } 60 | for _, tc := range tcs { 61 | t.Run(tc.desc, func(t *testing.T) { 62 | got := struct { 63 | Tools server.ToolConfigs `yaml:"tools"` 64 | }{} 65 | // Parse contents 66 | err := yaml.UnmarshalContext(ctx, testutils.FormatYaml(tc.in), &got) 67 | if err != nil { 68 | t.Fatalf("unable to unmarshal: %s", err) 69 | } 70 | if diff := cmp.Diff(tc.want, got.Tools); diff != "" { 71 | t.Fatalf("incorrect parse: diff %v", diff) 72 | } 73 | }) 74 | } 75 | 76 | } 77 | ``` -------------------------------------------------------------------------------- /docs/en/getting-started/quickstart/python/quickstart_test.py: -------------------------------------------------------------------------------- ```python 1 | # Copyright 2025 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import os 16 | import pytest 17 | from pathlib import Path 18 | import asyncio 19 | import sys 20 | import importlib.util 21 | 22 | ORCH_NAME = os.environ.get("ORCH_NAME") 23 | module_path = f"python.{ORCH_NAME}.quickstart" 24 | quickstart = importlib.import_module(module_path) 25 | 26 | 27 | @pytest.fixture(scope="module") 28 | def golden_keywords(): 29 | """Loads expected keywords from the golden.txt file.""" 30 | golden_file_path = Path("../golden.txt") 31 | if not golden_file_path.exists(): 32 | pytest.fail(f"Golden file not found: {golden_file_path}") 33 | try: 34 | with open(golden_file_path, 'r') as f: 35 | return [line.strip() for line in f.readlines() if line.strip()] 36 | except Exception as e: 37 | pytest.fail(f"Could not read golden.txt: {e}") 38 | 39 | 40 | # --- Execution Tests --- 41 | class TestExecution: 42 | """Test framework execution and output validation.""" 43 | 44 | @pytest.fixture(scope="function") 45 | def script_output(self, capsys): 46 | """Run the quickstart function and return its output.""" 47 | asyncio.run(quickstart.main()) 48 | return capsys.readouterr() 49 | 50 | def test_script_runs_without_errors(self, script_output): 51 | """Test that the script runs and produces no stderr.""" 52 | assert script_output.err == "", f"Script produced stderr: {script_output.err}" 53 | 54 | def test_keywords_in_output(self, script_output, golden_keywords): 55 | """Test that expected keywords are present in the script's output.""" 56 | output = script_output.out 57 | missing_keywords = [kw for kw in golden_keywords if kw not in output] 58 | assert not missing_keywords, f"Missing keywords in output: {missing_keywords}" 59 | ``` -------------------------------------------------------------------------------- /internal/tools/oceanbase/oceanbaseexecutesql/oceanbaseexecutesql_test.go: -------------------------------------------------------------------------------- ```go 1 | // Copyright 2025 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package oceanbaseexecutesql_test 16 | 17 | import ( 18 | "testing" 19 | 20 | yaml "github.com/goccy/go-yaml" 21 | "github.com/google/go-cmp/cmp" 22 | "github.com/googleapis/genai-toolbox/internal/server" 23 | "github.com/googleapis/genai-toolbox/internal/testutils" 24 | "github.com/googleapis/genai-toolbox/internal/tools/oceanbase/oceanbaseexecutesql" 25 | ) 26 | 27 | // Test parsing OceanBase Execute SQL tool config from YAML. 28 | func TestParseFromYamlExecuteSql(t *testing.T) { 29 | ctx, err := testutils.ContextWithNewLogger() 30 | if err != nil { 31 | t.Fatalf("unexpected error: %s", err) 32 | } 33 | tcs := []struct { 34 | desc string 35 | in string 36 | want server.ToolConfigs 37 | }{ 38 | { 39 | desc: "basic example", 40 | in: ` 41 | tools: 42 | example_tool: 43 | kind: oceanbase-execute-sql 44 | source: my-instance 45 | description: some description 46 | authRequired: 47 | - my-google-auth-service 48 | - other-auth-service 49 | `, 50 | want: server.ToolConfigs{ 51 | "example_tool": oceanbaseexecutesql.Config{ 52 | Name: "example_tool", 53 | Kind: "oceanbase-execute-sql", 54 | Source: "my-instance", 55 | Description: "some description", 56 | AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, 57 | }, 58 | }, 59 | }, 60 | } 61 | for _, tc := range tcs { 62 | t.Run(tc.desc, func(t *testing.T) { 63 | got := struct { 64 | Tools server.ToolConfigs `yaml:"tools"` 65 | }{} 66 | // Parse contents 67 | err := yaml.UnmarshalContext(ctx, testutils.FormatYaml(tc.in), &got) 68 | if err != nil { 69 | t.Fatalf("unable to unmarshal: %s", err) 70 | } 71 | if diff := cmp.Diff(tc.want, got.Tools); diff != "" { 72 | t.Fatalf("incorrect parse: diff %v", diff) 73 | } 74 | }) 75 | } 76 | } 77 | ``` -------------------------------------------------------------------------------- /docs/en/getting-started/quickstart/js/quickstart.test.js: -------------------------------------------------------------------------------- ```javascript 1 | // Copyright 2025 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import { describe, test, before, after } from "node:test"; 16 | import assert from "node:assert/strict"; 17 | import fs from "fs"; 18 | import path from "path"; 19 | import { fileURLToPath } from "url"; 20 | 21 | const ORCH_NAME = process.env.ORCH_NAME; 22 | const __dirname = path.dirname(fileURLToPath(import.meta.url)); 23 | const orchDir = path.join(__dirname, ORCH_NAME); 24 | const quickstartPath = path.join(orchDir, "quickstart.js"); 25 | 26 | const { main: runAgent } = await import(quickstartPath); 27 | 28 | const GOLDEN_FILE_PATH = path.resolve(__dirname, "../golden.txt"); 29 | 30 | describe(`${ORCH_NAME} Quickstart Agent`, () => { 31 | let capturedOutput = []; 32 | let originalLog; 33 | 34 | before(() => { 35 | originalLog = console.log; 36 | console.log = (msg) => { 37 | capturedOutput.push(msg); 38 | }; 39 | }); 40 | 41 | after(() => { 42 | console.log = originalLog; 43 | }); 44 | 45 | test("outputContainsRequiredKeywords", async () => { 46 | capturedOutput = []; 47 | await runAgent(); 48 | const actualOutput = capturedOutput.join("\n"); 49 | 50 | assert.ok( 51 | actualOutput.length > 0, 52 | "Assertion Failed: Script ran successfully but produced no output." 53 | ); 54 | 55 | const goldenFile = fs.readFileSync(GOLDEN_FILE_PATH, "utf8"); 56 | const keywords = goldenFile.split("\n").filter((kw) => kw.trim() !== ""); 57 | const missingKeywords = []; 58 | 59 | for (const keyword of keywords) { 60 | if (!actualOutput.toLowerCase().includes(keyword.toLowerCase())) { 61 | missingKeywords.push(keyword); 62 | } 63 | } 64 | 65 | assert.ok( 66 | missingKeywords.length === 0, 67 | `Assertion Failed: The following keywords were missing from the output: [${missingKeywords.join(", ")}]` 68 | ); 69 | }); 70 | }); ``` -------------------------------------------------------------------------------- /internal/tools/mysql/mysqllisttablesmissinguniqueindexes/mysqllisttablesmissinguniqueindexes_test.go: -------------------------------------------------------------------------------- ```go 1 | // Copyright 2025 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package mysqllisttablesmissinguniqueindexes_test 16 | 17 | import ( 18 | "testing" 19 | 20 | yaml "github.com/goccy/go-yaml" 21 | "github.com/google/go-cmp/cmp" 22 | "github.com/googleapis/genai-toolbox/internal/server" 23 | "github.com/googleapis/genai-toolbox/internal/testutils" 24 | "github.com/googleapis/genai-toolbox/internal/tools/mysql/mysqllisttablesmissinguniqueindexes" 25 | ) 26 | 27 | func TestParseFromYamlExecuteSql(t *testing.T) { 28 | ctx, err := testutils.ContextWithNewLogger() 29 | if err != nil { 30 | t.Fatalf("unexpected error: %s", err) 31 | } 32 | tcs := []struct { 33 | desc string 34 | in string 35 | want server.ToolConfigs 36 | }{ 37 | { 38 | desc: "basic example", 39 | in: ` 40 | tools: 41 | example_tool: 42 | kind: mysql-list-tables-missing-unique-indexes 43 | source: my-instance 44 | description: some description 45 | authRequired: 46 | - my-google-auth-service 47 | - other-auth-service 48 | `, 49 | want: server.ToolConfigs{ 50 | "example_tool": mysqllisttablesmissinguniqueindexes.Config{ 51 | Name: "example_tool", 52 | Kind: "mysql-list-tables-missing-unique-indexes", 53 | Source: "my-instance", 54 | Description: "some description", 55 | AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, 56 | }, 57 | }, 58 | }, 59 | } 60 | for _, tc := range tcs { 61 | t.Run(tc.desc, func(t *testing.T) { 62 | got := struct { 63 | Tools server.ToolConfigs `yaml:"tools"` 64 | }{} 65 | // Parse contents 66 | err := yaml.UnmarshalContext(ctx, testutils.FormatYaml(tc.in), &got) 67 | if err != nil { 68 | t.Fatalf("unable to unmarshal: %s", err) 69 | } 70 | if diff := cmp.Diff(tc.want, got.Tools); diff != "" { 71 | t.Fatalf("incorrect parse: diff %v", diff) 72 | } 73 | }) 74 | } 75 | 76 | } 77 | ``` -------------------------------------------------------------------------------- /internal/auth/google/google.go: -------------------------------------------------------------------------------- ```go 1 | // Copyright 2024 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package google 16 | 17 | import ( 18 | "context" 19 | "fmt" 20 | "net/http" 21 | 22 | "github.com/googleapis/genai-toolbox/internal/auth" 23 | "google.golang.org/api/idtoken" 24 | ) 25 | 26 | const AuthServiceKind string = "google" 27 | 28 | // validate interface 29 | var _ auth.AuthServiceConfig = Config{} 30 | 31 | // Auth service configuration 32 | type Config struct { 33 | Name string `yaml:"name" validate:"required"` 34 | Kind string `yaml:"kind" validate:"required"` 35 | ClientID string `yaml:"clientId" validate:"required"` 36 | } 37 | 38 | // Returns the auth service kind 39 | func (cfg Config) AuthServiceConfigKind() string { 40 | return AuthServiceKind 41 | } 42 | 43 | // Initialize a Google auth service 44 | func (cfg Config) Initialize() (auth.AuthService, error) { 45 | a := &AuthService{ 46 | Name: cfg.Name, 47 | Kind: AuthServiceKind, 48 | ClientID: cfg.ClientID, 49 | } 50 | return a, nil 51 | } 52 | 53 | var _ auth.AuthService = AuthService{} 54 | 55 | // struct used to store auth service info 56 | type AuthService struct { 57 | Name string `yaml:"name"` 58 | Kind string `yaml:"kind"` 59 | ClientID string `yaml:"clientId"` 60 | } 61 | 62 | // Returns the auth service kind 63 | func (a AuthService) AuthServiceKind() string { 64 | return AuthServiceKind 65 | } 66 | 67 | // Returns the name of the auth service 68 | func (a AuthService) GetName() string { 69 | return a.Name 70 | } 71 | 72 | // Verifies Google ID token and return claims 73 | func (a AuthService) GetClaimsFromHeader(ctx context.Context, h http.Header) (map[string]any, error) { 74 | if token := h.Get(a.Name + "_token"); token != "" { 75 | payload, err := idtoken.Validate(ctx, token, a.ClientID) 76 | if err != nil { 77 | return nil, fmt.Errorf("Google ID token verification failure: %w", err) //nolint:staticcheck 78 | } 79 | return payload.Claims, nil 80 | } 81 | return nil, nil 82 | } 83 | ``` -------------------------------------------------------------------------------- /internal/tools/alloydb/alloydbwaitforoperation/alloydbwaitforoperation_test.go: -------------------------------------------------------------------------------- ```go 1 | // Copyright 2025 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package alloydbwaitforoperation_test 16 | 17 | import ( 18 | "testing" 19 | 20 | yaml "github.com/goccy/go-yaml" 21 | "github.com/google/go-cmp/cmp" 22 | "github.com/googleapis/genai-toolbox/internal/server" 23 | "github.com/googleapis/genai-toolbox/internal/testutils" 24 | alloydbwaitforoperation "github.com/googleapis/genai-toolbox/internal/tools/alloydb/alloydbwaitforoperation" 25 | ) 26 | 27 | func TestParseFromYaml(t *testing.T) { 28 | ctx, err := testutils.ContextWithNewLogger() 29 | if err != nil { 30 | t.Fatalf("unexpected error: %s", err) 31 | } 32 | tcs := []struct { 33 | desc string 34 | in string 35 | want server.ToolConfigs 36 | }{ 37 | { 38 | desc: "basic example", 39 | in: ` 40 | tools: 41 | wait-for-thing: 42 | kind: alloydb-wait-for-operation 43 | source: some-source 44 | description: some description 45 | delay: 1s 46 | maxDelay: 5s 47 | multiplier: 1.5 48 | maxRetries: 5 49 | `, 50 | want: server.ToolConfigs{ 51 | "wait-for-thing": alloydbwaitforoperation.Config{ 52 | Name: "wait-for-thing", 53 | Kind: "alloydb-wait-for-operation", 54 | Source: "some-source", 55 | Description: "some description", 56 | AuthRequired: []string{}, 57 | Delay: "1s", 58 | MaxDelay: "5s", 59 | Multiplier: 1.5, 60 | MaxRetries: 5, 61 | }, 62 | }, 63 | }, 64 | } 65 | for _, tc := range tcs { 66 | t.Run(tc.desc, func(t *testing.T) { 67 | got := struct { 68 | Tools server.ToolConfigs `yaml:"tools"` 69 | }{} 70 | // Parse contents 71 | err := yaml.UnmarshalContext(ctx, testutils.FormatYaml(tc.in), &got) 72 | if err != nil { 73 | t.Fatalf("unable to unmarshal: %s", err) 74 | } 75 | if diff := cmp.Diff(tc.want, got.Tools); diff != "" { 76 | t.Fatalf("incorrect parse: diff %v", diff) 77 | } 78 | }) 79 | } 80 | } 81 | ``` -------------------------------------------------------------------------------- /internal/server/static/js/navbar.js: -------------------------------------------------------------------------------- ```javascript 1 | // Copyright 2025 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * Renders the navigation bar HTML content into the specified container element. 17 | * @param {string} containerId The ID of the DOM element to inject the navbar into. 18 | * @param {string | null} activePath The active tab from the navbar. 19 | */ 20 | function renderNavbar(containerId, activePath) { 21 | const navbarContainer = document.getElementById(containerId); 22 | if (!navbarContainer) { 23 | console.error(`Navbar container with ID "${containerId}" not found.`); 24 | return; 25 | } 26 | 27 | const navbarHTML = ` 28 | <nav class="left-nav"> 29 | <div class="nav-logo"> 30 | <img src="/ui/assets/mcptoolboxlogo.png" alt="App Logo"> 31 | </div> 32 | <ul> 33 | <!--<li><a href="/ui/sources">Sources</a></li>--> 34 | <!--<li><a href="/ui/authservices">Auth Services</a></li>--> 35 | <li><a href="/ui/tools">Tools</a></li> 36 | <li><a href="/ui/toolsets">Toolsets</a></li> 37 | </ul> 38 | </nav> 39 | `; 40 | 41 | navbarContainer.innerHTML = navbarHTML; 42 | 43 | const logoImage = navbarContainer.querySelector('.nav-logo img'); 44 | if (logoImage) { 45 | logoImage.addEventListener('click', () => { 46 | window.location.href = '/ui/'; 47 | }); 48 | } 49 | 50 | if (activePath) { 51 | const navLinks = navbarContainer.querySelectorAll('.left-nav ul li a'); 52 | navLinks.forEach(link => { 53 | const linkPath = new URL(link.href).pathname; 54 | if (linkPath === activePath) { 55 | link.classList.add('active'); 56 | } else { 57 | link.classList.remove('active'); 58 | } 59 | }); 60 | } 61 | } 62 | ``` -------------------------------------------------------------------------------- /internal/tools/cloudsql/cloudsqlwaitforoperation/cloudsqlwaitforoperation_test.go: -------------------------------------------------------------------------------- ```go 1 | // Copyright 2025 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package cloudsqlwaitforoperation_test 16 | 17 | import ( 18 | "testing" 19 | 20 | yaml "github.com/goccy/go-yaml" 21 | "github.com/google/go-cmp/cmp" 22 | "github.com/googleapis/genai-toolbox/internal/server" 23 | "github.com/googleapis/genai-toolbox/internal/testutils" 24 | cloudsqlwaitforoperation "github.com/googleapis/genai-toolbox/internal/tools/cloudsql/cloudsqlwaitforoperation" 25 | ) 26 | 27 | func TestParseFromYaml(t *testing.T) { 28 | ctx, err := testutils.ContextWithNewLogger() 29 | if err != nil { 30 | t.Fatalf("unexpected error: %s", err) 31 | } 32 | tcs := []struct { 33 | desc string 34 | in string 35 | want server.ToolConfigs 36 | }{ 37 | { 38 | desc: "basic example", 39 | in: ` 40 | tools: 41 | wait-for-thing: 42 | kind: cloud-sql-wait-for-operation 43 | source: some-source 44 | description: some description 45 | delay: 1s 46 | maxDelay: 5s 47 | multiplier: 1.5 48 | maxRetries: 5 49 | `, 50 | want: server.ToolConfigs{ 51 | "wait-for-thing": cloudsqlwaitforoperation.Config{ 52 | Name: "wait-for-thing", 53 | Kind: "cloud-sql-wait-for-operation", 54 | Source: "some-source", 55 | Description: "some description", 56 | AuthRequired: []string{}, 57 | Delay: "1s", 58 | MaxDelay: "5s", 59 | Multiplier: 1.5, 60 | MaxRetries: 5, 61 | }, 62 | }, 63 | }, 64 | } 65 | for _, tc := range tcs { 66 | t.Run(tc.desc, func(t *testing.T) { 67 | got := struct { 68 | Tools server.ToolConfigs `yaml:"tools"` 69 | }{} 70 | // Parse contents 71 | err := yaml.UnmarshalContext(ctx, testutils.FormatYaml(tc.in), &got) 72 | if err != nil { 73 | t.Fatalf("unable to unmarshal: %s", err) 74 | } 75 | if diff := cmp.Diff(tc.want, got.Tools); diff != "" { 76 | t.Fatalf("incorrect parse: diff %v", diff) 77 | } 78 | }) 79 | } 80 | } 81 | ``` -------------------------------------------------------------------------------- /docs/en/resources/tools/looker/looker-make-look.md: -------------------------------------------------------------------------------- ```markdown 1 | --- 2 | title: "looker-make-look" 3 | type: docs 4 | weight: 1 5 | description: > 6 | "looker-make-look" generates a Looker look in the users personal folder in 7 | Looker 8 | aliases: 9 | - /resources/tools/looker-make-look 10 | --- 11 | 12 | ## About 13 | 14 | The `looker-make-look` creates a saved Look in the user's 15 | Looker personal folder. 16 | 17 | It's compatible with the following sources: 18 | 19 | - [looker](../../sources/looker.md) 20 | 21 | `looker-make-look` takes eleven parameters: 22 | 23 | 1. the `model` 24 | 2. the `explore` 25 | 3. the `fields` list 26 | 4. an optional set of `filters` 27 | 5. an optional set of `pivots` 28 | 6. an optional set of `sorts` 29 | 7. an optional `limit` 30 | 8. an optional `tz` 31 | 9. an optional `vis_config` 32 | 10. the `title` 33 | 11. an optional `description` 34 | 35 | ## Example 36 | 37 | ```yaml 38 | tools: 39 | make_look: 40 | kind: looker-make-look 41 | source: looker-source 42 | description: | 43 | make_look Tool 44 | 45 | This tool creates a new look in Looker, using the query 46 | parameters and the vis_config specified. 47 | 48 | Most of the parameters are the same as the query_url 49 | tool. In addition, there is a title and a description 50 | that must be provided. 51 | 52 | The newly created look will be created in the user's 53 | personal folder in looker. The look name must be unique. 54 | 55 | The result is a json document with a link to the newly 56 | created look. 57 | ``` 58 | 59 | ## Reference 60 | 61 | | **field** | **type** | **required** | **description** | 62 | |-------------|:------------------------------------------:|:------------:|--------------------------------------------------------------------------------------------------| 63 | | kind | string | true | Must be "looker-make-look" | 64 | | source | string | true | Name of the source the SQL should execute on. | 65 | | description | string | true | Description of the tool that is passed to the LLM. | 66 | ``` -------------------------------------------------------------------------------- /internal/server/static/js/toolsets.js: -------------------------------------------------------------------------------- ```javascript 1 | // Copyright 2025 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import { loadTools } from "./loadTools.js"; 16 | 17 | document.addEventListener('DOMContentLoaded', () => { 18 | const searchInput = document.getElementById('toolset-search-input'); 19 | const searchButton = document.getElementById('toolset-search-button'); 20 | const secondNavContent = document.getElementById('secondary-panel-content'); 21 | const toolDisplayArea = document.getElementById('tool-display-area'); 22 | 23 | if (!searchInput || !searchButton || !secondNavContent || !toolDisplayArea) { 24 | console.error('Required DOM elements not found.'); 25 | return; 26 | } 27 | 28 | // Event listener for search button click 29 | searchButton.addEventListener('click', () => { 30 | toolDisplayArea.innerHTML = ''; 31 | const toolsetName = searchInput.value.trim(); 32 | if (toolsetName) { 33 | loadTools(secondNavContent, toolDisplayArea, toolsetName) 34 | } else { 35 | secondNavContent.innerHTML = '<p>Please enter a toolset name to see available tools. <br><br>To view the default toolset that consists of all tools, please select the "Tools" tab.</p>'; 36 | } 37 | }); 38 | 39 | // Event listener for Enter key in search input 40 | searchInput.addEventListener('keypress', (event) => { 41 | toolDisplayArea.innerHTML = ''; 42 | if (event.key === 'Enter') { 43 | const toolsetName = searchInput.value.trim(); 44 | if (toolsetName) { 45 | loadTools(secondNavContent, toolDisplayArea, toolsetName); 46 | } else { 47 | secondNavContent.innerHTML = '<p>Please enter a toolset name to see available tools. <br><br>To view the default toolset that consists of all tools, please select the "Tools" tab.</p>'; 48 | } 49 | } 50 | }); 51 | }) ``` -------------------------------------------------------------------------------- /docs/en/resources/tools/looker/looker-add-dashboard-element.md: -------------------------------------------------------------------------------- ```markdown 1 | --- 2 | title: "looker-add-dashboard-element" 3 | type: docs 4 | weight: 1 5 | description: > 6 | "looker-add-dashboard-element" creates a dashboard element in the given dashboard. 7 | aliases: 8 | - /resources/tools/looker-add-dashboard-element 9 | --- 10 | 11 | ## About 12 | 13 | The `looker-add-dashboard-element` creates a dashboard element 14 | in the given dashboard. 15 | 16 | It's compatible with the following sources: 17 | 18 | - [looker](../../sources/looker.md) 19 | 20 | `looker-add-dashboard-element` takes eleven parameters: 21 | 22 | 1. the `model` 23 | 2. the `explore` 24 | 3. the `fields` list 25 | 4. an optional set of `filters` 26 | 5. an optional set of `pivots` 27 | 6. an optional set of `sorts` 28 | 7. an optional `limit` 29 | 8. an optional `tz` 30 | 9. an optional `vis_config` 31 | 10. the `title` 32 | 11. the `dashboard_id` 33 | 34 | ## Example 35 | 36 | ```yaml 37 | tools: 38 | add_dashboard_element: 39 | kind: looker-add-dashboard-element 40 | source: looker-source 41 | description: | 42 | add_dashboard_element Tool 43 | 44 | This tool creates a new tile in a Looker dashboard using 45 | the query parameters and the vis_config specified. 46 | 47 | Most of the parameters are the same as the query_url 48 | tool. In addition, there is a title that may be provided. 49 | The dashboard_id must be specified. That is obtained 50 | from calling make_dashboard. 51 | 52 | This tool can be called many times for one dashboard_id 53 | and the resulting tiles will be added in order. 54 | ``` 55 | 56 | ## Reference 57 | 58 | | **field** | **type** | **required** | **description** | 59 | |-------------|:------------------------------------------:|:------------:|--------------------------------------------------------------------------------------------------| 60 | | kind | string | true | Must be "looker-add-dashboard-element" | 61 | | source | string | true | Name of the source the SQL should execute on. | 62 | | description | string | true | Description of the tool that is passed to the LLM. | 63 | ``` -------------------------------------------------------------------------------- /docs/en/getting-started/quickstart/js/langchain/quickstart.js: -------------------------------------------------------------------------------- ```javascript 1 | import { ChatGoogleGenerativeAI } from "@langchain/google-genai"; 2 | import { ToolboxClient } from "@toolbox-sdk/core"; 3 | import { tool } from "@langchain/core/tools"; 4 | import { createReactAgent } from "@langchain/langgraph/prebuilt"; 5 | import { MemorySaver } from "@langchain/langgraph"; 6 | 7 | const GOOGLE_API_KEY = process.env.GOOGLE_API_KEY || 'your-api-key'; // Replace it with your API key 8 | 9 | const prompt = ` 10 | You're a helpful hotel assistant. You handle hotel searching, booking, and 11 | cancellations. When the user searches for a hotel, mention its name, id, 12 | location and price tier. Always mention hotel ids while performing any 13 | searches. This is very important for any operations. For any bookings or 14 | cancellations, please provide the appropriate confirmation. Be sure to 15 | update checkin or checkout dates if mentioned by the user. 16 | Don't ask for confirmations from the user. 17 | `; 18 | 19 | const queries = [ 20 | "Find hotels in Basel with Basel in its name.", 21 | "Can you book the Hilton Basel for me?", 22 | "Oh wait, this is too expensive. Please cancel it and book the Hyatt Regency instead.", 23 | "My check in dates would be from April 10, 2024 to April 19, 2024.", 24 | ]; 25 | 26 | export async function main() { 27 | const model = new ChatGoogleGenerativeAI({ 28 | model: "gemini-2.0-flash", 29 | }); 30 | 31 | const client = new ToolboxClient("http://127.0.0.1:5000"); 32 | const toolboxTools = await client.loadToolset("my-toolset"); 33 | 34 | // Define the basics of the tool: name, description, schema and core logic 35 | const getTool = (toolboxTool) => tool(toolboxTool, { 36 | name: toolboxTool.getName(), 37 | description: toolboxTool.getDescription(), 38 | schema: toolboxTool.getParamSchema() 39 | }); 40 | const tools = toolboxTools.map(getTool); 41 | 42 | const agent = createReactAgent({ 43 | llm: model, 44 | tools: tools, 45 | checkpointer: new MemorySaver(), 46 | systemPrompt: prompt, 47 | }); 48 | 49 | const langGraphConfig = { 50 | configurable: { 51 | thread_id: "test-thread", 52 | }, 53 | }; 54 | 55 | for (const query of queries) { 56 | const agentOutput = await agent.invoke( 57 | { 58 | messages: [ 59 | { 60 | role: "user", 61 | content: query, 62 | }, 63 | ], 64 | verbose: true, 65 | }, 66 | langGraphConfig 67 | ); 68 | const response = agentOutput.messages[agentOutput.messages.length - 1].content; 69 | console.log(response); 70 | } 71 | } 72 | 73 | main(); ``` -------------------------------------------------------------------------------- /docs/en/resources/tools/cloudsql/cloudsqlwaitforoperation.md: -------------------------------------------------------------------------------- ```markdown 1 | --- 2 | title: "cloud-sql-wait-for-operation" 3 | type: docs 4 | weight: 10 5 | description: > 6 | Wait for a long-running Cloud SQL operation to complete. 7 | --- 8 | 9 | The `cloud-sql-wait-for-operation` tool is a utility tool that waits for a 10 | long-running Cloud SQL operation to complete. It does this by polling the Cloud 11 | SQL Admin API operation status endpoint until the operation is finished, using 12 | exponential backoff. 13 | 14 | 15 | ## Example 16 | 17 | ```yaml 18 | tools: 19 | cloudsql-operations-get: 20 | kind: cloud-sql-wait-for-operation 21 | source: my-cloud-sql-source 22 | description: "This will poll on operations API until the operation is done. For checking operation status we need projectId and operationId. Once instance is created give follow up steps on how to use the variables to bring data plane MCP server up in local and remote setup." 23 | delay: 1s 24 | maxDelay: 4m 25 | multiplier: 2 26 | maxRetries: 10 27 | ``` 28 | 29 | ## Reference 30 | 31 | | **field** | **type** | **required** | **description** | 32 | | ----------- | :------: | :----------: | ---------------------------------------------------------------------------------------------------------------- | 33 | | kind | string | true | Must be "cloud-sql-wait-for-operation". | 34 | | source | string | true | The name of a `cloud-sql-admin` source to use for authentication. | 35 | | description | string | false | A description of the tool. | 36 | | delay | duration | false | The initial delay between polling requests (e.g., `3s`). Defaults to 3 seconds. | 37 | | maxDelay | duration | false | The maximum delay between polling requests (e.g., `4m`). Defaults to 4 minutes. | 38 | | multiplier | float | false | The multiplier for the polling delay. The delay is multiplied by this value after each request. Defaults to 2.0. | 39 | | maxRetries | int | false | The maximum number of polling attempts before giving up. Defaults to 10. | 40 | ``` -------------------------------------------------------------------------------- /docs/en/resources/tools/bigquery/bigquery-list-table-ids.md: -------------------------------------------------------------------------------- ```markdown 1 | --- 2 | title: "bigquery-list-table-ids" 3 | type: docs 4 | weight: 1 5 | description: > 6 | A "bigquery-list-table-ids" tool returns table IDs in a given BigQuery dataset. 7 | aliases: 8 | - /resources/tools/bigquery-list-table-ids 9 | --- 10 | 11 | ## About 12 | 13 | A `bigquery-list-table-ids` tool returns table IDs in a given BigQuery dataset. 14 | It's compatible with the following sources: 15 | 16 | - [bigquery](../../sources/bigquery.md) 17 | 18 | `bigquery-list-table-ids` accepts the following parameters: 19 | 20 | - **`dataset`** (required): Specifies the dataset from which to list table IDs. 21 | - **`project`** (optional): Defines the Google Cloud project ID. If not provided, 22 | the tool defaults to the project from the source configuration. 23 | 24 | The tool's behavior regarding these parameters is influenced by the 25 | `allowedDatasets` restriction on the `bigquery` source: 26 | 27 | - **Without `allowedDatasets` restriction:** The tool can list tables from any 28 | dataset specified by the `dataset` and `project` parameters. 29 | - **With `allowedDatasets` restriction:** Before listing tables, the tool verifies 30 | that the requested dataset is in the allowed list. If it is not, the request is 31 | denied. If only one dataset is specified in the `allowedDatasets` list, it 32 | will be used as the default value for the `dataset` parameter. 33 | 34 | ## Example 35 | 36 | ```yaml 37 | tools: 38 | bigquery_list_table_ids: 39 | kind: bigquery-list-table-ids 40 | source: my-bigquery-source 41 | description: Use this tool to get table metadata. 42 | ``` 43 | 44 | ## Reference 45 | 46 | | **field** | **type** | **required** | **description** | 47 | |-------------|:------------------------------------------:|:------------:|--------------------------------------------------------------------------------------------------| 48 | | kind | string | true | Must be "bigquery-list-table-ids". | 49 | | source | string | true | Name of the source the SQL should execute on. | 50 | | description | string | true | Description of the tool that is passed to the LLM. | 51 | ```