Compare commits

..

2 Commits

Author SHA1 Message Date
Yuan Teoh
87c5953b75 chore: update yaml for tests 2026-01-22 17:18:57 -08:00
Yuan Teoh
7f0c49a4df chore: update yaml tag for tools 2026-01-22 17:11:12 -08:00
56 changed files with 497 additions and 502 deletions

View File

@@ -74,71 +74,71 @@ func getAlloyDBToolsConfig() map[string]any {
return map[string]any{
"sources": map[string]any{
"alloydb-admin-source": map[string]any{
"kind": "alloydb-admin",
"type": "alloydb-admin",
},
},
"tools": map[string]any{
// Tool for RunAlloyDBToolGetTest
"my-simple-tool": map[string]any{
"kind": "alloydb-list-clusters",
"type": "alloydb-list-clusters",
"source": "alloydb-admin-source",
"description": "Simple tool to test end to end functionality.",
},
// Tool for MCP test
"my-param-tool": map[string]any{
"kind": "alloydb-list-clusters",
"type": "alloydb-list-clusters",
"source": "alloydb-admin-source",
"description": "Tool to list clusters",
},
// Tool for MCP test that fails
"my-fail-tool": map[string]any{
"kind": "alloydb-list-clusters",
"type": "alloydb-list-clusters",
"source": "alloydb-admin-source",
"description": "Tool that will fail",
},
// AlloyDB specific tools
"alloydb-list-clusters": map[string]any{
"kind": "alloydb-list-clusters",
"type": "alloydb-list-clusters",
"source": "alloydb-admin-source",
"description": "Lists all AlloyDB clusters in a given project and location.",
},
"alloydb-list-users": map[string]any{
"kind": "alloydb-list-users",
"type": "alloydb-list-users",
"source": "alloydb-admin-source",
"description": "Lists all AlloyDB users within a specific cluster.",
},
"alloydb-list-instances": map[string]any{
"kind": "alloydb-list-instances",
"type": "alloydb-list-instances",
"source": "alloydb-admin-source",
"description": "Lists all AlloyDB instances within a specific cluster.",
},
"alloydb-get-cluster": map[string]any{
"kind": "alloydb-get-cluster",
"type": "alloydb-get-cluster",
"source": "alloydb-admin-source",
"description": "Retrieves details of a specific AlloyDB cluster.",
},
"alloydb-get-instance": map[string]any{
"kind": "alloydb-get-instance",
"type": "alloydb-get-instance",
"source": "alloydb-admin-source",
"description": "Retrieves details of a specific AlloyDB instance.",
},
"alloydb-get-user": map[string]any{
"kind": "alloydb-get-user",
"type": "alloydb-get-user",
"source": "alloydb-admin-source",
"description": "Retrieves details of a specific AlloyDB user.",
},
"alloydb-create-cluster": map[string]any{
"kind": "alloydb-create-cluster",
"type": "alloydb-create-cluster",
"description": "create cluster",
"source": "alloydb-admin-source",
},
"alloydb-create-instance": map[string]any{
"kind": "alloydb-create-instance",
"type": "alloydb-create-instance",
"description": "create instance",
"source": "alloydb-admin-source",
},
"alloydb-create-user": map[string]any{
"kind": "alloydb-create-user",
"type": "alloydb-create-user",
"description": "create user",
"source": "alloydb-admin-source",
},

View File

@@ -240,17 +240,17 @@ func getWaitToolsConfig() map[string]any {
return map[string]any{
"sources": map[string]any{
"my-alloydb-source": map[string]any{
"kind": "alloydb-admin",
"type": "alloydb-admin",
},
},
"tools": map[string]any{
"wait-for-op1": map[string]any{
"kind": waitToolType,
"type": waitToolType,
"source": "my-alloydb-source",
"description": "wait for op1",
},
"wait-for-op2": map[string]any{
"kind": waitToolType,
"type": waitToolType,
"source": "my-alloydb-source",
"description": "wait for op2",
},

View File

@@ -62,7 +62,7 @@ func getAlloyDBAINLVars(t *testing.T) map[string]any {
t.Fatal("'ALLOYDB_AI_NL_PASS' not set")
}
return map[string]any{
"kind": AlloyDBAINLSourceType,
"type": AlloyDBAINLSourceType,
"project": AlloyDBAINLProject,
"cluster": AlloyDBAINLCluster,
"instance": AlloyDBAINLInstance,
@@ -285,19 +285,19 @@ func getAINLToolsConfig(sourceConfig map[string]any) map[string]any {
},
"authServices": map[string]any{
"my-google-auth": map[string]any{
"kind": "google",
"type": "google",
"clientId": tests.ClientId,
},
},
"tools": map[string]any{
"my-simple-tool": map[string]any{
"kind": AlloyDBAINLToolType,
"type": AlloyDBAINLToolType,
"source": "my-instance",
"description": "Simple tool to test end to end functionality.",
"nlConfig": "my_nl_config",
},
"my-auth-tool": map[string]any{
"kind": AlloyDBAINLToolType,
"type": AlloyDBAINLToolType,
"source": "my-instance",
"description": "Tool to test authenticated parameters.",
"nlConfig": "my_nl_config",
@@ -316,7 +316,7 @@ func getAINLToolsConfig(sourceConfig map[string]any) map[string]any {
},
},
"my-auth-required-tool": map[string]any{
"kind": AlloyDBAINLToolType,
"type": AlloyDBAINLToolType,
"source": "my-instance",
"description": "Tool to test auth required invocation.",
"nlConfig": "my_nl_config",

View File

@@ -61,7 +61,7 @@ func getAlloyDBPgVars(t *testing.T) map[string]any {
t.Fatal("'ALLOYDB_POSTGRES_PASS' not set")
}
return map[string]any{
"kind": AlloyDBPostgresSourceType,
"type": AlloyDBPostgresSourceType,
"project": AlloyDBPostgresProject,
"cluster": AlloyDBPostgresCluster,
"instance": AlloyDBPostgresInstance,
@@ -239,7 +239,7 @@ func TestAlloyDBPgIAMConnection(t *testing.T) {
serviceAccountEmail := strings.TrimSuffix(tests.ServiceAccountEmail, ".gserviceaccount.com")
noPassSourceConfig := map[string]any{
"kind": AlloyDBPostgresSourceType,
"type": AlloyDBPostgresSourceType,
"project": AlloyDBPostgresProject,
"cluster": AlloyDBPostgresCluster,
"instance": AlloyDBPostgresInstance,
@@ -249,7 +249,7 @@ func TestAlloyDBPgIAMConnection(t *testing.T) {
}
noUserSourceConfig := map[string]any{
"kind": AlloyDBPostgresSourceType,
"type": AlloyDBPostgresSourceType,
"project": AlloyDBPostgresProject,
"cluster": AlloyDBPostgresCluster,
"instance": AlloyDBPostgresInstance,
@@ -259,7 +259,7 @@ func TestAlloyDBPgIAMConnection(t *testing.T) {
}
noUserNoPassSourceConfig := map[string]any{
"kind": AlloyDBPostgresSourceType,
"type": AlloyDBPostgresSourceType,
"project": AlloyDBPostgresProject,
"cluster": AlloyDBPostgresCluster,
"instance": AlloyDBPostgresInstance,

View File

@@ -53,7 +53,7 @@ func getBigQueryVars(t *testing.T) map[string]any {
}
return map[string]any{
"kind": BigquerySourceType,
"type": BigquerySourceType,
"project": BigqueryProject,
}
}
@@ -286,42 +286,42 @@ func TestBigQueryToolWithDatasetRestriction(t *testing.T) {
// Configure tool
toolsConfig := map[string]any{
"list-dataset-ids-restricted": map[string]any{
"kind": "bigquery-list-dataset-ids",
"type": "bigquery-list-dataset-ids",
"source": "my-instance",
"description": "Tool to list dataset ids",
},
"list-table-ids-restricted": map[string]any{
"kind": "bigquery-list-table-ids",
"type": "bigquery-list-table-ids",
"source": "my-instance",
"description": "Tool to list table within a dataset",
},
"get-dataset-info-restricted": map[string]any{
"kind": "bigquery-get-dataset-info",
"type": "bigquery-get-dataset-info",
"source": "my-instance",
"description": "Tool to get dataset info",
},
"get-table-info-restricted": map[string]any{
"kind": "bigquery-get-table-info",
"type": "bigquery-get-table-info",
"source": "my-instance",
"description": "Tool to get table info",
},
"execute-sql-restricted": map[string]any{
"kind": "bigquery-execute-sql",
"type": "bigquery-execute-sql",
"source": "my-instance",
"description": "Tool to execute SQL",
},
"conversational-analytics-restricted": map[string]any{
"kind": "bigquery-conversational-analytics",
"type": "bigquery-conversational-analytics",
"source": "my-instance",
"description": "Tool to ask BigQuery conversational analytics",
},
"forecast-restricted": map[string]any{
"kind": "bigquery-forecast",
"type": "bigquery-forecast",
"source": "my-instance",
"description": "Tool to forecast",
},
"analyze-contribution-restricted": map[string]any{
"kind": "bigquery-analyze-contribution",
"type": "bigquery-analyze-contribution",
"source": "my-instance",
"description": "Tool to analyze contribution",
},
@@ -398,7 +398,7 @@ func TestBigQueryWriteModeAllowed(t *testing.T) {
},
"tools": map[string]any{
"my-exec-sql-tool": map[string]any{
"kind": "bigquery-execute-sql",
"type": "bigquery-execute-sql",
"source": "my-instance",
"description": "Tool to execute sql",
},
@@ -444,7 +444,7 @@ func TestBigQueryWriteModeBlocked(t *testing.T) {
toolsFile := map[string]any{
"sources": map[string]any{"my-instance": sourceConfig},
"tools": map[string]any{
"my-exec-sql-tool": map[string]any{"kind": "bigquery-execute-sql", "source": "my-instance", "description": "Tool to execute sql"},
"my-exec-sql-tool": map[string]any{"type": "bigquery-execute-sql", "source": "my-instance", "description": "Tool to execute sql"},
},
}
@@ -490,20 +490,20 @@ func TestBigQueryWriteModeProtected(t *testing.T) {
toolsFile := map[string]any{
"sources": map[string]any{"my-instance": sourceConfig},
"tools": map[string]any{
"my-exec-sql-tool": map[string]any{"kind": "bigquery-execute-sql", "source": "my-instance", "description": "Tool to execute sql"},
"my-exec-sql-tool": map[string]any{"type": "bigquery-execute-sql", "source": "my-instance", "description": "Tool to execute sql"},
"my-sql-tool-protected": map[string]any{
"kind": "bigquery-sql",
"type": "bigquery-sql",
"source": "my-instance",
"description": "Tool to query from the session",
"statement": "SELECT * FROM my_shared_temp_table",
},
"my-forecast-tool-protected": map[string]any{
"kind": "bigquery-forecast",
"type": "bigquery-forecast",
"source": "my-instance",
"description": "Tool to forecast from session temp table",
},
"my-analyze-contribution-tool-protected": map[string]any{
"kind": "bigquery-analyze-contribution",
"type": "bigquery-analyze-contribution",
"source": "my-instance",
"description": "Tool to analyze contribution from session temp table",
},
@@ -527,7 +527,7 @@ func TestBigQueryWriteModeProtected(t *testing.T) {
runBigQueryWriteModeProtectedTest(t, permanentDatasetName)
}
// getBigQueryParamToolInfo returns statements and param for my-tool for bigquery kind
// getBigQueryParamToolInfo returns statements and param for my-tool for bigquery type
func getBigQueryParamToolInfo(tableName string) (string, string, string, string, string, string, []bigqueryapi.QueryParameter) {
createStatement := fmt.Sprintf(`
CREATE TABLE IF NOT EXISTS %s (id INT64, name STRING);`, tableName)
@@ -546,7 +546,7 @@ func getBigQueryParamToolInfo(tableName string) (string, string, string, string,
return createStatement, insertStatement, toolStatement, idToolStatement, nameToolStatement, arrayToolStatememt, params
}
// getBigQueryAuthToolInfo returns statements and param of my-auth-tool for bigquery kind
// getBigQueryAuthToolInfo returns statements and param of my-auth-tool for bigquery type
func getBigQueryAuthToolInfo(tableName string) (string, string, string, []bigqueryapi.QueryParameter) {
createStatement := fmt.Sprintf(`
CREATE TABLE IF NOT EXISTS %s (id INT64, name STRING, email STRING)`, tableName)
@@ -616,7 +616,7 @@ func getBigQueryAnalyzeContributionToolInfo(tableName string) (string, string, [
return createStatement, insertStatement, params
}
// getBigQueryTmplToolStatement returns statements for template parameter test cases for bigquery kind
// getBigQueryTmplToolStatement returns statements for template parameter test cases for bigquery type
func getBigQueryTmplToolStatement() (string, string) {
tmplSelectCombined := "SELECT * FROM {{.tableName}} WHERE id = ? ORDER BY id"
tmplSelectFilterCombined := "SELECT * FROM {{.tableName}} WHERE {{.columnFilter}} = ? ORDER BY id"
@@ -708,12 +708,12 @@ func addBigQueryPrebuiltToolsConfig(t *testing.T, config map[string]any) map[str
t.Fatalf("unable to get tools from config")
}
tools["my-exec-sql-tool"] = map[string]any{
"kind": "bigquery-execute-sql",
"type": "bigquery-execute-sql",
"source": "my-instance",
"description": "Tool to execute sql",
}
tools["my-auth-exec-sql-tool"] = map[string]any{
"kind": "bigquery-execute-sql",
"type": "bigquery-execute-sql",
"source": "my-instance",
"description": "Tool to execute sql",
"authRequired": []string{
@@ -721,17 +721,17 @@ func addBigQueryPrebuiltToolsConfig(t *testing.T, config map[string]any) map[str
},
}
tools["my-client-auth-exec-sql-tool"] = map[string]any{
"kind": "bigquery-execute-sql",
"type": "bigquery-execute-sql",
"source": "my-client-auth-source",
"description": "Tool to execute sql",
}
tools["my-forecast-tool"] = map[string]any{
"kind": "bigquery-forecast",
"type": "bigquery-forecast",
"source": "my-instance",
"description": "Tool to forecast time series data.",
}
tools["my-auth-forecast-tool"] = map[string]any{
"kind": "bigquery-forecast",
"type": "bigquery-forecast",
"source": "my-instance",
"description": "Tool to forecast time series data with auth.",
"authRequired": []string{
@@ -739,17 +739,17 @@ func addBigQueryPrebuiltToolsConfig(t *testing.T, config map[string]any) map[str
},
}
tools["my-client-auth-forecast-tool"] = map[string]any{
"kind": "bigquery-forecast",
"type": "bigquery-forecast",
"source": "my-client-auth-source",
"description": "Tool to forecast time series data with auth.",
}
tools["my-analyze-contribution-tool"] = map[string]any{
"kind": "bigquery-analyze-contribution",
"type": "bigquery-analyze-contribution",
"source": "my-instance",
"description": "Tool to analyze contribution.",
}
tools["my-auth-analyze-contribution-tool"] = map[string]any{
"kind": "bigquery-analyze-contribution",
"type": "bigquery-analyze-contribution",
"source": "my-instance",
"description": "Tool to analyze contribution with auth.",
"authRequired": []string{
@@ -757,17 +757,17 @@ func addBigQueryPrebuiltToolsConfig(t *testing.T, config map[string]any) map[str
},
}
tools["my-client-auth-analyze-contribution-tool"] = map[string]any{
"kind": "bigquery-analyze-contribution",
"type": "bigquery-analyze-contribution",
"source": "my-client-auth-source",
"description": "Tool to analyze contribution with auth.",
}
tools["my-list-dataset-ids-tool"] = map[string]any{
"kind": "bigquery-list-dataset-ids",
"type": "bigquery-list-dataset-ids",
"source": "my-instance",
"description": "Tool to list dataset",
}
tools["my-auth-list-dataset-ids-tool"] = map[string]any{
"kind": "bigquery-list-dataset-ids",
"type": "bigquery-list-dataset-ids",
"source": "my-instance",
"description": "Tool to list dataset",
"authRequired": []string{
@@ -775,17 +775,17 @@ func addBigQueryPrebuiltToolsConfig(t *testing.T, config map[string]any) map[str
},
}
tools["my-client-auth-list-dataset-ids-tool"] = map[string]any{
"kind": "bigquery-list-dataset-ids",
"type": "bigquery-list-dataset-ids",
"source": "my-client-auth-source",
"description": "Tool to list dataset",
}
tools["my-get-dataset-info-tool"] = map[string]any{
"kind": "bigquery-get-dataset-info",
"type": "bigquery-get-dataset-info",
"source": "my-instance",
"description": "Tool to show dataset metadata",
}
tools["my-auth-get-dataset-info-tool"] = map[string]any{
"kind": "bigquery-get-dataset-info",
"type": "bigquery-get-dataset-info",
"source": "my-instance",
"description": "Tool to show dataset metadata",
"authRequired": []string{
@@ -793,17 +793,17 @@ func addBigQueryPrebuiltToolsConfig(t *testing.T, config map[string]any) map[str
},
}
tools["my-client-auth-get-dataset-info-tool"] = map[string]any{
"kind": "bigquery-get-dataset-info",
"type": "bigquery-get-dataset-info",
"source": "my-client-auth-source",
"description": "Tool to show dataset metadata",
}
tools["my-list-table-ids-tool"] = map[string]any{
"kind": "bigquery-list-table-ids",
"type": "bigquery-list-table-ids",
"source": "my-instance",
"description": "Tool to list table within a dataset",
}
tools["my-auth-list-table-ids-tool"] = map[string]any{
"kind": "bigquery-list-table-ids",
"type": "bigquery-list-table-ids",
"source": "my-instance",
"description": "Tool to list table within a dataset",
"authRequired": []string{
@@ -811,17 +811,17 @@ func addBigQueryPrebuiltToolsConfig(t *testing.T, config map[string]any) map[str
},
}
tools["my-client-auth-list-table-ids-tool"] = map[string]any{
"kind": "bigquery-list-table-ids",
"type": "bigquery-list-table-ids",
"source": "my-client-auth-source",
"description": "Tool to list table within a dataset",
}
tools["my-get-table-info-tool"] = map[string]any{
"kind": "bigquery-get-table-info",
"type": "bigquery-get-table-info",
"source": "my-instance",
"description": "Tool to show dataset metadata",
}
tools["my-auth-get-table-info-tool"] = map[string]any{
"kind": "bigquery-get-table-info",
"type": "bigquery-get-table-info",
"source": "my-instance",
"description": "Tool to show dataset metadata",
"authRequired": []string{
@@ -829,17 +829,17 @@ func addBigQueryPrebuiltToolsConfig(t *testing.T, config map[string]any) map[str
},
}
tools["my-client-auth-get-table-info-tool"] = map[string]any{
"kind": "bigquery-get-table-info",
"type": "bigquery-get-table-info",
"source": "my-client-auth-source",
"description": "Tool to show dataset metadata",
}
tools["my-conversational-analytics-tool"] = map[string]any{
"kind": "bigquery-conversational-analytics",
"type": "bigquery-conversational-analytics",
"source": "my-instance",
"description": "Tool to ask BigQuery conversational analytics",
}
tools["my-auth-conversational-analytics-tool"] = map[string]any{
"kind": "bigquery-conversational-analytics",
"type": "bigquery-conversational-analytics",
"source": "my-instance",
"description": "Tool to ask BigQuery conversational analytics",
"authRequired": []string{
@@ -847,17 +847,17 @@ func addBigQueryPrebuiltToolsConfig(t *testing.T, config map[string]any) map[str
},
}
tools["my-client-auth-conversational-analytics-tool"] = map[string]any{
"kind": "bigquery-conversational-analytics",
"type": "bigquery-conversational-analytics",
"source": "my-client-auth-source",
"description": "Tool to ask BigQuery conversational analytics",
}
tools["my-search-catalog-tool"] = map[string]any{
"kind": "bigquery-search-catalog",
"type": "bigquery-search-catalog",
"source": "my-instance",
"description": "Tool to search the BiqQuery catalog",
}
tools["my-auth-search-catalog-tool"] = map[string]any{
"kind": "bigquery-search-catalog",
"type": "bigquery-search-catalog",
"source": "my-instance",
"description": "Tool to search the BiqQuery catalog",
"authRequired": []string{
@@ -865,7 +865,7 @@ func addBigQueryPrebuiltToolsConfig(t *testing.T, config map[string]any) map[str
},
}
tools["my-client-auth-search-catalog-tool"] = map[string]any{
"kind": "bigquery-search-catalog",
"type": "bigquery-search-catalog",
"source": "my-client-auth-source",
"description": "Tool to search the BiqQuery catalog",
}
@@ -879,7 +879,7 @@ func addClientAuthSourceConfig(t *testing.T, config map[string]any) map[string]a
t.Fatalf("unable to get sources from config")
}
sources["my-client-auth-source"] = map[string]any{
"kind": BigquerySourceType,
"type": BigquerySourceType,
"project": BigqueryProject,
"useClientOAuth": true,
}
@@ -893,7 +893,7 @@ func addBigQuerySqlToolConfig(t *testing.T, config map[string]any, toolStatement
t.Fatalf("unable to get tools from config")
}
tools["my-scalar-datatype-tool"] = map[string]any{
"kind": "bigquery-sql",
"type": "bigquery-sql",
"source": "my-instance",
"description": "Tool to test various scalar data types.",
"statement": toolStatement,
@@ -905,7 +905,7 @@ func addBigQuerySqlToolConfig(t *testing.T, config map[string]any, toolStatement
},
}
tools["my-array-datatype-tool"] = map[string]any{
"kind": "bigquery-sql",
"type": "bigquery-sql",
"source": "my-instance",
"description": "Tool to test various array data types.",
"statement": arrayToolStatement,
@@ -917,7 +917,7 @@ func addBigQuerySqlToolConfig(t *testing.T, config map[string]any, toolStatement
},
}
tools["my-client-auth-tool"] = map[string]any{
"kind": "bigquery-sql",
"type": "bigquery-sql",
"source": "my-client-auth-source",
"description": "Tool to test client authorization.",
"statement": "SELECT 1",

View File

@@ -50,7 +50,7 @@ func getBigtableVars(t *testing.T) map[string]any {
}
return map[string]any{
"kind": BigtableSourceType,
"type": BigtableSourceType,
"project": BigtableProject,
"instance": BigtableInstance,
}
@@ -291,7 +291,7 @@ func addTemplateParamConfig(t *testing.T, config map[string]any) map[string]any
t.Fatalf("unable to get tools from config")
}
toolsMap["select-templateParams-tool"] = map[string]any{
"kind": "bigtable-sql",
"type": "bigtable-sql",
"source": "my-instance",
"description": "Create table tool with template parameters",
"statement": "SELECT TO_INT64(cf['age']) as age, TO_INT64(cf['id']) as id, CAST(cf['name'] AS string) as name, FROM {{.tableName}};",
@@ -300,7 +300,7 @@ func addTemplateParamConfig(t *testing.T, config map[string]any) map[string]any
},
}
toolsMap["select-templateParams-combined-tool"] = map[string]any{
"kind": "bigtable-sql",
"type": "bigtable-sql",
"source": "my-instance",
"description": "Create table tool with template parameters",
"statement": "SELECT TO_INT64(cf['age']) as age, TO_INT64(cf['id']) as id, CAST(cf['name'] AS string) as name, FROM {{.tableName}} WHERE TO_INT64(cf['id']) = @id;",
@@ -310,7 +310,7 @@ func addTemplateParamConfig(t *testing.T, config map[string]any) map[string]any
},
}
toolsMap["select-fields-templateParams-tool"] = map[string]any{
"kind": "bigtable-sql",
"type": "bigtable-sql",
"source": "my-instance",
"description": "Create table tool with template parameters",
"statement": "SELECT {{array .fields}}, FROM {{.tableName}};",
@@ -320,7 +320,7 @@ func addTemplateParamConfig(t *testing.T, config map[string]any) map[string]any
},
}
toolsMap["select-filter-templateParams-combined-tool"] = map[string]any{
"kind": "bigtable-sql",
"type": "bigtable-sql",
"source": "my-instance",
"description": "Create table tool with template parameters",
"statement": "SELECT TO_INT64(cf['age']) as age, TO_INT64(cf['id']) as id, CAST(cf['name'] AS string) as name, FROM {{.tableName}} WHERE {{.columnFilter}} = @name;",

View File

@@ -49,7 +49,7 @@ func getCassandraVars(t *testing.T) map[string]any {
t.Fatal("'Password' not set")
}
return map[string]any{
"kind": CassandraSourceType,
"type": CassandraSourceType,
"hosts": strings.Split(Hosts, ","),
"keyspace": Keyspace,
"username": Username,

View File

@@ -64,7 +64,7 @@ func getClickHouseVars(t *testing.T) map[string]any {
}
return map[string]any{
"kind": ClickHouseSourceType,
"type": ClickHouseSourceType,
"host": ClickHouseHost,
"port": ClickHousePort,
"database": ClickHouseDatabase,
@@ -162,12 +162,12 @@ func addClickHouseExecuteSqlConfig(t *testing.T, config map[string]any) map[stri
t.Fatalf("unable to get tools from config")
}
tools["my-exec-sql-tool"] = map[string]any{
"kind": "clickhouse-execute-sql",
"type": "clickhouse-execute-sql",
"source": "my-instance",
"description": "Tool to execute sql",
}
tools["my-auth-exec-sql-tool"] = map[string]any{
"kind": "clickhouse-execute-sql",
"type": "clickhouse-execute-sql",
"source": "my-instance",
"description": "Tool to execute sql",
"authRequired": []string{
@@ -186,7 +186,7 @@ func addClickHouseTemplateParamConfig(t *testing.T, config map[string]any, toolT
// ClickHouse-specific template parameter tools with compatible syntax
toolsMap["create-table-templateParams-tool"] = map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Create table tool with template parameters",
"statement": "CREATE TABLE {{.tableName}} ({{array .columns}}) ORDER BY id",
@@ -196,7 +196,7 @@ func addClickHouseTemplateParamConfig(t *testing.T, config map[string]any, toolT
},
}
toolsMap["insert-table-templateParams-tool"] = map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Insert table tool with template parameters",
"statement": "INSERT INTO {{.tableName}} ({{array .columns}}) VALUES ({{.values}})",
@@ -207,7 +207,7 @@ func addClickHouseTemplateParamConfig(t *testing.T, config map[string]any, toolT
},
}
toolsMap["select-templateParams-tool"] = map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Select table tool with template parameters",
"statement": "SELECT id AS \"id\", name AS \"name\", age AS \"age\" FROM {{.tableName}} ORDER BY id",
@@ -216,7 +216,7 @@ func addClickHouseTemplateParamConfig(t *testing.T, config map[string]any, toolT
},
}
toolsMap["select-templateParams-combined-tool"] = map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Select table tool with combined template parameters",
"statement": tmplSelectCombined,
@@ -228,7 +228,7 @@ func addClickHouseTemplateParamConfig(t *testing.T, config map[string]any, toolT
},
}
toolsMap["select-fields-templateParams-tool"] = map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Select specific fields tool with template parameters",
"statement": "SELECT name AS \"name\" FROM {{.tableName}} ORDER BY id",
@@ -237,7 +237,7 @@ func addClickHouseTemplateParamConfig(t *testing.T, config map[string]any, toolT
},
}
toolsMap["select-filter-templateParams-combined-tool"] = map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Select table tool with filter template parameters",
"statement": tmplSelectFilterCombined,
@@ -251,7 +251,7 @@ func addClickHouseTemplateParamConfig(t *testing.T, config map[string]any, toolT
}
// Firebird uses simple DROP TABLE syntax without IF EXISTS
toolsMap["drop-table-templateParams-tool"] = map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Drop table tool with template parameters",
"statement": "DROP TABLE {{.tableName}}",
@@ -310,7 +310,7 @@ func TestClickHouseBasicConnection(t *testing.T) {
},
"tools": map[string]any{
"my-simple-tool": map[string]any{
"kind": ClickHouseToolType,
"type": ClickHouseToolType,
"source": "my-instance",
"description": "Simple tool to test end to end functionality.",
"statement": "SELECT 1;",
@@ -386,13 +386,13 @@ func TestClickHouseSQLTool(t *testing.T) {
},
"tools": map[string]any{
"test-select": map[string]any{
"kind": ClickHouseToolType,
"type": ClickHouseToolType,
"source": "my-instance",
"description": "Test select query",
"statement": fmt.Sprintf("SELECT * FROM %s ORDER BY id", tableName),
},
"test-param-query": map[string]any{
"kind": ClickHouseToolType,
"type": ClickHouseToolType,
"source": "my-instance",
"description": "Test parameterized query",
"statement": fmt.Sprintf("SELECT * FROM %s WHERE age > ? ORDER BY id", tableName),
@@ -401,7 +401,7 @@ func TestClickHouseSQLTool(t *testing.T) {
},
},
"test-empty-result": map[string]any{
"kind": ClickHouseToolType,
"type": ClickHouseToolType,
"source": "my-instance",
"description": "Test query with no results",
"statement": fmt.Sprintf("SELECT * FROM %s WHERE id = ?", tableName),
@@ -410,7 +410,7 @@ func TestClickHouseSQLTool(t *testing.T) {
},
},
"test-invalid-sql": map[string]any{
"kind": ClickHouseToolType,
"type": ClickHouseToolType,
"source": "my-instance",
"description": "Test invalid SQL",
"statement": "SELEC * FROM nonexistent_table", // Typo in SELECT
@@ -522,7 +522,7 @@ func TestClickHouseExecuteSQLTool(t *testing.T) {
},
"tools": map[string]any{
"execute-sql-tool": map[string]any{
"kind": "clickhouse-execute-sql",
"type": "clickhouse-execute-sql",
"source": "my-instance",
"description": "Test create table",
},
@@ -640,18 +640,18 @@ func TestClickHouseEdgeCases(t *testing.T) {
},
"tools": map[string]any{
"execute-sql-tool": map[string]any{
"kind": "clickhouse-execute-sql",
"type": "clickhouse-execute-sql",
"source": "my-instance",
"description": "Test create table",
},
"test-null-values": map[string]any{
"kind": "clickhouse-sql",
"type": "clickhouse-sql",
"source": "my-instance",
"description": "Test null values",
"statement": fmt.Sprintf("SELECT * FROM %s ORDER BY id", tableName),
},
"test-concurrent": map[string]any{
"kind": "clickhouse-sql",
"type": "clickhouse-sql",
"source": "my-instance",
"description": "Test concurrent queries",
"statement": "SELECT number FROM system.numbers LIMIT ?",
@@ -818,7 +818,7 @@ func TestClickHouseEdgeCases(t *testing.T) {
t.Logf("✅ Edge case tests completed successfully")
}
// getClickHouseSQLParamToolInfo returns statements and param for my-tool clickhouse-sql kind
// getClickHouseSQLParamToolInfo returns statements and param for my-tool clickhouse-sql type
func getClickHouseSQLParamToolInfo(tableName string) (string, string, string, string, string, string, []any) {
createStatement := fmt.Sprintf("CREATE TABLE %s (id UInt32, name String) ENGINE = Memory", tableName)
insertStatement := fmt.Sprintf("INSERT INTO %s (id, name) VALUES (?, ?), (?, ?), (?, ?), (?, ?)", tableName)
@@ -830,7 +830,7 @@ func getClickHouseSQLParamToolInfo(tableName string) (string, string, string, st
return createStatement, insertStatement, paramStatement, idParamStatement, nameParamStatement, arrayStatement, params
}
// getClickHouseSQLAuthToolInfo returns statements and param of my-auth-tool for clickhouse-sql kind
// getClickHouseSQLAuthToolInfo returns statements and param of my-auth-tool for clickhouse-sql type
func getClickHouseSQLAuthToolInfo(tableName string) (string, string, string, []any) {
createStatement := fmt.Sprintf("CREATE TABLE %s (id UInt32, name String, email String) ENGINE = Memory", tableName)
insertStatement := fmt.Sprintf("INSERT INTO %s (id, name, email) VALUES (?, ?, ?), (?, ?, ?)", tableName)
@@ -839,7 +839,7 @@ func getClickHouseSQLAuthToolInfo(tableName string) (string, string, string, []a
return createStatement, insertStatement, authStatement, params
}
// getClickHouseSQLTmplToolStatement returns statements and param for template parameter test cases for clickhouse-sql kind
// getClickHouseSQLTmplToolStatement returns statements and param for template parameter test cases for clickhouse-sql type
func getClickHouseSQLTmplToolStatement() (string, string) {
tmplSelectCombined := "SELECT * FROM {{.tableName}} WHERE id = ?"
tmplSelectFilterCombined := "SELECT * FROM {{.tableName}} WHERE {{.columnFilter}} = ?"
@@ -902,12 +902,12 @@ func TestClickHouseListDatabasesTool(t *testing.T) {
},
"tools": map[string]any{
"test-list-databases": map[string]any{
"kind": "clickhouse-list-databases",
"type": "clickhouse-list-databases",
"source": "my-instance",
"description": "Test listing databases",
},
"test-invalid-source": map[string]any{
"kind": "clickhouse-list-databases",
"type": "clickhouse-list-databases",
"source": "non-existent-source",
"description": "Test with invalid source",
},
@@ -1031,12 +1031,12 @@ func TestClickHouseListTablesTool(t *testing.T) {
},
"tools": map[string]any{
"test-list-tables": map[string]any{
"kind": "clickhouse-list-tables",
"type": "clickhouse-list-tables",
"source": "my-instance",
"description": "Test listing tables",
},
"test-invalid-source": map[string]any{
"kind": "clickhouse-list-tables",
"type": "clickhouse-list-tables",
"source": "non-existent-source",
"description": "Test with invalid source",
},

View File

@@ -205,13 +205,13 @@ func getCloudGdaToolsConfig() map[string]any {
return map[string]any{
"sources": map[string]any{
"my-gda-source": map[string]any{
"kind": "cloud-gemini-data-analytics",
"type": "cloud-gemini-data-analytics",
"projectId": "test-project",
},
},
"tools": map[string]any{
"cloud-gda-query": map[string]any{
"kind": cloudGdaToolType,
"type": cloudGdaToolType,
"source": "my-gda-source",
"description": "Test GDA Tool",
"location": "us-central1",

View File

@@ -92,7 +92,7 @@ func getHealthcareVars(t *testing.T) map[string]any {
t.Fatal("'HEALTHCARE_PREPOPULATED_DICOM_STORE' not set")
}
return map[string]any{
"kind": healthcareSourceType,
"type": healthcareSourceType,
"project": healthcareProject,
"region": healthcareRegion,
"dataset": healthcareDataset,
@@ -185,12 +185,12 @@ func TestHealthcareToolWithStoreRestriction(t *testing.T) {
// Configure tool
toolsConfig := map[string]any{
"list-fhir-stores-restricted": map[string]any{
"kind": "cloud-healthcare-list-fhir-stores",
"type": "cloud-healthcare-list-fhir-stores",
"source": "my-instance",
"description": "Tool to list fhir stores",
},
"list-dicom-stores-restricted": map[string]any{
"kind": "cloud-healthcare-list-dicom-stores",
"type": "cloud-healthcare-list-dicom-stores",
"source": "my-instance",
"description": "Tool to list dicom stores",
},
@@ -335,157 +335,157 @@ func getToolsConfig(sourceConfig map[string]any) map[string]any {
},
"tools": map[string]any{
"my-get-dataset-tool": map[string]any{
"kind": getDatasetToolType,
"type": getDatasetToolType,
"source": "my-instance",
"description": "Tool to get a healthcare dataset",
},
"my-list-fhir-stores-tool": map[string]any{
"kind": listFHIRStoresToolType,
"type": listFHIRStoresToolType,
"source": "my-instance",
"description": "Tool to list FHIR stores",
},
"my-list-dicom-stores-tool": map[string]any{
"kind": listDICOMStoresToolType,
"type": listDICOMStoresToolType,
"source": "my-instance",
"description": "Tool to list DICOM stores",
},
"my-get-fhir-store-tool": map[string]any{
"kind": getFHIRStoreToolType,
"type": getFHIRStoreToolType,
"source": "my-instance",
"description": "Tool to get a FHIR store",
},
"my-get-fhir-store-metrics-tool": map[string]any{
"kind": getFHIRStoreMetricsToolType,
"type": getFHIRStoreMetricsToolType,
"source": "my-instance",
"description": "Tool to get FHIR store metrics",
},
"my-get-fhir-resource-tool": map[string]any{
"kind": getFHIRResourceToolType,
"type": getFHIRResourceToolType,
"source": "my-instance",
"description": "Tool to get FHIR resource",
},
"my-fhir-patient-search-tool": map[string]any{
"kind": fhirPatientSearchToolType,
"type": fhirPatientSearchToolType,
"source": "my-instance",
"description": "Tool to search for patients",
},
"my-fhir-patient-everything-tool": map[string]any{
"kind": fhirPatientEverythingToolType,
"type": fhirPatientEverythingToolType,
"source": "my-instance",
"description": "Tool for patient everything",
},
"my-fhir-fetch-page-tool": map[string]any{
"kind": fhirFetchPageToolType,
"type": fhirFetchPageToolType,
"source": "my-instance",
"description": "Tool to fetch a page of FHIR resources",
},
"my-get-dicom-store-tool": map[string]any{
"kind": getDICOMStoreToolType,
"type": getDICOMStoreToolType,
"source": "my-instance",
"description": "Tool to get a DICOM store",
},
"my-get-dicom-store-metrics-tool": map[string]any{
"kind": getDICOMStoreMetricsToolType,
"type": getDICOMStoreMetricsToolType,
"source": "my-instance",
"description": "Tool to get DICOM store metrics",
},
"my-search-dicom-studies-tool": map[string]any{
"kind": searchDICOMStudiesToolType,
"type": searchDICOMStudiesToolType,
"source": "my-instance",
"description": "Tool to search DICOM studies",
},
"my-search-dicom-series-tool": map[string]any{
"kind": searchDICOMSeriesToolType,
"type": searchDICOMSeriesToolType,
"source": "my-instance",
"description": "Tool to search DICOM series",
},
"my-search-dicom-instances-tool": map[string]any{
"kind": searchDICOMInstancesToolType,
"type": searchDICOMInstancesToolType,
"source": "my-instance",
"description": "Tool to search DICOM instances",
},
"my-retrieve-rendered-dicom-instance-tool": map[string]any{
"kind": retrieveRenderedDICOMInstanceToolType,
"type": retrieveRenderedDICOMInstanceToolType,
"source": "my-instance",
"description": "Tool to retrieve rendered DICOM instance",
},
"my-client-auth-get-dataset-tool": map[string]any{
"kind": getDatasetToolType,
"type": getDatasetToolType,
"source": "my-client-auth-source",
"description": "Tool to get a healthcare dataset",
},
"my-client-auth-list-fhir-stores-tool": map[string]any{
"kind": listFHIRStoresToolType,
"type": listFHIRStoresToolType,
"source": "my-client-auth-source",
"description": "Tool to list FHIR stores",
},
"my-client-auth-list-dicom-stores-tool": map[string]any{
"kind": listDICOMStoresToolType,
"type": listDICOMStoresToolType,
"source": "my-client-auth-source",
"description": "Tool to list DICOM stores",
},
"my-client-auth-get-fhir-store-tool": map[string]any{
"kind": getFHIRStoreToolType,
"type": getFHIRStoreToolType,
"source": "my-client-auth-source",
"description": "Tool to get a FHIR store",
},
"my-client-auth-get-fhir-store-metrics-tool": map[string]any{
"kind": getFHIRStoreMetricsToolType,
"type": getFHIRStoreMetricsToolType,
"source": "my-client-auth-source",
"description": "Tool to get FHIR store metrics",
},
"my-client-auth-get-fhir-resource-tool": map[string]any{
"kind": getFHIRResourceToolType,
"type": getFHIRResourceToolType,
"source": "my-client-auth-source",
"description": "Tool to get FHIR resource",
},
"my-client-auth-fhir-patient-search-tool": map[string]any{
"kind": fhirPatientSearchToolType,
"type": fhirPatientSearchToolType,
"source": "my-client-auth-source",
"description": "Tool to search for patients",
},
"my-client-auth-fhir-patient-everything-tool": map[string]any{
"kind": fhirPatientEverythingToolType,
"type": fhirPatientEverythingToolType,
"source": "my-client-auth-source",
"description": "Tool for patient everything",
},
"my-client-auth-fhir-fetch-page-tool": map[string]any{
"kind": fhirFetchPageToolType,
"type": fhirFetchPageToolType,
"source": "my-client-auth-source",
"description": "Tool to fetch a page of FHIR resources",
},
"my-client-auth-get-dicom-store-tool": map[string]any{
"kind": getDICOMStoreToolType,
"type": getDICOMStoreToolType,
"source": "my-client-auth-source",
"description": "Tool to get a DICOM store",
},
"my-client-auth-get-dicom-store-metrics-tool": map[string]any{
"kind": getDICOMStoreMetricsToolType,
"type": getDICOMStoreMetricsToolType,
"source": "my-client-auth-source",
"description": "Tool to get DICOM store metrics",
},
"my-client-auth-search-dicom-studies-tool": map[string]any{
"kind": searchDICOMStudiesToolType,
"type": searchDICOMStudiesToolType,
"source": "my-client-auth-source",
"description": "Tool to search DICOM studies",
},
"my-client-auth-search-dicom-series-tool": map[string]any{
"kind": searchDICOMSeriesToolType,
"type": searchDICOMSeriesToolType,
"source": "my-client-auth-source",
"description": "Tool to search DICOM series",
},
"my-client-auth-search-dicom-instances-tool": map[string]any{
"kind": searchDICOMInstancesToolType,
"type": searchDICOMInstancesToolType,
"source": "my-client-auth-source",
"description": "Tool to search DICOM instances",
},
"my-client-auth-retrieve-rendered-dicom-instance-tool": map[string]any{
"kind": retrieveRenderedDICOMInstanceToolType,
"type": retrieveRenderedDICOMInstanceToolType,
"source": "my-client-auth-source",
"description": "Tool to retrieve rendered DICOM instance",
},
"my-auth-get-dataset-tool": map[string]any{
"kind": getDatasetToolType,
"type": getDatasetToolType,
"source": "my-instance",
"description": "Tool to get a healthcare dataset with auth",
"authRequired": []string{
@@ -493,7 +493,7 @@ func getToolsConfig(sourceConfig map[string]any) map[string]any {
},
},
"my-auth-list-fhir-stores-tool": map[string]any{
"kind": listFHIRStoresToolType,
"type": listFHIRStoresToolType,
"source": "my-instance",
"description": "Tool to list FHIR stores with auth",
"authRequired": []string{
@@ -501,7 +501,7 @@ func getToolsConfig(sourceConfig map[string]any) map[string]any {
},
},
"my-auth-list-dicom-stores-tool": map[string]any{
"kind": listDICOMStoresToolType,
"type": listDICOMStoresToolType,
"source": "my-instance",
"description": "Tool to list DICOM stores with auth",
"authRequired": []string{
@@ -509,7 +509,7 @@ func getToolsConfig(sourceConfig map[string]any) map[string]any {
},
},
"my-auth-get-fhir-store-tool": map[string]any{
"kind": getFHIRStoreToolType,
"type": getFHIRStoreToolType,
"source": "my-instance",
"description": "Tool to get a FHIR store",
"authRequired": []string{
@@ -517,7 +517,7 @@ func getToolsConfig(sourceConfig map[string]any) map[string]any {
},
},
"my-auth-get-fhir-store-metrics-tool": map[string]any{
"kind": getFHIRStoreMetricsToolType,
"type": getFHIRStoreMetricsToolType,
"source": "my-instance",
"description": "Tool to get FHIR store metrics",
"authRequired": []string{
@@ -525,7 +525,7 @@ func getToolsConfig(sourceConfig map[string]any) map[string]any {
},
},
"my-auth-get-fhir-resource-tool": map[string]any{
"kind": getFHIRResourceToolType,
"type": getFHIRResourceToolType,
"source": "my-instance",
"description": "Tool to get FHIR resource",
"authRequired": []string{
@@ -533,7 +533,7 @@ func getToolsConfig(sourceConfig map[string]any) map[string]any {
},
},
"my-auth-fhir-patient-search-tool": map[string]any{
"kind": fhirPatientSearchToolType,
"type": fhirPatientSearchToolType,
"source": "my-instance",
"description": "Tool to search for patients",
"authRequired": []string{
@@ -541,7 +541,7 @@ func getToolsConfig(sourceConfig map[string]any) map[string]any {
},
},
"my-auth-fhir-patient-everything-tool": map[string]any{
"kind": fhirPatientEverythingToolType,
"type": fhirPatientEverythingToolType,
"source": "my-instance",
"description": "Tool for patient everything",
"authRequired": []string{
@@ -549,7 +549,7 @@ func getToolsConfig(sourceConfig map[string]any) map[string]any {
},
},
"my-auth-fhir-fetch-page-tool": map[string]any{
"kind": fhirFetchPageToolType,
"type": fhirFetchPageToolType,
"source": "my-instance",
"description": "Tool to fetch a page of FHIR resources",
"authRequired": []string{
@@ -557,7 +557,7 @@ func getToolsConfig(sourceConfig map[string]any) map[string]any {
},
},
"my-auth-get-dicom-store-tool": map[string]any{
"kind": getDICOMStoreToolType,
"type": getDICOMStoreToolType,
"source": "my-instance",
"description": "Tool to get a DICOM store",
"authRequired": []string{
@@ -565,7 +565,7 @@ func getToolsConfig(sourceConfig map[string]any) map[string]any {
},
},
"my-auth-get-dicom-store-metrics-tool": map[string]any{
"kind": getDICOMStoreMetricsToolType,
"type": getDICOMStoreMetricsToolType,
"source": "my-instance",
"description": "Tool to get DICOM store metrics",
"authRequired": []string{
@@ -573,7 +573,7 @@ func getToolsConfig(sourceConfig map[string]any) map[string]any {
},
},
"my-auth-search-dicom-studies-tool": map[string]any{
"kind": searchDICOMStudiesToolType,
"type": searchDICOMStudiesToolType,
"source": "my-instance",
"description": "Tool to search DICOM studies",
"authRequired": []string{
@@ -581,7 +581,7 @@ func getToolsConfig(sourceConfig map[string]any) map[string]any {
},
},
"my-auth-search-dicom-series-tool": map[string]any{
"kind": searchDICOMSeriesToolType,
"type": searchDICOMSeriesToolType,
"source": "my-instance",
"description": "Tool to search DICOM series",
"authRequired": []string{
@@ -589,7 +589,7 @@ func getToolsConfig(sourceConfig map[string]any) map[string]any {
},
},
"my-auth-search-dicom-instances-tool": map[string]any{
"kind": searchDICOMInstancesToolType,
"type": searchDICOMInstancesToolType,
"source": "my-instance",
"description": "Tool to search DICOM instances",
"authRequired": []string{
@@ -597,7 +597,7 @@ func getToolsConfig(sourceConfig map[string]any) map[string]any {
},
},
"my-auth-retrieve-rendered-dicom-instance-tool": map[string]any{
"kind": retrieveRenderedDICOMInstanceToolType,
"type": retrieveRenderedDICOMInstanceToolType,
"source": "my-instance",
"description": "Tool to retrieve rendered DICOM instance",
"authRequired": []string{
@@ -607,7 +607,7 @@ func getToolsConfig(sourceConfig map[string]any) map[string]any {
},
"authServices": map[string]any{
"my-google-auth": map[string]any{
"kind": "google",
"type": "google",
"clientId": tests.ClientId,
},
},
@@ -621,7 +621,7 @@ func addClientAuthSourceConfig(t *testing.T, config map[string]any) map[string]a
t.Fatalf("unable to get sources from config")
}
sources["my-client-auth-source"] = map[string]any{
"kind": healthcareSourceType,
"type": healthcareSourceType,
"project": healthcareProject,
"region": healthcareRegion,
"dataset": healthcareDataset,

View File

@@ -231,12 +231,12 @@ func getCloneInstanceToolsConfig() map[string]any {
return map[string]any{
"sources": map[string]any{
"my-cloud-sql-source": map[string]any{
"kind": "cloud-sql-admin",
"type": "cloud-sql-admin",
},
},
"tools": map[string]any{
"clone-instance": map[string]any{
"kind": cloneInstanceToolType,
"type": cloneInstanceToolType,
"source": "my-cloud-sql-source",
},
},

View File

@@ -219,12 +219,12 @@ func getCreateBackupToolsConfig() map[string]any {
return map[string]any{
"sources": map[string]any{
"my-cloud-sql-source": map[string]any{
"kind": "cloud-sql-admin",
"type": "cloud-sql-admin",
},
},
"tools": map[string]any{
"create-backup": map[string]any{
"kind": createBackupToolType,
"type": createBackupToolType,
"source": "my-cloud-sql-source",
},
},

View File

@@ -217,12 +217,12 @@ func getCreateDatabaseToolsConfig() map[string]any {
return map[string]any{
"sources": map[string]any{
"my-cloud-sql-source": map[string]any{
"kind": "cloud-sql-admin",
"type": "cloud-sql-admin",
},
},
"tools": map[string]any{
"create-database": map[string]any{
"kind": createDatabaseToolType,
"type": createDatabaseToolType,
"source": "my-cloud-sql-source",
},
},

View File

@@ -229,12 +229,12 @@ func getCreateUsersToolsConfig() map[string]any {
return map[string]any{
"sources": map[string]any{
"my-cloud-sql-source": map[string]any{
"kind": "cloud-sql-admin",
"type": "cloud-sql-admin",
},
},
"tools": map[string]any{
"create-user": map[string]any{
"kind": createUserToolType,
"type": createUserToolType,
"source": "my-cloud-sql-source",
},
},

View File

@@ -53,7 +53,7 @@ func (t *getInstancesTransport) RoundTrip(req *http.Request) (*http.Response, er
type instance struct {
Name string `json:"name"`
Type string `json:"kind"`
Type string `json:"type"`
}
type handler struct {
@@ -151,7 +151,7 @@ func TestGetInstancesToolEndpoints(t *testing.T) {
name: "successful get instance",
toolName: "get-instance-1",
body: `{"projectId": "p1", "instanceId": "instance-1"}`,
want: `{"name":"instance-1","kind":"sql#instance"}`,
want: `{"name":"instance-1","type":"sql#instance"}`,
},
{
name: "failed get instance",
@@ -231,21 +231,21 @@ func getToolsConfig() map[string]any {
return map[string]any{
"sources": map[string]any{
"my-cloud-sql-source": map[string]any{
"kind": "cloud-sql-admin",
"type": "cloud-sql-admin",
},
"my-invalid-cloud-sql-source": map[string]any{
"kind": "cloud-sql-admin",
"type": "cloud-sql-admin",
"useClientOAuth": true,
},
},
"tools": map[string]any{
"get-instance-1": map[string]any{
"kind": getInstancesToolType,
"type": getInstancesToolType,
"description": "get instance 1",
"source": "my-cloud-sql-source",
},
"get-instance-2": map[string]any{
"kind": getInstancesToolType,
"type": getInstancesToolType,
"description": "get instance 2",
"source": "my-invalid-cloud-sql-source",
},

View File

@@ -200,12 +200,12 @@ func getListDatabasesToolsConfig() map[string]any {
return map[string]any{
"sources": map[string]any{
"my-cloud-sql-source": map[string]any{
"kind": "cloud-sql-admin",
"type": "cloud-sql-admin",
},
},
"tools": map[string]any{
"list-databases": map[string]any{
"kind": listDatabasesToolType,
"type": listDatabasesToolType,
"source": "my-cloud-sql-source",
},
},

View File

@@ -171,20 +171,20 @@ func getListInstanceToolsConfig() map[string]any {
return map[string]any{
"sources": map[string]any{
"my-cloud-sql-source": map[string]any{
"kind": "cloud-sql-admin",
"type": "cloud-sql-admin",
},
"my-invalid-cloud-sql-source": map[string]any{
"kind": "cloud-sql-admin",
"type": "cloud-sql-admin",
"useClientOAuth": true,
},
},
"tools": map[string]any{
"list-instances": map[string]any{
"kind": "cloud-sql-list-instances",
"type": "cloud-sql-list-instances",
"source": "my-cloud-sql-source",
},
"list-instances-fail": map[string]any{
"kind": "cloud-sql-list-instances",
"type": "cloud-sql-list-instances",
"description": "list instances",
"source": "my-invalid-cloud-sql-source",
},

View File

@@ -291,22 +291,22 @@ func getCloudSQLWaitToolsConfig() map[string]any {
return map[string]any{
"sources": map[string]any{
"my-cloud-sql-source": map[string]any{
"kind": "cloud-sql-admin",
"type": "cloud-sql-admin",
},
},
"tools": map[string]any{
"wait-for-op1": map[string]any{
"kind": cloudsqlWaitToolType,
"type": cloudsqlWaitToolType,
"source": "my-cloud-sql-source",
"description": "wait for op1",
},
"wait-for-op2": map[string]any{
"kind": cloudsqlWaitToolType,
"type": cloudsqlWaitToolType,
"source": "my-cloud-sql-source",
"description": "wait for op2",
},
"wait-for-op3": map[string]any{
"kind": cloudsqlWaitToolType,
"type": cloudsqlWaitToolType,
"source": "my-cloud-sql-source",
"description": "wait for op3",
},

View File

@@ -260,16 +260,16 @@ func getCreateInstanceToolsConfig() map[string]any {
return map[string]any{
"sources": map[string]any{
"my-cloud-sql-source": map[string]any{
"kind": "cloud-sql-admin",
"type": "cloud-sql-admin",
},
},
"tools": map[string]any{
"create-instance-prod": map[string]any{
"kind": createInstanceToolType,
"type": createInstanceToolType,
"source": "my-cloud-sql-source",
},
"create-instance-dev": map[string]any{
"kind": createInstanceToolType,
"type": createInstanceToolType,
"source": "my-cloud-sql-source",
},
},

View File

@@ -61,7 +61,7 @@ func getCloudSQLMSSQLVars(t *testing.T) map[string]any {
}
return map[string]any{
"kind": CloudSQLMSSQLSourceType,
"type": CloudSQLMSSQLSourceType,
"project": CloudSQLMSSQLProject,
"instance": CloudSQLMSSQLInstance,
"region": CloudSQLMSSQLRegion,

View File

@@ -261,16 +261,16 @@ func getCreateInstanceToolsConfig() map[string]any {
return map[string]any{
"sources": map[string]any{
"my-cloud-sql-source": map[string]any{
"kind": "cloud-sql-admin",
"type": "cloud-sql-admin",
},
},
"tools": map[string]any{
"create-instance-prod": map[string]any{
"kind": createInstanceToolType,
"type": createInstanceToolType,
"source": "my-cloud-sql-source",
},
"create-instance-dev": map[string]any{
"kind": createInstanceToolType,
"type": createInstanceToolType,
"source": "my-cloud-sql-source",
},
},

View File

@@ -60,7 +60,7 @@ func getCloudSQLMySQLVars(t *testing.T) map[string]any {
}
return map[string]any{
"kind": CloudSQLMySQLSourceType,
"type": CloudSQLMySQLSourceType,
"project": CloudSQLMySQLProject,
"instance": CloudSQLMySQLInstance,
"region": CloudSQLMySQLRegion,
@@ -200,7 +200,7 @@ func TestCloudSQLMySQLIAMConnection(t *testing.T) {
serviceAccountEmail, _, _ := strings.Cut(tests.ServiceAccountEmail, "@")
noPassSourceConfig := map[string]any{
"kind": CloudSQLMySQLSourceType,
"type": CloudSQLMySQLSourceType,
"project": CloudSQLMySQLProject,
"instance": CloudSQLMySQLInstance,
"region": CloudSQLMySQLRegion,
@@ -208,7 +208,7 @@ func TestCloudSQLMySQLIAMConnection(t *testing.T) {
"user": serviceAccountEmail,
}
noUserSourceConfig := map[string]any{
"kind": CloudSQLMySQLSourceType,
"type": CloudSQLMySQLSourceType,
"project": CloudSQLMySQLProject,
"instance": CloudSQLMySQLInstance,
"region": CloudSQLMySQLRegion,
@@ -216,7 +216,7 @@ func TestCloudSQLMySQLIAMConnection(t *testing.T) {
"password": "random",
}
noUserNoPassSourceConfig := map[string]any{
"kind": CloudSQLMySQLSourceType,
"type": CloudSQLMySQLSourceType,
"project": CloudSQLMySQLProject,
"instance": CloudSQLMySQLInstance,
"region": CloudSQLMySQLRegion,
@@ -260,7 +260,7 @@ func TestCloudSQLMySQLIAMConnection(t *testing.T) {
},
"tools": map[string]any{
"my-simple-tool": map[string]any{
"kind": CloudSQLMySQLToolType,
"type": CloudSQLMySQLToolType,
"source": uniqueSourceName,
"description": "Simple tool to test end to end functionality.",
"statement": "SELECT 1;",

View File

@@ -262,16 +262,16 @@ func getCreateInstanceToolsConfig() map[string]any {
return map[string]any{
"sources": map[string]any{
"my-cloud-sql-source": map[string]any{
"kind": "cloud-sql-admin",
"type": "cloud-sql-admin",
},
},
"tools": map[string]any{
"create-instance-prod": map[string]any{
"kind": createInstanceToolType,
"type": createInstanceToolType,
"source": "my-cloud-sql-source",
},
"create-instance-dev": map[string]any{
"kind": createInstanceToolType,
"type": createInstanceToolType,
"source": "my-cloud-sql-source",
},
},

View File

@@ -59,7 +59,7 @@ func getCloudSQLPgVars(t *testing.T) map[string]any {
}
return map[string]any{
"kind": CloudSQLPostgresSourceType,
"type": CloudSQLPostgresSourceType,
"project": CloudSQLPostgresProject,
"instance": CloudSQLPostgresInstance,
"region": CloudSQLPostgresRegion,
@@ -222,7 +222,7 @@ func TestCloudSQLPgIAMConnection(t *testing.T) {
serviceAccountEmail := strings.TrimSuffix(tests.ServiceAccountEmail, ".gserviceaccount.com")
noPassSourceConfig := map[string]any{
"kind": CloudSQLPostgresSourceType,
"type": CloudSQLPostgresSourceType,
"project": CloudSQLPostgresProject,
"instance": CloudSQLPostgresInstance,
"region": CloudSQLPostgresRegion,
@@ -231,7 +231,7 @@ func TestCloudSQLPgIAMConnection(t *testing.T) {
}
noUserSourceConfig := map[string]any{
"kind": CloudSQLPostgresSourceType,
"type": CloudSQLPostgresSourceType,
"project": CloudSQLPostgresProject,
"instance": CloudSQLPostgresInstance,
"region": CloudSQLPostgresRegion,
@@ -240,7 +240,7 @@ func TestCloudSQLPgIAMConnection(t *testing.T) {
}
noUserNoPassSourceConfig := map[string]any{
"kind": CloudSQLPostgresSourceType,
"type": CloudSQLPostgresSourceType,
"project": CloudSQLPostgresProject,
"instance": CloudSQLPostgresInstance,
"region": CloudSQLPostgresRegion,

View File

@@ -264,13 +264,13 @@ func TestPreCheckToolEndpoints(t *testing.T) {
name: "successful precheck - with warnings",
toolName: "precheck-tool",
body: `{"project": "p1", "instance": "instance-warnings", "targetDatabaseVersion": "POSTGRES_18"}`,
want: `{"preCheckResponse":[{"actionsRequired":["Check documentation."],"kind":"","message":"This is a warning.","messageType":"WARNING"}]}`,
want: `{"preCheckResponse":[{"actionsRequired":["Check documentation."],"type":"","message":"This is a warning.","messageType":"WARNING"}]}`,
},
{
name: "successful precheck - with errors",
toolName: "precheck-tool",
body: `{"project": "p1", "instance": "instance-errors", "targetDatabaseVersion": "POSTGRES_18"}`,
want: `{"preCheckResponse":[{"actionsRequired":["Fix this now."],"kind":"","message":"This is a critical error.","messageType":"ERROR"}]}`,
want: `{"preCheckResponse":[{"actionsRequired":["Fix this now."],"type":"","message":"This is a critical error.","messageType":"ERROR"}]}`,
},
{
name: "instance not found",
@@ -368,12 +368,12 @@ func getPreCheckToolsConfig() map[string]any {
return map[string]any{
"sources": map[string]any{
"my-cloud-sql-source": map[string]any{
"kind": "cloud-sql-admin",
"type": "cloud-sql-admin",
},
},
"tools": map[string]any{
"precheck-tool": map[string]any{
"kind": preCheckToolType,
"type": preCheckToolType,
"source": "my-cloud-sql-source",
"authRequired": []string{
"https://www.googleapis.com/auth/cloud-platform",

View File

@@ -24,7 +24,6 @@ import (
"strings"
"testing"
"github.com/goccy/go-yaml"
"github.com/google/go-cmp/cmp"
"github.com/googleapis/genai-toolbox/internal/server"
"github.com/googleapis/genai-toolbox/internal/sources/cloudsqlmysql"
@@ -42,19 +41,19 @@ func GetToolsConfig(sourceConfig map[string]any, toolType, paramToolStatement, i
},
"authServices": map[string]any{
"my-google-auth": map[string]any{
"kind": "google",
"type": "google",
"clientId": ClientId,
},
},
"tools": map[string]any{
"my-simple-tool": map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Simple tool to test end to end functionality.",
"statement": "SELECT 1",
},
"my-tool": map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Tool to test invocation with params.",
"statement": paramToolStatement,
@@ -72,7 +71,7 @@ func GetToolsConfig(sourceConfig map[string]any, toolType, paramToolStatement, i
},
},
"my-tool-by-id": map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Tool to test invocation with params.",
"statement": idParamToolStmt,
@@ -85,7 +84,7 @@ func GetToolsConfig(sourceConfig map[string]any, toolType, paramToolStatement, i
},
},
"my-tool-by-name": map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Tool to test invocation with params.",
"statement": nameParamToolStmt,
@@ -99,7 +98,7 @@ func GetToolsConfig(sourceConfig map[string]any, toolType, paramToolStatement, i
},
},
"my-array-tool": map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Tool to test invocation with array params.",
"statement": arrayToolStatement,
@@ -127,7 +126,7 @@ func GetToolsConfig(sourceConfig map[string]any, toolType, paramToolStatement, i
},
},
"my-auth-tool": map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Tool to test authenticated parameters.",
// statement to auto-fill authenticated parameter
@@ -147,7 +146,7 @@ func GetToolsConfig(sourceConfig map[string]any, toolType, paramToolStatement, i
},
},
"my-auth-required-tool": map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Tool to test auth required invocation.",
"statement": "SELECT 1",
@@ -156,7 +155,7 @@ func GetToolsConfig(sourceConfig map[string]any, toolType, paramToolStatement, i
},
},
"my-fail-tool": map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Tool to test statement with incorrect syntax.",
"statement": "SELEC 1;",
@@ -174,12 +173,12 @@ func AddExecuteSqlConfig(t *testing.T, config map[string]any, toolType string) m
t.Fatalf("unable to get tools from config")
}
tools["my-exec-sql-tool"] = map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Tool to execute sql",
}
tools["my-auth-exec-sql-tool"] = map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Tool to execute sql",
"authRequired": []string{
@@ -221,99 +220,99 @@ func AddPostgresPrebuiltConfig(t *testing.T, config map[string]any) map[string]a
t.Fatalf("unable to get tools from config")
}
tools["list_tables"] = map[string]any{
"kind": PostgresListTablesToolType,
"type": PostgresListTablesToolType,
"source": "my-instance",
"description": "Lists tables in the database.",
}
tools["list_active_queries"] = map[string]any{
"kind": PostgresListActiveQueriesToolType,
"type": PostgresListActiveQueriesToolType,
"source": "my-instance",
"description": "Lists active queries in the database.",
}
tools["list_installed_extensions"] = map[string]any{
"kind": PostgresListInstalledExtensionsToolType,
"type": PostgresListInstalledExtensionsToolType,
"source": "my-instance",
"description": "Lists installed extensions in the database.",
}
tools["list_available_extensions"] = map[string]any{
"kind": PostgresListAvailableExtensionsToolType,
"type": PostgresListAvailableExtensionsToolType,
"source": "my-instance",
"description": "Lists available extensions in the database.",
}
tools["list_views"] = map[string]any{
"kind": PostgresListViewsToolType,
"type": PostgresListViewsToolType,
"source": "my-instance",
}
tools["list_schemas"] = map[string]any{
"kind": PostgresListSchemasToolType,
"type": PostgresListSchemasToolType,
"source": "my-instance",
}
tools["database_overview"] = map[string]any{
"kind": PostgresDatabaseOverviewToolType,
"type": PostgresDatabaseOverviewToolType,
"source": "my-instance",
}
tools["list_triggers"] = map[string]any{
"kind": PostgresListTriggersToolType,
"type": PostgresListTriggersToolType,
"source": "my-instance",
}
tools["list_indexes"] = map[string]any{
"kind": PostgresListIndexesToolType,
"type": PostgresListIndexesToolType,
"source": "my-instance",
}
tools["list_sequences"] = map[string]any{
"kind": PostgresListSequencesToolType,
"type": PostgresListSequencesToolType,
"source": "my-instance",
}
tools["list_publication_tables"] = map[string]any{
"kind": PostgresListPublicationTablesToolType,
"type": PostgresListPublicationTablesToolType,
"source": "my-instance",
}
tools["long_running_transactions"] = map[string]any{
"kind": PostgresLongRunningTransactionsToolType,
"type": PostgresLongRunningTransactionsToolType,
"source": "my-instance",
}
tools["list_locks"] = map[string]any{
"kind": PostgresListLocksToolType,
"type": PostgresListLocksToolType,
"source": "my-instance",
}
tools["replication_stats"] = map[string]any{
"kind": PostgresReplicationStatsToolType,
"type": PostgresReplicationStatsToolType,
"source": "my-instance",
}
tools["list_query_stats"] = map[string]any{
"kind": PostgresListQueryStatsToolType,
"type": PostgresListQueryStatsToolType,
"source": "my-instance",
}
tools["get_column_cardinality"] = map[string]any{
"kind": PostgresGetColumnCardinalityToolType,
"type": PostgresGetColumnCardinalityToolType,
"source": "my-instance",
}
tools["list_table_stats"] = map[string]any{
"kind": PostgresListTableStats,
"type": PostgresListTableStats,
"source": "my-instance",
}
tools["list_tablespaces"] = map[string]any{
"kind": PostgresListTablespacesToolType,
"type": PostgresListTablespacesToolType,
"source": "my-instance",
}
tools["list_pg_settings"] = map[string]any{
"kind": PostgresListPGSettingsToolType,
"type": PostgresListPGSettingsToolType,
"source": "my-instance",
}
tools["list_database_stats"] = map[string]any{
"kind": PostgresListDatabaseStatsToolType,
"type": PostgresListDatabaseStatsToolType,
"source": "my-instance",
}
tools["list_roles"] = map[string]any{
"kind": PostgresListRolesToolType,
"type": PostgresListRolesToolType,
"source": "my-instance",
}
tools["list_stored_procedure"] = map[string]any{
"kind": PostgresListStoredProcedureToolType,
"type": PostgresListStoredProcedureToolType,
"source": "my-instance",
}
config["tools"] = tools
@@ -332,7 +331,7 @@ func AddTemplateParamConfig(t *testing.T, config map[string]any, toolType, tmplS
}
toolsMap["create-table-templateParams-tool"] = map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Create table tool with template parameters",
"statement": "CREATE TABLE {{.tableName}} ({{array .columns}})",
@@ -342,7 +341,7 @@ func AddTemplateParamConfig(t *testing.T, config map[string]any, toolType, tmplS
},
}
toolsMap["insert-table-templateParams-tool"] = map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Insert tool with template parameters",
"statement": "INSERT INTO {{.tableName}} ({{array .columns}}) VALUES ({{.values}})",
@@ -353,7 +352,7 @@ func AddTemplateParamConfig(t *testing.T, config map[string]any, toolType, tmplS
},
}
toolsMap["select-templateParams-tool"] = map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Create table tool with template parameters",
"statement": selectAll,
@@ -362,7 +361,7 @@ func AddTemplateParamConfig(t *testing.T, config map[string]any, toolType, tmplS
},
}
toolsMap["select-templateParams-combined-tool"] = map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Create table tool with template parameters",
"statement": tmplSelectCombined,
@@ -372,7 +371,7 @@ func AddTemplateParamConfig(t *testing.T, config map[string]any, toolType, tmplS
},
}
toolsMap["select-fields-templateParams-tool"] = map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Create table tool with template parameters",
"statement": "SELECT {{array .fields}} FROM {{.tableName}} ORDER BY id",
@@ -382,7 +381,7 @@ func AddTemplateParamConfig(t *testing.T, config map[string]any, toolType, tmplS
},
}
toolsMap["select-filter-templateParams-combined-tool"] = map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Create table tool with template parameters",
"statement": tmplSelectFilterCombined,
@@ -393,7 +392,7 @@ func AddTemplateParamConfig(t *testing.T, config map[string]any, toolType, tmplS
},
}
toolsMap["drop-table-templateParams-tool"] = map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Drop table tool with template parameters",
"statement": "DROP TABLE IF EXISTS {{.tableName}}",
@@ -412,12 +411,12 @@ func AddMySqlExecuteSqlConfig(t *testing.T, config map[string]any) map[string]an
t.Fatalf("unable to get tools from config")
}
tools["my-exec-sql-tool"] = map[string]any{
"kind": "mysql-execute-sql",
"type": "mysql-execute-sql",
"source": "my-instance",
"description": "Tool to execute sql",
}
tools["my-auth-exec-sql-tool"] = map[string]any{
"kind": "mysql-execute-sql",
"type": "mysql-execute-sql",
"source": "my-instance",
"description": "Tool to execute sql",
"authRequired": []string{
@@ -435,27 +434,27 @@ func AddMySQLPrebuiltToolConfig(t *testing.T, config map[string]any) map[string]
t.Fatalf("unable to get tools from config")
}
tools["list_tables"] = map[string]any{
"kind": "mysql-list-tables",
"type": "mysql-list-tables",
"source": "my-instance",
"description": "Lists tables in the database.",
}
tools["list_active_queries"] = map[string]any{
"kind": "mysql-list-active-queries",
"type": "mysql-list-active-queries",
"source": "my-instance",
"description": "Lists active queries in the database.",
}
tools["list_tables_missing_unique_indexes"] = map[string]any{
"kind": "mysql-list-tables-missing-unique-indexes",
"type": "mysql-list-tables-missing-unique-indexes",
"source": "my-instance",
"description": "Lists tables that do not have primary or unique indexes in the database.",
}
tools["list_table_fragmentation"] = map[string]any{
"kind": "mysql-list-table-fragmentation",
"type": "mysql-list-table-fragmentation",
"source": "my-instance",
"description": "Lists table fragmentation in the database.",
}
tools["get_query_plan"] = map[string]any{
"kind": "mysql-get-query-plan",
"type": "mysql-get-query-plan",
"source": "my-instance",
"description": "Gets the query plan for a SQL statement.",
}
@@ -470,12 +469,12 @@ func AddMSSQLExecuteSqlConfig(t *testing.T, config map[string]any) map[string]an
t.Fatalf("unable to get tools from config")
}
tools["my-exec-sql-tool"] = map[string]any{
"kind": "mssql-execute-sql",
"type": "mssql-execute-sql",
"source": "my-instance",
"description": "Tool to execute sql",
}
tools["my-auth-exec-sql-tool"] = map[string]any{
"kind": "mssql-execute-sql",
"type": "mssql-execute-sql",
"source": "my-instance",
"description": "Tool to execute sql",
"authRequired": []string{
@@ -493,7 +492,7 @@ func AddMSSQLPrebuiltToolConfig(t *testing.T, config map[string]any) map[string]
t.Fatalf("unable to get tools from config")
}
tools["list_tables"] = map[string]any{
"kind": "mssql-list-tables",
"type": "mssql-list-tables",
"source": "my-instance",
"description": "Lists tables in the database.",
}
@@ -501,7 +500,7 @@ func AddMSSQLPrebuiltToolConfig(t *testing.T, config map[string]any) map[string]
return config
}
// GetPostgresSQLParamToolInfo returns statements and param for my-tool postgres-sql kind
// GetPostgresSQLParamToolInfo returns statements and param for my-tool postgres-sql type
func GetPostgresSQLParamToolInfo(tableName string) (string, string, string, string, string, string, []any) {
createStatement := fmt.Sprintf("CREATE TABLE %s (id SERIAL PRIMARY KEY, name TEXT);", tableName)
insertStatement := fmt.Sprintf("INSERT INTO %s (name) VALUES ($1), ($2), ($3), ($4);", tableName)
@@ -513,7 +512,7 @@ func GetPostgresSQLParamToolInfo(tableName string) (string, string, string, stri
return createStatement, insertStatement, toolStatement, idParamStatement, nameParamStatement, arrayToolStatement, params
}
// GetPostgresSQLAuthToolInfo returns statements and param of my-auth-tool for postgres-sql kind
// GetPostgresSQLAuthToolInfo returns statements and param of my-auth-tool for postgres-sql type
func GetPostgresSQLAuthToolInfo(tableName string) (string, string, string, []any) {
createStatement := fmt.Sprintf("CREATE TABLE %s (id SERIAL PRIMARY KEY, name TEXT, email TEXT);", tableName)
insertStatement := fmt.Sprintf("INSERT INTO %s (name, email) VALUES ($1, $2), ($3, $4)", tableName)
@@ -522,14 +521,14 @@ func GetPostgresSQLAuthToolInfo(tableName string) (string, string, string, []any
return createStatement, insertStatement, toolStatement, params
}
// GetPostgresSQLTmplToolStatement returns statements and param for template parameter test cases for postgres-sql kind
// GetPostgresSQLTmplToolStatement returns statements and param for template parameter test cases for postgres-sql type
func GetPostgresSQLTmplToolStatement() (string, string) {
tmplSelectCombined := "SELECT * FROM {{.tableName}} WHERE id = $1"
tmplSelectFilterCombined := "SELECT * FROM {{.tableName}} WHERE {{.columnFilter}} = $1"
return tmplSelectCombined, tmplSelectFilterCombined
}
// GetMSSQLParamToolInfo returns statements and param for my-tool mssql-sql kind
// GetMSSQLParamToolInfo returns statements and param for my-tool mssql-sql type
func GetMSSQLParamToolInfo(tableName string) (string, string, string, string, string, string, []any) {
createStatement := fmt.Sprintf("CREATE TABLE %s (id INT IDENTITY(1,1) PRIMARY KEY, name VARCHAR(255));", tableName)
insertStatement := fmt.Sprintf("INSERT INTO %s (name) VALUES (@alice), (@jane), (@sid), (@nil);", tableName)
@@ -541,7 +540,7 @@ func GetMSSQLParamToolInfo(tableName string) (string, string, string, string, st
return createStatement, insertStatement, toolStatement, idParamStatement, nameParamStatement, arrayToolStatement, params
}
// GetMSSQLAuthToolInfo returns statements and param of my-auth-tool for mssql-sql kind
// GetMSSQLAuthToolInfo returns statements and param of my-auth-tool for mssql-sql type
func GetMSSQLAuthToolInfo(tableName string) (string, string, string, []any) {
createStatement := fmt.Sprintf("CREATE TABLE %s (id INT IDENTITY(1,1) PRIMARY KEY, name VARCHAR(255), email VARCHAR(255));", tableName)
insertStatement := fmt.Sprintf("INSERT INTO %s (name, email) VALUES (@alice, @aliceemail), (@jane, @janeemail);", tableName)
@@ -550,14 +549,14 @@ func GetMSSQLAuthToolInfo(tableName string) (string, string, string, []any) {
return createStatement, insertStatement, toolStatement, params
}
// GetMSSQLTmplToolStatement returns statements and param for template parameter test cases for mysql-sql kind
// GetMSSQLTmplToolStatement returns statements and param for template parameter test cases for mysql-sql type
func GetMSSQLTmplToolStatement() (string, string) {
tmplSelectCombined := "SELECT * FROM {{.tableName}} WHERE id = @id"
tmplSelectFilterCombined := "SELECT * FROM {{.tableName}} WHERE {{.columnFilter}} = @name"
return tmplSelectCombined, tmplSelectFilterCombined
}
// GetMySQLParamToolInfo returns statements and param for my-tool mysql-sql kind
// GetMySQLParamToolInfo returns statements and param for my-tool mysql-sql type
func GetMySQLParamToolInfo(tableName string) (string, string, string, string, string, string, []any) {
createStatement := fmt.Sprintf("CREATE TABLE %s (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255));", tableName)
insertStatement := fmt.Sprintf("INSERT INTO %s (name) VALUES (?), (?), (?), (?);", tableName)
@@ -569,7 +568,7 @@ func GetMySQLParamToolInfo(tableName string) (string, string, string, string, st
return createStatement, insertStatement, toolStatement, idParamStatement, nameParamStatement, arrayToolStatement, params
}
// GetMySQLAuthToolInfo returns statements and param of my-auth-tool for mysql-sql kind
// GetMySQLAuthToolInfo returns statements and param of my-auth-tool for mysql-sql type
func GetMySQLAuthToolInfo(tableName string) (string, string, string, []any) {
createStatement := fmt.Sprintf("CREATE TABLE %s (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255), email VARCHAR(255));", tableName)
insertStatement := fmt.Sprintf("INSERT INTO %s (name, email) VALUES (?, ?), (?, ?)", tableName)
@@ -578,7 +577,7 @@ func GetMySQLAuthToolInfo(tableName string) (string, string, string, []any) {
return createStatement, insertStatement, toolStatement, params
}
// GetMySQLTmplToolStatement returns statements and param for template parameter test cases for mysql-sql kind
// GetMySQLTmplToolStatement returns statements and param for template parameter test cases for mysql-sql type
func GetMySQLTmplToolStatement() (string, string) {
tmplSelectCombined := "SELECT * FROM {{.tableName}} WHERE id = ?"
tmplSelectFilterCombined := "SELECT * FROM {{.tableName}} WHERE {{.columnFilter}} = ?"
@@ -718,19 +717,19 @@ func GetRedisValkeyToolsConfig(sourceConfig map[string]any, toolType string) map
},
"authServices": map[string]any{
"my-google-auth": map[string]any{
"kind": "google",
"type": "google",
"clientId": ClientId,
},
},
"tools": map[string]any{
"my-simple-tool": map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Simple tool to test end to end functionality.",
"commands": [][]string{{"PING"}},
},
"my-tool": map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Tool to test invocation with params.",
"commands": [][]string{{"HGETALL", "row1"}, {"HGETALL", "row3"}},
@@ -748,7 +747,7 @@ func GetRedisValkeyToolsConfig(sourceConfig map[string]any, toolType string) map
},
},
"my-tool-by-id": map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Tool to test invocation with params.",
"commands": [][]string{{"HGETALL", "row4"}},
@@ -761,7 +760,7 @@ func GetRedisValkeyToolsConfig(sourceConfig map[string]any, toolType string) map
},
},
"my-tool-by-name": map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Tool to test invocation with params.",
"commands": [][]string{{"GET", "null"}},
@@ -775,7 +774,7 @@ func GetRedisValkeyToolsConfig(sourceConfig map[string]any, toolType string) map
},
},
"my-array-tool": map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Tool to test invocation with array params.",
"commands": [][]string{{"HGETALL", "row1"}, {"$cmdArray"}},
@@ -793,7 +792,7 @@ func GetRedisValkeyToolsConfig(sourceConfig map[string]any, toolType string) map
},
},
"my-auth-tool": map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Tool to test authenticated parameters.",
// statement to auto-fill authenticated parameter
@@ -813,7 +812,7 @@ func GetRedisValkeyToolsConfig(sourceConfig map[string]any, toolType string) map
},
},
"my-auth-required-tool": map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Tool to test auth required invocation.",
"commands": [][]string{{"PING"}},
@@ -822,7 +821,7 @@ func GetRedisValkeyToolsConfig(sourceConfig map[string]any, toolType string) map
},
},
"my-fail-tool": map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Tool to test statement with incorrect syntax.",
"commands": [][]string{{"SELEC 1;"}},
@@ -843,15 +842,15 @@ func TestCloudSQLMySQL_IPTypeParsingFromYAML(t *testing.T) {
{
desc: "IPType Defaulting to Public",
in: `
sources:
my-mysql-instance:
kind: cloud-sql-mysql
project: my-project
region: my-region
instance: my-instance
database: my_db
user: my_user
password: my_pass
kind: sources
name: my-mysql-instance
type: cloud-sql-mysql
project: my-project
region: my-region
instance: my-instance
database: my_db
user: my_user
password: my_pass
`,
want: server.SourceConfigs{
"my-mysql-instance": cloudsqlmysql.Config{
@@ -870,16 +869,16 @@ func TestCloudSQLMySQL_IPTypeParsingFromYAML(t *testing.T) {
{
desc: "IPType Explicit Public",
in: `
sources:
my-mysql-instance:
kind: cloud-sql-mysql
project: my-project
region: my-region
instance: my-instance
ipType: Public
database: my_db
user: my_user
password: my_pass
kind: sources
name: my-mysql-instance
type: cloud-sql-mysql
project: my-project
region: my-region
instance: my-instance
ipType: Public
database: my_db
user: my_user
password: my_pass
`,
want: server.SourceConfigs{
"my-mysql-instance": cloudsqlmysql.Config{
@@ -898,16 +897,16 @@ func TestCloudSQLMySQL_IPTypeParsingFromYAML(t *testing.T) {
{
desc: "IPType Explicit Private",
in: `
sources:
my-mysql-instance:
kind: cloud-sql-mysql
project: my-project
region: my-region
instance: my-instance
ipType: private
database: my_db
user: my_user
password: my_pass
kind: sources
name: my-mysql-instance
type: cloud-sql-mysql
project: my-project
region: my-region
instance: my-instance
ipType: private
database: my_db
user: my_user
password: my_pass
`,
want: server.SourceConfigs{
"my-mysql-instance": cloudsqlmysql.Config{
@@ -926,16 +925,12 @@ func TestCloudSQLMySQL_IPTypeParsingFromYAML(t *testing.T) {
}
for _, tc := range tcs {
t.Run(tc.desc, func(t *testing.T) {
got := struct {
Sources server.SourceConfigs `yaml:"sources"`
}{}
// Parse contents
err := yaml.Unmarshal(testutils.FormatYaml(tc.in), &got)
got, _, _, _, _, _, err := server.UnmarshalResourceConfig(context.Background(), testutils.FormatYaml(tc.in))
if err != nil {
t.Fatalf("unable to unmarshal: %s", err)
}
if !cmp.Equal(tc.want, got.Sources) {
t.Fatalf("incorrect parse: diff (-want +got):\n%s", cmp.Diff(tc.want, got.Sources))
if !cmp.Equal(tc.want, got) {
t.Fatalf("incorrect parse: diff (-want +got):\n%s", cmp.Diff(tc.want, got))
}
})
}

View File

@@ -58,7 +58,7 @@ func getCouchbaseVars(t *testing.T) map[string]any {
}
return map[string]any{
"kind": couchbaseSourceType,
"type": couchbaseSourceType,
"connectionString": couchbaseConnection,
"bucket": couchbaseBucket,
"scope": couchbaseScope,
@@ -231,7 +231,7 @@ func setupCouchbaseCollection(t *testing.T, ctx context.Context, cluster *gocb.C
}
}
// getCouchbaseParamToolInfo returns statements and params for my-tool couchbase-sql kind
// getCouchbaseParamToolInfo returns statements and params for my-tool couchbase-sql type
func getCouchbaseParamToolInfo(collectionName string) (string, string, string, string, []map[string]any) {
// N1QL uses positional or named parameters with $ prefix
toolStatement := fmt.Sprintf("SELECT TONUMBER(meta().id) as id, "+
@@ -254,7 +254,7 @@ func getCouchbaseParamToolInfo(collectionName string) (string, string, string, s
return toolStatement, idToolStatement, nameToolStatement, arrayToolStatemnt, params
}
// getCouchbaseAuthToolInfo returns statements and param of my-auth-tool for couchbase-sql kind
// getCouchbaseAuthToolInfo returns statements and param of my-auth-tool for couchbase-sql type
func getCouchbaseAuthToolInfo(collectionName string) (string, []map[string]any) {
toolStatement := fmt.Sprintf("SELECT name FROM %s WHERE email = $email", collectionName)

View File

@@ -69,7 +69,7 @@ func TestDataformCompileTool(t *testing.T) {
toolsFile := map[string]any{
"tools": map[string]any{
"my-dataform-compiler": map[string]any{
"kind": "dataform-compile-local",
"type": "dataform-compile-local",
"description": "Tool to compile dataform projects",
},
},

View File

@@ -53,7 +53,7 @@ func getDataplexVars(t *testing.T) map[string]any {
t.Fatal("'DATAPLEX_PROJECT' not set")
}
return map[string]any{
"kind": DataplexSourceType,
"type": DataplexSourceType,
"project": DataplexProject,
}
}
@@ -283,40 +283,40 @@ func getDataplexToolsConfig(sourceConfig map[string]any) map[string]any {
},
"authServices": map[string]any{
"my-google-auth": map[string]any{
"kind": "google",
"type": "google",
"clientId": tests.ClientId,
},
},
"tools": map[string]any{
"my-dataplex-search-entries-tool": map[string]any{
"kind": DataplexSearchEntriesToolType,
"type": DataplexSearchEntriesToolType,
"source": "my-dataplex-instance",
"description": "Simple dataplex search entries tool to test end to end functionality.",
},
"my-auth-dataplex-search-entries-tool": map[string]any{
"kind": DataplexSearchEntriesToolType,
"type": DataplexSearchEntriesToolType,
"source": "my-dataplex-instance",
"description": "Simple dataplex search entries tool to test end to end functionality.",
"authRequired": []string{"my-google-auth"},
},
"my-dataplex-lookup-entry-tool": map[string]any{
"kind": DataplexLookupEntryToolType,
"type": DataplexLookupEntryToolType,
"source": "my-dataplex-instance",
"description": "Simple dataplex lookup entry tool to test end to end functionality.",
},
"my-auth-dataplex-lookup-entry-tool": map[string]any{
"kind": DataplexLookupEntryToolType,
"type": DataplexLookupEntryToolType,
"source": "my-dataplex-instance",
"description": "Simple dataplex lookup entry tool to test end to end functionality.",
"authRequired": []string{"my-google-auth"},
},
"my-dataplex-search-aspect-types-tool": map[string]any{
"kind": DataplexSearchAspectTypesToolType,
"type": DataplexSearchAspectTypesToolType,
"source": "my-dataplex-instance",
"description": "Simple dataplex search aspect types tool to test end to end functionality.",
},
"my-auth-dataplex-search-aspect-types-tool": map[string]any{
"kind": DataplexSearchAspectTypesToolType,
"type": DataplexSearchAspectTypesToolType,
"source": "my-dataplex-instance",
"description": "Simple dataplex search aspect types tool to test end to end functionality.",
"authRequired": []string{"my-google-auth"},

View File

@@ -41,7 +41,7 @@ func getDgraphVars(t *testing.T) map[string]any {
t.Fatal("'DGRAPH_URL' not set")
}
return map[string]any{
"kind": DgraphSourceType,
"type": DgraphSourceType,
"dgraphUrl": DgraphUrl,
"apiKey": DgraphApiKey,
}
@@ -61,7 +61,7 @@ func TestDgraphToolEndpoints(t *testing.T) {
},
"tools": map[string]any{
"my-simple-dql-tool": map[string]any{
"kind": "dgraph-dql",
"type": "dgraph-dql",
"source": "my-dgraph-instance",
"description": "Simple tool to test end to end functionality.",
"statement": "{result(func: uid(0x0)) {constant: math(1)}}",

View File

@@ -43,7 +43,7 @@ func getElasticsearchVars(t *testing.T) map[string]any {
t.Fatal("'ELASTICSEARCH_HOST' not set")
}
return map[string]any{
"kind": ElasticsearchSourceType,
"type": ElasticsearchSourceType,
"addresses": []string{EsAddress},
"username": EsUser,
"password": EsPass,
@@ -184,19 +184,19 @@ func getElasticsearchToolsConfig(sourceConfig map[string]any, toolType, paramToo
},
"authServices": map[string]any{
"my-google-auth": map[string]any{
"kind": "google",
"type": "google",
"clientId": tests.ClientId,
},
},
"tools": map[string]any{
"my-simple-tool": map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Simple tool to test end to end functionality.",
"query": "FROM test-index | SORT id ASC",
},
"my-tool": map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Tool to test invocation with params.",
"query": paramToolStatement,
@@ -214,7 +214,7 @@ func getElasticsearchToolsConfig(sourceConfig map[string]any, toolType, paramToo
},
},
"my-tool-by-id": map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Tool to test invocation with params.",
"query": idParamToolStmt,
@@ -227,7 +227,7 @@ func getElasticsearchToolsConfig(sourceConfig map[string]any, toolType, paramToo
},
},
"my-tool-by-name": map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Tool to test invocation with params.",
"query": nameParamToolStmt,
@@ -241,7 +241,7 @@ func getElasticsearchToolsConfig(sourceConfig map[string]any, toolType, paramToo
},
},
"my-array-tool": map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Tool to test invocation with array params.",
"query": arrayToolStatement,
@@ -269,7 +269,7 @@ func getElasticsearchToolsConfig(sourceConfig map[string]any, toolType, paramToo
},
},
"my-auth-tool": map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Tool to test authenticated parameters.",
// statement to auto-fill authenticated parameter
@@ -289,7 +289,7 @@ func getElasticsearchToolsConfig(sourceConfig map[string]any, toolType, paramToo
},
},
"my-auth-required-tool": map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Tool to test auth required invocation.",
"query": "FROM test-index | SORT id ASC",
@@ -298,7 +298,7 @@ func getElasticsearchToolsConfig(sourceConfig map[string]any, toolType, paramToo
},
},
"my-fail-tool": map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Tool to test statement with incorrect syntax.",
"query": "SELEC 1;",

View File

@@ -56,7 +56,7 @@ func getFirebirdVars(t *testing.T) map[string]any {
}
return map[string]any{
"kind": FirebirdSourceType,
"type": FirebirdSourceType,
"host": FirebirdHost,
"port": FirebirdPort,
"database": FirebirdDatabase,
@@ -358,7 +358,7 @@ func addFirebirdTemplateParamConfig(t *testing.T, config map[string]any, toolTyp
// Firebird-specific template parameter tools with compatible syntax
toolsMap["create-table-templateParams-tool"] = map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Create table tool with template parameters",
"statement": "CREATE TABLE {{.tableName}} ({{array .columns}})",
@@ -368,7 +368,7 @@ func addFirebirdTemplateParamConfig(t *testing.T, config map[string]any, toolTyp
},
}
toolsMap["insert-table-templateParams-tool"] = map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Insert table tool with template parameters",
"statement": "INSERT INTO {{.tableName}} ({{array .columns}}) VALUES ({{.values}})",
@@ -379,7 +379,7 @@ func addFirebirdTemplateParamConfig(t *testing.T, config map[string]any, toolTyp
},
}
toolsMap["select-templateParams-tool"] = map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Select table tool with template parameters",
"statement": "SELECT id AS \"id\", name AS \"name\", age AS \"age\" FROM {{.tableName}}",
@@ -388,7 +388,7 @@ func addFirebirdTemplateParamConfig(t *testing.T, config map[string]any, toolTyp
},
}
toolsMap["select-templateParams-combined-tool"] = map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Select table tool with combined template parameters",
"statement": tmplSelectCombined,
@@ -400,7 +400,7 @@ func addFirebirdTemplateParamConfig(t *testing.T, config map[string]any, toolTyp
},
}
toolsMap["select-fields-templateParams-tool"] = map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Select specific fields tool with template parameters",
"statement": "SELECT name AS \"name\" FROM {{.tableName}}",
@@ -409,7 +409,7 @@ func addFirebirdTemplateParamConfig(t *testing.T, config map[string]any, toolTyp
},
}
toolsMap["select-filter-templateParams-combined-tool"] = map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Select table tool with filter template parameters",
"statement": tmplSelectFilterCombined,
@@ -423,7 +423,7 @@ func addFirebirdTemplateParamConfig(t *testing.T, config map[string]any, toolTyp
}
// Firebird uses simple DROP TABLE syntax without IF EXISTS
toolsMap["drop-table-templateParams-tool"] = map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Drop table tool with template parameters",
"statement": "DROP TABLE {{.tableName}}",
@@ -441,12 +441,12 @@ func addFirebirdExecuteSqlConfig(t *testing.T, config map[string]any) map[string
t.Fatalf("unable to get tools from config")
}
tools["my-exec-sql-tool"] = map[string]any{
"kind": "firebird-execute-sql",
"type": "firebird-execute-sql",
"source": "my-instance",
"description": "Tool to execute sql",
}
tools["my-auth-exec-sql-tool"] = map[string]any{
"kind": "firebird-execute-sql",
"type": "firebird-execute-sql",
"source": "my-instance",
"description": "Tool to execute sql",
"authRequired": []string{

View File

@@ -48,7 +48,7 @@ func getFirestoreVars(t *testing.T) map[string]any {
}
vars := map[string]any{
"kind": FirestoreSourceType,
"type": FirestoreSourceType,
"project": FirestoreProject,
}
@@ -527,45 +527,45 @@ func getFirestoreToolsConfig(sourceConfig map[string]any) map[string]any {
tools := map[string]any{
// Tool for RunToolGetTest
"my-simple-tool": map[string]any{
"kind": "firestore-get-documents",
"type": "firestore-get-documents",
"source": "my-instance",
"description": "Simple tool to test end to end functionality.",
},
// Tool for MCP test - this will get documents
"my-param-tool": map[string]any{
"kind": "firestore-get-documents",
"type": "firestore-get-documents",
"source": "my-instance",
"description": "Tool to get documents by paths",
},
// Tool for MCP test that fails
"my-fail-tool": map[string]any{
"kind": "firestore-get-documents",
"type": "firestore-get-documents",
"source": "my-instance",
"description": "Tool that will fail",
},
// Firestore specific tools
"firestore-get-docs": map[string]any{
"kind": "firestore-get-documents",
"type": "firestore-get-documents",
"source": "my-instance",
"description": "Get multiple documents from Firestore",
},
"firestore-list-colls": map[string]any{
"kind": "firestore-list-collections",
"type": "firestore-list-collections",
"source": "my-instance",
"description": "List Firestore collections",
},
"firestore-delete-docs": map[string]any{
"kind": "firestore-delete-documents",
"type": "firestore-delete-documents",
"source": "my-instance",
"description": "Delete documents from Firestore",
},
"firestore-query-coll": map[string]any{
"kind": "firestore-query-collection",
"type": "firestore-query-collection",
"source": "my-instance",
"description": "Query a Firestore collection",
},
"firestore-query-param": map[string]any{
"kind": "firestore-query",
"type": "firestore-query",
"source": "my-instance",
"description": "Query a Firestore collection with parameterizable filters",
"collectionPath": "{{.collection}}",
@@ -595,7 +595,7 @@ func getFirestoreToolsConfig(sourceConfig map[string]any) map[string]any {
},
},
"firestore-query-select-array": map[string]any{
"kind": "firestore-query",
"type": "firestore-query",
"source": "my-instance",
"description": "Query with array-based select fields",
"collectionPath": "{{.collection}}",
@@ -622,22 +622,22 @@ func getFirestoreToolsConfig(sourceConfig map[string]any) map[string]any {
},
},
"firestore-get-rules": map[string]any{
"kind": "firestore-get-rules",
"type": "firestore-get-rules",
"source": "my-instance",
"description": "Get Firestore security rules",
},
"firestore-validate-rules": map[string]any{
"kind": "firestore-validate-rules",
"type": "firestore-validate-rules",
"source": "my-instance",
"description": "Validate Firestore security rules",
},
"firestore-add-docs": map[string]any{
"kind": "firestore-add-documents",
"type": "firestore-add-documents",
"source": "my-instance",
"description": "Add documents to Firestore",
},
"firestore-update-doc": map[string]any{
"kind": "firestore-update-document",
"type": "firestore-update-document",
"source": "my-instance",
"description": "Update a document in Firestore",
},

View File

@@ -46,7 +46,7 @@ func getHTTPSourceConfig(t *testing.T) map[string]any {
idToken = "Bearer " + idToken
return map[string]any{
"kind": HttpSourceType,
"type": HttpSourceType,
"headers": map[string]string{"Authorization": idToken},
}
}
@@ -491,13 +491,13 @@ func getHTTPToolsConfig(sourceConfig map[string]any, toolType string) map[string
},
"authServices": map[string]any{
"my-google-auth": map[string]any{
"kind": "google",
"type": "google",
"clientId": tests.ClientId,
},
},
"tools": map[string]any{
"my-simple-tool": map[string]any{
"kind": toolType,
"type": toolType,
"path": "/tool0",
"method": "POST",
"source": "my-instance",
@@ -505,7 +505,7 @@ func getHTTPToolsConfig(sourceConfig map[string]any, toolType string) map[string
"description": "Simple tool to test end to end functionality.",
},
"my-tool": map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"method": "GET",
"path": "/tool1",
@@ -521,7 +521,7 @@ func getHTTPToolsConfig(sourceConfig map[string]any, toolType string) map[string
"headers": map[string]string{"Content-Type": "application/json"},
},
"my-tool-by-id": map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"method": "GET",
"path": "/tool1id",
@@ -531,7 +531,7 @@ func getHTTPToolsConfig(sourceConfig map[string]any, toolType string) map[string
"headers": map[string]string{"Content-Type": "application/json"},
},
"my-tool-by-name": map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"method": "GET",
"path": "/tool1name",
@@ -541,7 +541,7 @@ func getHTTPToolsConfig(sourceConfig map[string]any, toolType string) map[string
"headers": map[string]string{"Content-Type": "application/json"},
},
"my-query-param-tool": map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"method": "GET",
"path": "/toolQueryTest",
@@ -553,7 +553,7 @@ func getHTTPToolsConfig(sourceConfig map[string]any, toolType string) map[string
},
},
"my-auth-tool": map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"method": "GET",
"path": "/tool2",
@@ -565,7 +565,7 @@ func getHTTPToolsConfig(sourceConfig map[string]any, toolType string) map[string
},
},
"my-auth-required-tool": map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"method": "POST",
"path": "/tool0",
@@ -574,7 +574,7 @@ func getHTTPToolsConfig(sourceConfig map[string]any, toolType string) map[string
"authRequired": []string{"my-google-auth"},
},
"my-advanced-tool": map[string]any{
"kind": toolType,
"type": toolType,
"source": "other-instance",
"method": "get",
"path": "/{{.path}}?id=2",

View File

@@ -62,7 +62,7 @@ func getLookerVars(t *testing.T) map[string]any {
}
return map[string]any{
"kind": LookerSourceType,
"type": LookerSourceType,
"base_url": LookerBaseUrl,
"verify_ssl": (LookerVerifySsl == "true"),
"client_id": LookerClientId,
@@ -93,162 +93,162 @@ func TestLooker(t *testing.T) {
},
"tools": map[string]any{
"get_models": map[string]any{
"kind": "looker-get-models",
"type": "looker-get-models",
"source": "my-instance",
"description": "Simple tool to test end to end functionality.",
},
"get_explores": map[string]any{
"kind": "looker-get-explores",
"type": "looker-get-explores",
"source": "my-instance",
"description": "Simple tool to test end to end functionality.",
},
"get_dimensions": map[string]any{
"kind": "looker-get-dimensions",
"type": "looker-get-dimensions",
"source": "my-instance",
"description": "Simple tool to test end to end functionality.",
},
"get_measures": map[string]any{
"kind": "looker-get-measures",
"type": "looker-get-measures",
"source": "my-instance",
"description": "Simple tool to test end to end functionality.",
},
"get_filters": map[string]any{
"kind": "looker-get-filters",
"type": "looker-get-filters",
"source": "my-instance",
"description": "Simple tool to test end to end functionality.",
},
"get_parameters": map[string]any{
"kind": "looker-get-parameters",
"type": "looker-get-parameters",
"source": "my-instance",
"description": "Simple tool to test end to end functionality.",
},
"query": map[string]any{
"kind": "looker-query",
"type": "looker-query",
"source": "my-instance",
"description": "Simple tool to test end to end functionality.",
},
"query_sql": map[string]any{
"kind": "looker-query-sql",
"type": "looker-query-sql",
"source": "my-instance",
"description": "Simple tool to test end to end functionality.",
},
"query_url": map[string]any{
"kind": "looker-query-url",
"type": "looker-query-url",
"source": "my-instance",
"description": "Simple tool to test end to end functionality.",
},
"get_looks": map[string]any{
"kind": "looker-get-looks",
"type": "looker-get-looks",
"source": "my-instance",
"description": "Simple tool to test end to end functionality.",
},
"make_look": map[string]any{
"kind": "looker-make-look",
"type": "looker-make-look",
"source": "my-instance",
"description": "Simple tool to test end to end functionality.",
},
"get_dashboards": map[string]any{
"kind": "looker-get-dashboards",
"type": "looker-get-dashboards",
"source": "my-instance",
"description": "Simple tool to test end to end functionality.",
},
"make_dashboard": map[string]any{
"kind": "looker-make-dashboard",
"type": "looker-make-dashboard",
"source": "my-instance",
"description": "Simple tool to test end to end functionality.",
},
"add_dashboard_filter": map[string]any{
"kind": "looker-add-dashboard-filter",
"type": "looker-add-dashboard-filter",
"source": "my-instance",
"description": "Simple tool to test end to end functionality.",
},
"add_dashboard_element": map[string]any{
"kind": "looker-add-dashboard-element",
"type": "looker-add-dashboard-element",
"source": "my-instance",
"description": "Simple tool to test end to end functionality.",
},
"conversational_analytics": map[string]any{
"kind": "looker-conversational-analytics",
"type": "looker-conversational-analytics",
"source": "my-instance",
"description": "Simple tool to test end to end functionality.",
},
"health_pulse": map[string]any{
"kind": "looker-health-pulse",
"type": "looker-health-pulse",
"source": "my-instance",
"description": "Checks the health of a Looker instance by running a series of checks on the system.",
},
"health_analyze": map[string]any{
"kind": "looker-health-analyze",
"type": "looker-health-analyze",
"source": "my-instance",
"description": "Provides analysis of a Looker instance's projects, models, or explores.",
},
"health_vacuum": map[string]any{
"kind": "looker-health-vacuum",
"type": "looker-health-vacuum",
"source": "my-instance",
"description": "Vacuums unused content from a Looker instance.",
},
"dev_mode": map[string]any{
"kind": "looker-dev-mode",
"type": "looker-dev-mode",
"source": "my-instance",
"description": "Simple tool to test end to end functionality.",
},
"get_projects": map[string]any{
"kind": "looker-get-projects",
"type": "looker-get-projects",
"source": "my-instance",
"description": "Simple tool to test end to end functionality.",
},
"get_project_files": map[string]any{
"kind": "looker-get-project-files",
"type": "looker-get-project-files",
"source": "my-instance",
"description": "Simple tool to test end to end functionality.",
},
"get_project_file": map[string]any{
"kind": "looker-get-project-file",
"type": "looker-get-project-file",
"source": "my-instance",
"description": "Simple tool to test end to end functionality.",
},
"create_project_file": map[string]any{
"kind": "looker-create-project-file",
"type": "looker-create-project-file",
"source": "my-instance",
"description": "Simple tool to test end to end functionality.",
},
"update_project_file": map[string]any{
"kind": "looker-update-project-file",
"type": "looker-update-project-file",
"source": "my-instance",
"description": "Simple tool to test end to end functionality.",
},
"delete_project_file": map[string]any{
"kind": "looker-delete-project-file",
"type": "looker-delete-project-file",
"source": "my-instance",
"description": "Simple tool to test end to end functionality.",
},
"generate_embed_url": map[string]any{
"kind": "looker-generate-embed-url",
"type": "looker-generate-embed-url",
"source": "my-instance",
"description": "Simple tool to test end to end functionality.",
},
"get_connections": map[string]any{
"kind": "looker-get-connections",
"type": "looker-get-connections",
"source": "my-instance",
"description": "Simple tool to test end to end functionality.",
},
"get_connection_schemas": map[string]any{
"kind": "looker-get-connection-schemas",
"type": "looker-get-connection-schemas",
"source": "my-instance",
"description": "Simple tool to test end to end functionality.",
},
"get_connection_databases": map[string]any{
"kind": "looker-get-connection-databases",
"type": "looker-get-connection-databases",
"source": "my-instance",
"description": "Simple tool to test end to end functionality.",
},
"get_connection_tables": map[string]any{
"kind": "looker-get-connection-tables",
"type": "looker-get-connection-tables",
"source": "my-instance",
"description": "Simple tool to test end to end functionality.",
},
"get_connection_table_columns": map[string]any{
"kind": "looker-get-connection-table-columns",
"type": "looker-get-connection-table-columns",
"source": "my-instance",
"description": "Simple tool to test end to end functionality.",
},

View File

@@ -60,7 +60,7 @@ func getMariaDBVars(t *testing.T) map[string]any {
}
return map[string]any{
"kind": MariaDBSourceType,
"type": MariaDBSourceType,
"host": MariaDBHost,
"port": MariaDBPort,
"database": MariaDBDatabase,

View File

@@ -66,7 +66,7 @@ func getMindsDBVars(t *testing.T) map[string]any {
}
return map[string]any{
"kind": MindsDBSourceType,
"type": MindsDBSourceType,
"host": MindsDBHost,
"port": MindsDBPort,
"database": MindsDBDatabase,
@@ -107,19 +107,19 @@ func TestMindsDBToolEndpoints(t *testing.T) {
},
"authServices": map[string]any{
"my-google-auth": map[string]any{
"kind": "google",
"type": "google",
"clientId": tests.ClientId,
},
},
"tools": map[string]any{
"my-simple-tool": map[string]any{
"kind": MindsDBToolType,
"type": MindsDBToolType,
"source": "my-instance",
"description": "Simple tool to test end to end functionality.",
"statement": "SELECT 1",
},
"my-tool": map[string]any{
"kind": MindsDBToolType,
"type": MindsDBToolType,
"source": "my-instance",
"description": "Tool to test invocation with params.",
"statement": paramToolStmt,
@@ -137,7 +137,7 @@ func TestMindsDBToolEndpoints(t *testing.T) {
},
},
"my-tool-by-id": map[string]any{
"kind": MindsDBToolType,
"type": MindsDBToolType,
"source": "my-instance",
"description": "Tool to test invocation with params.",
"statement": idParamToolStmt,
@@ -150,7 +150,7 @@ func TestMindsDBToolEndpoints(t *testing.T) {
},
},
"my-tool-by-name": map[string]any{
"kind": MindsDBToolType,
"type": MindsDBToolType,
"source": "my-instance",
"description": "Tool to test invocation with params.",
"statement": nameParamToolStmt,
@@ -164,13 +164,13 @@ func TestMindsDBToolEndpoints(t *testing.T) {
},
},
"my-array-tool": map[string]any{
"kind": MindsDBToolType,
"type": MindsDBToolType,
"source": "my-instance",
"description": "Tool to test invocation with array params.",
"statement": "SELECT 1 as id, 'Alice' as name UNION SELECT 3 as id, 'Sid' as name",
},
"my-auth-tool": map[string]any{
"kind": MindsDBToolType,
"type": MindsDBToolType,
"source": "my-instance",
"description": "Tool to test authenticated parameters.",
"statement": authToolStmt,
@@ -189,7 +189,7 @@ func TestMindsDBToolEndpoints(t *testing.T) {
},
},
"my-auth-required-tool": map[string]any{
"kind": MindsDBToolType,
"type": MindsDBToolType,
"source": "my-instance",
"description": "Tool to test auth required invocation.",
"statement": "SELECT 1",
@@ -198,18 +198,18 @@ func TestMindsDBToolEndpoints(t *testing.T) {
},
},
"my-fail-tool": map[string]any{
"kind": MindsDBToolType,
"type": MindsDBToolType,
"source": "my-instance",
"description": "Tool to test statement with incorrect syntax.",
"statement": "INVALID SQL STATEMENT",
},
"my-exec-sql-tool": map[string]any{
"kind": "mindsdb-execute-sql",
"type": "mindsdb-execute-sql",
"source": "my-instance",
"description": "Tool to execute sql",
},
"my-auth-exec-sql-tool": map[string]any{
"kind": "mindsdb-execute-sql",
"type": "mindsdb-execute-sql",
"source": "my-instance",
"description": "Tool to execute sql with auth",
"authRequired": []string{

View File

@@ -48,7 +48,7 @@ func getMongoDBVars(t *testing.T) map[string]any {
t.Fatal("'MongoDbDatabase' not set")
}
return map[string]any{
"kind": MongoDbSourceType,
"type": MongoDbSourceType,
"uri": MongoDbUri,
}
}
@@ -489,13 +489,13 @@ func getMongoDBToolsConfig(sourceConfig map[string]any, toolType string) map[str
},
"authServices": map[string]any{
"my-google-auth": map[string]any{
"kind": "google",
"type": "google",
"clientId": tests.ClientId,
},
},
"tools": map[string]any{
"my-simple-tool": map[string]any{
"kind": "mongodb-find-one",
"type": "mongodb-find-one",
"source": "my-instance",
"description": "Simple tool to test end to end functionality.",
"collection": "test_collection",
@@ -505,7 +505,7 @@ func getMongoDBToolsConfig(sourceConfig map[string]any, toolType string) map[str
"database": MongoDbDatabase,
},
"my-tool": map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Tool to test invocation with params.",
"authRequired": []string{},
@@ -528,7 +528,7 @@ func getMongoDBToolsConfig(sourceConfig map[string]any, toolType string) map[str
"limit": 10,
},
"my-tool-by-id": map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Tool to test invocation with params.",
"authRequired": []string{},
@@ -546,7 +546,7 @@ func getMongoDBToolsConfig(sourceConfig map[string]any, toolType string) map[str
"limit": 10,
},
"my-tool-by-name": map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Tool to test invocation with params.",
"authRequired": []string{},
@@ -565,7 +565,7 @@ func getMongoDBToolsConfig(sourceConfig map[string]any, toolType string) map[str
"limit": 10,
},
"my-array-tool": map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Tool to test invocation with array.",
"authRequired": []string{},
@@ -587,7 +587,7 @@ func getMongoDBToolsConfig(sourceConfig map[string]any, toolType string) map[str
"limit": 10,
},
"my-auth-tool": map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Tool to test authenticated parameters.",
"authRequired": []string{},
@@ -611,7 +611,7 @@ func getMongoDBToolsConfig(sourceConfig map[string]any, toolType string) map[str
"limit": 10,
},
"my-auth-required-tool": map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Tool to test auth required invocation.",
"authRequired": []string{
@@ -624,7 +624,7 @@ func getMongoDBToolsConfig(sourceConfig map[string]any, toolType string) map[str
"limit": 10,
},
"my-fail-tool": map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Tool to test statement with incorrect syntax.",
"authRequired": []string{},
@@ -635,7 +635,7 @@ func getMongoDBToolsConfig(sourceConfig map[string]any, toolType string) map[str
"limit": 10,
},
"my-delete-one-tool": map[string]any{
"kind": "mongodb-delete-one",
"type": "mongodb-delete-one",
"source": "my-instance",
"description": "Tool to test deleting an entry.",
"authRequired": []string{},
@@ -645,7 +645,7 @@ func getMongoDBToolsConfig(sourceConfig map[string]any, toolType string) map[str
"database": MongoDbDatabase,
},
"my-delete-many-tool": map[string]any{
"kind": "mongodb-delete-many",
"type": "mongodb-delete-many",
"source": "my-instance",
"description": "Tool to test deleting multiple entries.",
"authRequired": []string{},
@@ -655,7 +655,7 @@ func getMongoDBToolsConfig(sourceConfig map[string]any, toolType string) map[str
"database": MongoDbDatabase,
},
"my-insert-one-tool": map[string]any{
"kind": "mongodb-insert-one",
"type": "mongodb-insert-one",
"source": "my-instance",
"description": "Tool to test inserting an entry.",
"authRequired": []string{},
@@ -664,7 +664,7 @@ func getMongoDBToolsConfig(sourceConfig map[string]any, toolType string) map[str
"database": MongoDbDatabase,
},
"my-insert-many-tool": map[string]any{
"kind": "mongodb-insert-many",
"type": "mongodb-insert-many",
"source": "my-instance",
"description": "Tool to test inserting multiple entries.",
"authRequired": []string{},
@@ -673,7 +673,7 @@ func getMongoDBToolsConfig(sourceConfig map[string]any, toolType string) map[str
"database": MongoDbDatabase,
},
"my-update-one-tool": map[string]any{
"kind": "mongodb-update-one",
"type": "mongodb-update-one",
"source": "my-instance",
"description": "Tool to test updating an entry.",
"authRequired": []string{},
@@ -698,7 +698,7 @@ func getMongoDBToolsConfig(sourceConfig map[string]any, toolType string) map[str
"database": MongoDbDatabase,
},
"my-update-many-tool": map[string]any{
"kind": "mongodb-update-many",
"type": "mongodb-update-many",
"source": "my-instance",
"description": "Tool to test updating multiple entries.",
"authRequired": []string{},
@@ -723,7 +723,7 @@ func getMongoDBToolsConfig(sourceConfig map[string]any, toolType string) map[str
"database": MongoDbDatabase,
},
"my-aggregate-tool": map[string]any{
"kind": "mongodb-aggregate",
"type": "mongodb-aggregate",
"source": "my-instance",
"description": "Tool to test an aggregation.",
"authRequired": []string{},
@@ -740,7 +740,7 @@ func getMongoDBToolsConfig(sourceConfig map[string]any, toolType string) map[str
"database": MongoDbDatabase,
},
"my-read-only-aggregate-tool": map[string]any{
"kind": "mongodb-aggregate",
"type": "mongodb-aggregate",
"source": "my-instance",
"description": "Tool to test an aggregation.",
"authRequired": []string{},
@@ -758,7 +758,7 @@ func getMongoDBToolsConfig(sourceConfig map[string]any, toolType string) map[str
"database": MongoDbDatabase,
},
"my-read-write-aggregate-tool": map[string]any{
"kind": "mongodb-aggregate",
"type": "mongodb-aggregate",
"source": "my-instance",
"description": "Tool to test an aggregation.",
"authRequired": []string{},

View File

@@ -56,7 +56,7 @@ func getMsSQLVars(t *testing.T) map[string]any {
}
return map[string]any{
"kind": MSSQLSourceType,
"type": MSSQLSourceType,
"host": MSSQLHost,
"port": MSSQLPort,
"database": MSSQLDatabase,

View File

@@ -54,7 +54,7 @@ func getMySQLVars(t *testing.T) map[string]any {
}
return map[string]any{
"kind": MySQLSourceType,
"type": MySQLSourceType,
"host": MySQLHost,
"port": MySQLPort,
"database": MySQLDatabase,

View File

@@ -56,7 +56,7 @@ func getNeo4jVars(t *testing.T) map[string]any {
}
return map[string]any{
"kind": Neo4jSourceType,
"type": Neo4jSourceType,
"uri": Neo4jUri,
"database": Neo4jDatabase,
"user": Neo4jUser,
@@ -81,35 +81,35 @@ func TestNeo4jToolEndpoints(t *testing.T) {
},
"tools": map[string]any{
"my-simple-cypher-tool": map[string]any{
"kind": "neo4j-cypher",
"type": "neo4j-cypher",
"source": "my-neo4j-instance",
"description": "Simple tool to test end to end functionality.",
"statement": "RETURN 1 as a;",
},
"my-simple-execute-cypher-tool": map[string]any{
"kind": "neo4j-execute-cypher",
"type": "neo4j-execute-cypher",
"source": "my-neo4j-instance",
"description": "Simple tool to test end to end functionality.",
},
"my-readonly-execute-cypher-tool": map[string]any{
"kind": "neo4j-execute-cypher",
"type": "neo4j-execute-cypher",
"source": "my-neo4j-instance",
"description": "A readonly cypher execution tool.",
"readOnly": true,
},
"my-schema-tool": map[string]any{
"kind": "neo4j-schema",
"type": "neo4j-schema",
"source": "my-neo4j-instance",
"description": "A tool to get the Neo4j schema.",
},
"my-schema-tool-with-cache": map[string]any{
"kind": "neo4j-schema",
"type": "neo4j-schema",
"source": "my-neo4j-instance",
"description": "A schema tool with a custom cache expiration.",
"cacheExpireMinutes": 10,
},
"my-populated-schema-tool": map[string]any{
"kind": "neo4j-schema",
"type": "neo4j-schema",
"source": "my-neo4j-instance",
"description": "A tool to get the Neo4j schema from a populated DB.",
},

View File

@@ -56,7 +56,7 @@ func getOceanBaseVars(t *testing.T) map[string]any {
}
return map[string]any{
"kind": OceanBaseSourceType,
"type": OceanBaseSourceType,
"host": OceanBaseHost,
"port": OceanBasePort,
"database": OceanBaseDatabase,
@@ -179,12 +179,12 @@ func addOceanBaseExecuteSqlConfig(t *testing.T, config map[string]any) map[strin
t.Fatalf("unable to get tools from config")
}
tools["my-exec-sql-tool"] = map[string]any{
"kind": "oceanbase-execute-sql",
"type": "oceanbase-execute-sql",
"source": "my-instance",
"description": "Tool to execute sql",
}
tools["my-auth-exec-sql-tool"] = map[string]any{
"kind": "oceanbase-execute-sql",
"type": "oceanbase-execute-sql",
"source": "my-instance",
"description": "Tool to execute sql",
"authRequired": []string{

View File

@@ -41,7 +41,7 @@ func getOracleVars(t *testing.T) map[string]any {
}
return map[string]any{
"kind": OracleSourceType,
"type": OracleSourceType,
"connectionString": OracleConnStr,
"useOCI": true,
"user": OracleUser,

View File

@@ -55,7 +55,7 @@ func getPostgresVars(t *testing.T) map[string]any {
}
return map[string]any{
"kind": PostgresSourceType,
"type": PostgresSourceType,
"host": PostgresHost,
"port": PostgresPort,
"database": PostgresDatabase,

View File

@@ -42,7 +42,7 @@ func getRedisVars(t *testing.T) map[string]any {
t.Fatal("'REDIS_PASS' not set")
}
return map[string]any{
"kind": RedisSourceType,
"type": RedisSourceType,
"address": []string{RedisAddress},
"password": RedisPass,
}

View File

@@ -64,7 +64,7 @@ func getServerlessSparkVars(t *testing.T) map[string]any {
}
return map[string]any{
"kind": "serverless-spark",
"type": "serverless-spark",
"project": serverlessSparkProject,
"location": serverlessSparkLocation,
}
@@ -81,40 +81,40 @@ func TestServerlessSparkToolEndpoints(t *testing.T) {
},
"authServices": map[string]any{
"my-google-auth": map[string]any{
"kind": "google",
"type": "google",
"clientId": tests.ClientId,
},
},
"tools": map[string]any{
"list-batches": map[string]any{
"kind": "serverless-spark-list-batches",
"type": "serverless-spark-list-batches",
"source": "my-spark",
},
"list-batches-with-auth": map[string]any{
"kind": "serverless-spark-list-batches",
"type": "serverless-spark-list-batches",
"source": "my-spark",
"authRequired": []string{"my-google-auth"},
},
"get-batch": map[string]any{
"kind": "serverless-spark-get-batch",
"type": "serverless-spark-get-batch",
"source": "my-spark",
},
"get-batch-with-auth": map[string]any{
"kind": "serverless-spark-get-batch",
"type": "serverless-spark-get-batch",
"source": "my-spark",
"authRequired": []string{"my-google-auth"},
},
"cancel-batch": map[string]any{
"kind": "serverless-spark-cancel-batch",
"type": "serverless-spark-cancel-batch",
"source": "my-spark",
},
"cancel-batch-with-auth": map[string]any{
"kind": "serverless-spark-cancel-batch",
"type": "serverless-spark-cancel-batch",
"source": "my-spark",
"authRequired": []string{"my-google-auth"},
},
"create-pyspark-batch": map[string]any{
"kind": "serverless-spark-create-pyspark-batch",
"type": "serverless-spark-create-pyspark-batch",
"source": "my-spark",
"environmentConfig": map[string]any{
"executionConfig": map[string]any{
@@ -123,7 +123,7 @@ func TestServerlessSparkToolEndpoints(t *testing.T) {
},
},
"create-pyspark-batch-2-3": map[string]any{
"kind": "serverless-spark-create-pyspark-batch",
"type": "serverless-spark-create-pyspark-batch",
"source": "my-spark",
"runtimeConfig": map[string]any{"version": "2.3"},
"environmentConfig": map[string]any{
@@ -133,12 +133,12 @@ func TestServerlessSparkToolEndpoints(t *testing.T) {
},
},
"create-pyspark-batch-with-auth": map[string]any{
"kind": "serverless-spark-create-pyspark-batch",
"type": "serverless-spark-create-pyspark-batch",
"source": "my-spark",
"authRequired": []string{"my-google-auth"},
},
"create-spark-batch": map[string]any{
"kind": "serverless-spark-create-spark-batch",
"type": "serverless-spark-create-spark-batch",
"source": "my-spark",
"environmentConfig": map[string]any{
"executionConfig": map[string]any{
@@ -147,7 +147,7 @@ func TestServerlessSparkToolEndpoints(t *testing.T) {
},
},
"create-spark-batch-2-3": map[string]any{
"kind": "serverless-spark-create-spark-batch",
"type": "serverless-spark-create-spark-batch",
"source": "my-spark",
"runtimeConfig": map[string]any{"version": "2.3"},
"environmentConfig": map[string]any{
@@ -157,7 +157,7 @@ func TestServerlessSparkToolEndpoints(t *testing.T) {
},
},
"create-spark-batch-with-auth": map[string]any{
"kind": "serverless-spark-create-spark-batch",
"type": "serverless-spark-create-spark-batch",
"source": "my-spark",
"authRequired": []string{"my-google-auth"},
},

View File

@@ -54,7 +54,7 @@ func getSingleStoreVars(t *testing.T) map[string]any {
}
return map[string]any{
"kind": SingleStoreSourceType,
"type": SingleStoreSourceType,
"host": SingleStoreHost,
"port": SingleStorePort,
"database": SingleStoreDatabase,
@@ -85,7 +85,7 @@ func getSingleStoreAuthToolInfo(tableName string) (string, string, string, []any
return createStatement, insertStatement, toolStatement, params
}
// getSingleStoreTmplToolStatement returns statements and param for template parameter test cases for singlestore-sql kind
// getSingleStoreTmplToolStatement returns statements and param for template parameter test cases for singlestore-sql type
func getSingleStoreTmplToolStatement() (string, string) {
tmplSelectCombined := "SELECT * FROM {{.tableName}} WHERE id = ?"
tmplSelectFilterCombined := "SELECT * FROM {{.tableName}} WHERE {{.columnFilter}} = ?"
@@ -151,12 +151,12 @@ func addSingleStoreExecuteSQLConfig(t *testing.T, config map[string]any) map[str
t.Fatalf("unable to get tools from config")
}
tools["my-exec-sql-tool"] = map[string]any{
"kind": "singlestore-execute-sql",
"type": "singlestore-execute-sql",
"source": "my-instance",
"description": "Tool to execute sql",
}
tools["my-auth-exec-sql-tool"] = map[string]any{
"kind": "singlestore-execute-sql",
"type": "singlestore-execute-sql",
"source": "my-instance",
"description": "Tool to execute sql",
"authRequired": []string{

View File

@@ -65,7 +65,7 @@ func getSnowflakeVars(t *testing.T) map[string]any {
}
return map[string]any{
"kind": SnowflakeSourceType,
"type": SnowflakeSourceType,
"account": SnowflakeAccount,
"user": SnowflakeUser,
"password": SnowflakePassword,
@@ -173,13 +173,13 @@ func addSnowflakeExecuteSqlConfig(t *testing.T, config map[string]any) map[strin
}
tools["my-exec-sql-tool"] = map[string]any{
"kind": "snowflake-execute-sql",
"type": "snowflake-execute-sql",
"source": "my-instance",
"description": "Tool to execute sql",
}
tools["my-auth-exec-sql-tool"] = map[string]any{
"kind": "snowflake-execute-sql",
"type": "snowflake-execute-sql",
"source": "my-instance",
"description": "Tool to execute sql",
"authRequired": []string{
@@ -190,7 +190,7 @@ func addSnowflakeExecuteSqlConfig(t *testing.T, config map[string]any) map[strin
return config
}
// getSnowflakeParamToolInfo returns statements and param for my-param-tool snowflake-sql kind
// getSnowflakeParamToolInfo returns statements and param for my-param-tool snowflake-sql type
func getSnowflakeParamToolInfo(tableName string) (string, string, string, string, string, string, []any) {
createStatement := fmt.Sprintf("CREATE TABLE %s (id INTEGER AUTOINCREMENT PRIMARY KEY, name STRING);", tableName)
insertStatement := fmt.Sprintf("INSERT INTO %s (name) VALUES (?), (?), (?), (?);", tableName)
@@ -202,7 +202,7 @@ func getSnowflakeParamToolInfo(tableName string) (string, string, string, string
return createStatement, insertStatement, toolStatement, idParamStatement, nameParamStatement, arrayToolStatement, params
}
// getSnowflakeAuthToolInfo returns statements and param of my-auth-tool for snowflake-sql kind
// getSnowflakeAuthToolInfo returns statements and param of my-auth-tool for snowflake-sql type
func getSnowflakeAuthToolInfo(tableName string) (string, string, string, []any) {
createStatement := fmt.Sprintf("CREATE TABLE %s (id INTEGER AUTOINCREMENT PRIMARY KEY, name STRING, email STRING);", tableName)
insertStatement := fmt.Sprintf("INSERT INTO %s (name, email) VALUES (?, ?), (?, ?)", tableName)
@@ -211,7 +211,7 @@ func getSnowflakeAuthToolInfo(tableName string) (string, string, string, []any)
return createStatement, insertStatement, toolStatement, params
}
// getSnowflakeTmplToolStatement returns statements and param for template parameter test cases for snowflake-sql kind
// getSnowflakeTmplToolStatement returns statements and param for template parameter test cases for snowflake-sql type
func getSnowflakeTmplToolStatement() (string, string) {
tmplSelectCombined := "SELECT * FROM {{.tableName}} WHERE id = ?"
tmplSelectFilterCombined := "SELECT * FROM {{.tableName}} WHERE {{.columnFilter}} = ?"

View File

@@ -43,7 +43,7 @@ func RunSourceConnectionTest(t *testing.T, sourceConfig map[string]any, toolType
},
"tools": map[string]any{
"my-simple-tool": map[string]any{
"kind": toolType,
"type": toolType,
"source": "my-instance",
"description": "Simple tool to test end to end functionality.",
"statement": "SELECT 1;",

View File

@@ -55,7 +55,7 @@ func getSpannerVars(t *testing.T) map[string]any {
}
return map[string]any{
"kind": SpannerSourceType,
"type": SpannerSourceType,
"project": SpannerProject,
"instance": SpannerInstance,
"database": SpannerDatabase,
@@ -215,7 +215,7 @@ func TestSpannerToolEndpoints(t *testing.T) {
runSpannerListGraphsTest(t, graphName)
}
// getSpannerToolInfo returns statements and param for my-tool for spanner-sql kind
// getSpannerToolInfo returns statements and param for my-tool for spanner-sql type
func getSpannerParamToolInfo(tableName string) (string, string, string, string, string, string, map[string]any) {
createStatement := fmt.Sprintf("CREATE TABLE %s (id INT64, name STRING(MAX)) PRIMARY KEY (id)", tableName)
insertStatement := fmt.Sprintf("INSERT INTO %s (id, name) VALUES (1, @name1), (2, @name2), (3, @name3), (4, @name4)", tableName)
@@ -227,7 +227,7 @@ func getSpannerParamToolInfo(tableName string) (string, string, string, string,
return createStatement, insertStatement, toolStatement, idToolStatement, nameToolStatement, arrayToolStatement, params
}
// getSpannerAuthToolInfo returns statements and param of my-auth-tool for spanner-sql kind
// getSpannerAuthToolInfo returns statements and param of my-auth-tool for spanner-sql type
func getSpannerAuthToolInfo(tableName string) (string, string, string, map[string]any) {
createStatement := fmt.Sprintf("CREATE TABLE %s (id INT64, name STRING(MAX), email STRING(MAX)) PRIMARY KEY (id)", tableName)
insertStatement := fmt.Sprintf("INSERT INTO %s (id, name, email) VALUES (1, @name1, @email1), (2, @name2, @email2)", tableName)
@@ -331,18 +331,18 @@ func addSpannerExecuteSqlConfig(t *testing.T, config map[string]any) map[string]
t.Fatalf("unable to get tools from config")
}
tools["my-exec-sql-tool-read-only"] = map[string]any{
"kind": "spanner-execute-sql",
"type": "spanner-execute-sql",
"source": "my-instance",
"description": "Tool to execute sql",
"readOnly": true,
}
tools["my-exec-sql-tool"] = map[string]any{
"kind": "spanner-execute-sql",
"type": "spanner-execute-sql",
"source": "my-instance",
"description": "Tool to execute sql",
}
tools["my-auth-exec-sql-tool"] = map[string]any{
"kind": "spanner-execute-sql",
"type": "spanner-execute-sql",
"source": "my-instance",
"description": "Tool to execute sql",
"authRequired": []string{
@@ -359,14 +359,14 @@ func addSpannerReadOnlyConfig(t *testing.T, config map[string]any) map[string]an
t.Fatalf("unable to get tools from config")
}
tools["access-schema-read-only"] = map[string]any{
"kind": "spanner-sql",
"type": "spanner-sql",
"source": "my-instance",
"description": "Tool to access information schema in read-only mode.",
"statement": "SELECT schema_name FROM `INFORMATION_SCHEMA`.SCHEMATA WHERE schema_name='INFORMATION_SCHEMA';",
"readOnly": true,
}
tools["access-schema"] = map[string]any{
"kind": "spanner-sql",
"type": "spanner-sql",
"source": "my-instance",
"description": "Tool to access information schema.",
"statement": "SELECT schema_name FROM `INFORMATION_SCHEMA`.SCHEMATA WHERE schema_name='INFORMATION_SCHEMA';",
@@ -384,7 +384,7 @@ func addSpannerListTablesConfig(t *testing.T, config map[string]any) map[string]
// Add spanner-list-tables tool
tools["list-tables-tool"] = map[string]any{
"kind": "spanner-list-tables",
"type": "spanner-list-tables",
"source": "my-instance",
"description": "Lists tables with their schema information",
}
@@ -402,7 +402,7 @@ func addSpannerListGraphsConfig(t *testing.T, config map[string]any) map[string]
// Add spanner-list-graphs tool
tools["list-graphs-tool"] = map[string]any{
"kind": "spanner-list-graphs",
"type": "spanner-list-graphs",
"source": "my-instance",
"description": "Lists graphs with their schema information",
}
@@ -417,7 +417,7 @@ func addTemplateParamConfig(t *testing.T, config map[string]any) map[string]any
t.Fatalf("unable to get tools from config")
}
toolsMap["insert-table-templateParams-tool"] = map[string]any{
"kind": "spanner-sql",
"type": "spanner-sql",
"source": "my-instance",
"description": "Insert tool with template parameters",
"statement": "INSERT INTO {{.tableName}} ({{array .columns}}) VALUES ({{.values}})",
@@ -428,7 +428,7 @@ func addTemplateParamConfig(t *testing.T, config map[string]any) map[string]any
},
}
toolsMap["select-templateParams-tool"] = map[string]any{
"kind": "spanner-sql",
"type": "spanner-sql",
"source": "my-instance",
"description": "Create table tool with template parameters",
"statement": "SELECT * FROM {{.tableName}}",
@@ -437,7 +437,7 @@ func addTemplateParamConfig(t *testing.T, config map[string]any) map[string]any
},
}
toolsMap["select-templateParams-combined-tool"] = map[string]any{
"kind": "spanner-sql",
"type": "spanner-sql",
"source": "my-instance",
"description": "Create table tool with template parameters",
"statement": "SELECT * FROM {{.tableName}} WHERE id = @id",
@@ -447,7 +447,7 @@ func addTemplateParamConfig(t *testing.T, config map[string]any) map[string]any
},
}
toolsMap["select-fields-templateParams-tool"] = map[string]any{
"kind": "spanner-sql",
"type": "spanner-sql",
"source": "my-instance",
"description": "Create table tool with template parameters",
"statement": "SELECT {{array .fields}} FROM {{.tableName}}",
@@ -457,7 +457,7 @@ func addTemplateParamConfig(t *testing.T, config map[string]any) map[string]any
},
}
toolsMap["select-filter-templateParams-combined-tool"] = map[string]any{
"kind": "spanner-sql",
"type": "spanner-sql",
"source": "my-instance",
"description": "Create table tool with template parameters",
"statement": "SELECT * FROM {{.tableName}} WHERE {{.columnFilter}} = @name",

View File

@@ -39,7 +39,7 @@ var (
func getSQLiteVars(t *testing.T) map[string]any {
return map[string]any{
"kind": SQLiteSourceType,
"type": SQLiteSourceType,
"database": SQLiteDatabase,
}
}
@@ -191,7 +191,7 @@ func TestSQLiteExecuteSqlTool(t *testing.T) {
toolConfig := map[string]any{
"tools": map[string]any{
"my-exec-sql-tool": map[string]any{
"kind": "sqlite-execute-sql",
"type": "sqlite-execute-sql",
"source": "my-instance",
"description": "Tool to execute SQL statements",
},

View File

@@ -54,7 +54,7 @@ func getTiDBVars(t *testing.T) map[string]any {
}
return map[string]any{
"kind": TiDBSourceType,
"type": TiDBSourceType,
"host": TiDBHost,
"port": TiDBPort,
"database": TiDBDatabase,
@@ -91,12 +91,12 @@ func addTiDBExecuteSqlConfig(t *testing.T, config map[string]any) map[string]any
t.Fatalf("unable to get tools from config")
}
tools["my-exec-sql-tool"] = map[string]any{
"kind": "tidb-execute-sql",
"type": "tidb-execute-sql",
"source": "my-instance",
"description": "Tool to execute sql",
}
tools["my-auth-exec-sql-tool"] = map[string]any{
"kind": "tidb-execute-sql",
"type": "tidb-execute-sql",
"source": "my-instance",
"description": "Tool to execute sql",
"authRequired": []string{

View File

@@ -55,7 +55,7 @@ func getTrinoVars(t *testing.T) map[string]any {
}
return map[string]any{
"kind": TrinoSourceType,
"type": TrinoSourceType,
"host": TrinoHost,
"port": TrinoPort,
"user": TrinoUser,
@@ -119,7 +119,7 @@ func buildTrinoDSN(host, port, user, password, catalog, schema, queryTimeout, ac
return dsn, nil
}
// getTrinoParamToolInfo returns statements and param for my-tool trino-sql kind
// getTrinoParamToolInfo returns statements and param for my-tool trino-sql type
func getTrinoParamToolInfo(tableName string) (string, string, string, string, string, string, []any) {
createStatement := fmt.Sprintf("CREATE TABLE %s (id BIGINT NOT NULL, name VARCHAR(255))", tableName)
insertStatement := fmt.Sprintf("INSERT INTO %s (id, name) VALUES (1, ?), (2, ?), (3, ?), (4, ?)", tableName)
@@ -131,7 +131,7 @@ func getTrinoParamToolInfo(tableName string) (string, string, string, string, st
return createStatement, insertStatement, toolStatement, idParamStatement, nameParamStatement, arrayToolStatement, params
}
// getTrinoAuthToolInfo returns statements and param of my-auth-tool for trino-sql kind
// getTrinoAuthToolInfo returns statements and param of my-auth-tool for trino-sql type
func getTrinoAuthToolInfo(tableName string) (string, string, string, []any) {
createStatement := fmt.Sprintf("CREATE TABLE %s (id BIGINT NOT NULL, name VARCHAR(255), email VARCHAR(255))", tableName)
insertStatement := fmt.Sprintf("INSERT INTO %s (id, name, email) VALUES (1, ?, ?), (2, ?, ?)", tableName)
@@ -140,7 +140,7 @@ func getTrinoAuthToolInfo(tableName string) (string, string, string, []any) {
return createStatement, insertStatement, toolStatement, params
}
// getTrinoTmplToolStatement returns statements and param for template parameter test cases for trino-sql kind
// getTrinoTmplToolStatement returns statements and param for template parameter test cases for trino-sql type
func getTrinoTmplToolStatement() (string, string) {
tmplSelectCombined := "SELECT * FROM {{.tableName}} WHERE id = ?"
tmplSelectFilterCombined := "SELECT * FROM {{.tableName}} WHERE {{.columnFilter}} = ?"
@@ -192,12 +192,12 @@ func addTrinoExecuteSqlConfig(t *testing.T, config map[string]any) map[string]an
t.Fatalf("unable to get tools from config")
}
tools["my-exec-sql-tool"] = map[string]any{
"kind": "trino-execute-sql",
"type": "trino-execute-sql",
"source": "my-instance",
"description": "Tool to execute sql",
}
tools["my-auth-exec-sql-tool"] = map[string]any{
"kind": "trino-execute-sql",
"type": "trino-execute-sql",
"source": "my-instance",
"description": "Tool to execute sql",
"authRequired": []string{

View File

@@ -37,7 +37,7 @@ func RunWaitTool(t *testing.T) {
toolsFile := map[string]any{
"tools": map[string]any{
"my-wait-for-tool": map[string]any{
"kind": "wait",
"type": "wait",
"description": "Wait for a specified duration.",
"timeout": "30s",
},

View File

@@ -39,7 +39,7 @@ func getValkeyVars(t *testing.T) map[string]any {
t.Fatal("'VALKEY_ADDRESS' not set")
}
return map[string]any{
"kind": ValkeySourceType,
"type": ValkeySourceType,
"address": []string{ValkeyAddress},
"disableCache": true,
}

View File

@@ -58,7 +58,7 @@ func getYBVars(t *testing.T) map[string]any {
}
return map[string]any{
"kind": YBDB_SOURCE_KIND,
"type": YBDB_SOURCE_KIND,
"host": YBDB_HOST,
"port": YBDB_PORT,
"database": YBDB_DATABASE,