mirror of
https://github.com/googleapis/genai-toolbox.git
synced 2026-01-23 06:18:02 -05:00
Compare commits
1 Commits
config-yam
...
config-yam
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d19bbd1365 |
@@ -74,71 +74,71 @@ func getAlloyDBToolsConfig() map[string]any {
|
||||
return map[string]any{
|
||||
"sources": map[string]any{
|
||||
"alloydb-admin-source": map[string]any{
|
||||
"type": "alloydb-admin",
|
||||
"kind": "alloydb-admin",
|
||||
},
|
||||
},
|
||||
"tools": map[string]any{
|
||||
// Tool for RunAlloyDBToolGetTest
|
||||
"my-simple-tool": map[string]any{
|
||||
"type": "alloydb-list-clusters",
|
||||
"kind": "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{
|
||||
"type": "alloydb-list-clusters",
|
||||
"kind": "alloydb-list-clusters",
|
||||
"source": "alloydb-admin-source",
|
||||
"description": "Tool to list clusters",
|
||||
},
|
||||
// Tool for MCP test that fails
|
||||
"my-fail-tool": map[string]any{
|
||||
"type": "alloydb-list-clusters",
|
||||
"kind": "alloydb-list-clusters",
|
||||
"source": "alloydb-admin-source",
|
||||
"description": "Tool that will fail",
|
||||
},
|
||||
// AlloyDB specific tools
|
||||
"alloydb-list-clusters": map[string]any{
|
||||
"type": "alloydb-list-clusters",
|
||||
"kind": "alloydb-list-clusters",
|
||||
"source": "alloydb-admin-source",
|
||||
"description": "Lists all AlloyDB clusters in a given project and location.",
|
||||
},
|
||||
"alloydb-list-users": map[string]any{
|
||||
"type": "alloydb-list-users",
|
||||
"kind": "alloydb-list-users",
|
||||
"source": "alloydb-admin-source",
|
||||
"description": "Lists all AlloyDB users within a specific cluster.",
|
||||
},
|
||||
"alloydb-list-instances": map[string]any{
|
||||
"type": "alloydb-list-instances",
|
||||
"kind": "alloydb-list-instances",
|
||||
"source": "alloydb-admin-source",
|
||||
"description": "Lists all AlloyDB instances within a specific cluster.",
|
||||
},
|
||||
"alloydb-get-cluster": map[string]any{
|
||||
"type": "alloydb-get-cluster",
|
||||
"kind": "alloydb-get-cluster",
|
||||
"source": "alloydb-admin-source",
|
||||
"description": "Retrieves details of a specific AlloyDB cluster.",
|
||||
},
|
||||
"alloydb-get-instance": map[string]any{
|
||||
"type": "alloydb-get-instance",
|
||||
"kind": "alloydb-get-instance",
|
||||
"source": "alloydb-admin-source",
|
||||
"description": "Retrieves details of a specific AlloyDB instance.",
|
||||
},
|
||||
"alloydb-get-user": map[string]any{
|
||||
"type": "alloydb-get-user",
|
||||
"kind": "alloydb-get-user",
|
||||
"source": "alloydb-admin-source",
|
||||
"description": "Retrieves details of a specific AlloyDB user.",
|
||||
},
|
||||
"alloydb-create-cluster": map[string]any{
|
||||
"type": "alloydb-create-cluster",
|
||||
"kind": "alloydb-create-cluster",
|
||||
"description": "create cluster",
|
||||
"source": "alloydb-admin-source",
|
||||
},
|
||||
"alloydb-create-instance": map[string]any{
|
||||
"type": "alloydb-create-instance",
|
||||
"kind": "alloydb-create-instance",
|
||||
"description": "create instance",
|
||||
"source": "alloydb-admin-source",
|
||||
},
|
||||
"alloydb-create-user": map[string]any{
|
||||
"type": "alloydb-create-user",
|
||||
"kind": "alloydb-create-user",
|
||||
"description": "create user",
|
||||
"source": "alloydb-admin-source",
|
||||
},
|
||||
|
||||
@@ -240,17 +240,17 @@ func getWaitToolsConfig() map[string]any {
|
||||
return map[string]any{
|
||||
"sources": map[string]any{
|
||||
"my-alloydb-source": map[string]any{
|
||||
"type": "alloydb-admin",
|
||||
"kind": "alloydb-admin",
|
||||
},
|
||||
},
|
||||
"tools": map[string]any{
|
||||
"wait-for-op1": map[string]any{
|
||||
"type": waitToolType,
|
||||
"kind": waitToolType,
|
||||
"source": "my-alloydb-source",
|
||||
"description": "wait for op1",
|
||||
},
|
||||
"wait-for-op2": map[string]any{
|
||||
"type": waitToolType,
|
||||
"kind": waitToolType,
|
||||
"source": "my-alloydb-source",
|
||||
"description": "wait for op2",
|
||||
},
|
||||
|
||||
@@ -62,7 +62,7 @@ func getAlloyDBAINLVars(t *testing.T) map[string]any {
|
||||
t.Fatal("'ALLOYDB_AI_NL_PASS' not set")
|
||||
}
|
||||
return map[string]any{
|
||||
"type": AlloyDBAINLSourceType,
|
||||
"kind": 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{
|
||||
"type": "google",
|
||||
"kind": "google",
|
||||
"clientId": tests.ClientId,
|
||||
},
|
||||
},
|
||||
"tools": map[string]any{
|
||||
"my-simple-tool": map[string]any{
|
||||
"type": AlloyDBAINLToolType,
|
||||
"kind": AlloyDBAINLToolType,
|
||||
"source": "my-instance",
|
||||
"description": "Simple tool to test end to end functionality.",
|
||||
"nlConfig": "my_nl_config",
|
||||
},
|
||||
"my-auth-tool": map[string]any{
|
||||
"type": AlloyDBAINLToolType,
|
||||
"kind": 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{
|
||||
"type": AlloyDBAINLToolType,
|
||||
"kind": AlloyDBAINLToolType,
|
||||
"source": "my-instance",
|
||||
"description": "Tool to test auth required invocation.",
|
||||
"nlConfig": "my_nl_config",
|
||||
|
||||
@@ -61,7 +61,7 @@ func getAlloyDBPgVars(t *testing.T) map[string]any {
|
||||
t.Fatal("'ALLOYDB_POSTGRES_PASS' not set")
|
||||
}
|
||||
return map[string]any{
|
||||
"type": AlloyDBPostgresSourceType,
|
||||
"kind": 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{
|
||||
"type": AlloyDBPostgresSourceType,
|
||||
"kind": AlloyDBPostgresSourceType,
|
||||
"project": AlloyDBPostgresProject,
|
||||
"cluster": AlloyDBPostgresCluster,
|
||||
"instance": AlloyDBPostgresInstance,
|
||||
@@ -249,7 +249,7 @@ func TestAlloyDBPgIAMConnection(t *testing.T) {
|
||||
}
|
||||
|
||||
noUserSourceConfig := map[string]any{
|
||||
"type": AlloyDBPostgresSourceType,
|
||||
"kind": AlloyDBPostgresSourceType,
|
||||
"project": AlloyDBPostgresProject,
|
||||
"cluster": AlloyDBPostgresCluster,
|
||||
"instance": AlloyDBPostgresInstance,
|
||||
@@ -259,7 +259,7 @@ func TestAlloyDBPgIAMConnection(t *testing.T) {
|
||||
}
|
||||
|
||||
noUserNoPassSourceConfig := map[string]any{
|
||||
"type": AlloyDBPostgresSourceType,
|
||||
"kind": AlloyDBPostgresSourceType,
|
||||
"project": AlloyDBPostgresProject,
|
||||
"cluster": AlloyDBPostgresCluster,
|
||||
"instance": AlloyDBPostgresInstance,
|
||||
|
||||
@@ -53,7 +53,7 @@ func getBigQueryVars(t *testing.T) map[string]any {
|
||||
}
|
||||
|
||||
return map[string]any{
|
||||
"type": BigquerySourceType,
|
||||
"kind": 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{
|
||||
"type": "bigquery-list-dataset-ids",
|
||||
"kind": "bigquery-list-dataset-ids",
|
||||
"source": "my-instance",
|
||||
"description": "Tool to list dataset ids",
|
||||
},
|
||||
"list-table-ids-restricted": map[string]any{
|
||||
"type": "bigquery-list-table-ids",
|
||||
"kind": "bigquery-list-table-ids",
|
||||
"source": "my-instance",
|
||||
"description": "Tool to list table within a dataset",
|
||||
},
|
||||
"get-dataset-info-restricted": map[string]any{
|
||||
"type": "bigquery-get-dataset-info",
|
||||
"kind": "bigquery-get-dataset-info",
|
||||
"source": "my-instance",
|
||||
"description": "Tool to get dataset info",
|
||||
},
|
||||
"get-table-info-restricted": map[string]any{
|
||||
"type": "bigquery-get-table-info",
|
||||
"kind": "bigquery-get-table-info",
|
||||
"source": "my-instance",
|
||||
"description": "Tool to get table info",
|
||||
},
|
||||
"execute-sql-restricted": map[string]any{
|
||||
"type": "bigquery-execute-sql",
|
||||
"kind": "bigquery-execute-sql",
|
||||
"source": "my-instance",
|
||||
"description": "Tool to execute SQL",
|
||||
},
|
||||
"conversational-analytics-restricted": map[string]any{
|
||||
"type": "bigquery-conversational-analytics",
|
||||
"kind": "bigquery-conversational-analytics",
|
||||
"source": "my-instance",
|
||||
"description": "Tool to ask BigQuery conversational analytics",
|
||||
},
|
||||
"forecast-restricted": map[string]any{
|
||||
"type": "bigquery-forecast",
|
||||
"kind": "bigquery-forecast",
|
||||
"source": "my-instance",
|
||||
"description": "Tool to forecast",
|
||||
},
|
||||
"analyze-contribution-restricted": map[string]any{
|
||||
"type": "bigquery-analyze-contribution",
|
||||
"kind": "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{
|
||||
"type": "bigquery-execute-sql",
|
||||
"kind": "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{"type": "bigquery-execute-sql", "source": "my-instance", "description": "Tool to execute sql"},
|
||||
"my-exec-sql-tool": map[string]any{"kind": "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{"type": "bigquery-execute-sql", "source": "my-instance", "description": "Tool to execute sql"},
|
||||
"my-exec-sql-tool": map[string]any{"kind": "bigquery-execute-sql", "source": "my-instance", "description": "Tool to execute sql"},
|
||||
"my-sql-tool-protected": map[string]any{
|
||||
"type": "bigquery-sql",
|
||||
"kind": "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{
|
||||
"type": "bigquery-forecast",
|
||||
"kind": "bigquery-forecast",
|
||||
"source": "my-instance",
|
||||
"description": "Tool to forecast from session temp table",
|
||||
},
|
||||
"my-analyze-contribution-tool-protected": map[string]any{
|
||||
"type": "bigquery-analyze-contribution",
|
||||
"kind": "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 type
|
||||
// getBigQueryParamToolInfo returns statements and param for my-tool for bigquery kind
|
||||
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 type
|
||||
// getBigQueryAuthToolInfo returns statements and param of my-auth-tool for bigquery kind
|
||||
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 type
|
||||
// getBigQueryTmplToolStatement returns statements for template parameter test cases for bigquery kind
|
||||
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{
|
||||
"type": "bigquery-execute-sql",
|
||||
"kind": "bigquery-execute-sql",
|
||||
"source": "my-instance",
|
||||
"description": "Tool to execute sql",
|
||||
}
|
||||
tools["my-auth-exec-sql-tool"] = map[string]any{
|
||||
"type": "bigquery-execute-sql",
|
||||
"kind": "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{
|
||||
"type": "bigquery-execute-sql",
|
||||
"kind": "bigquery-execute-sql",
|
||||
"source": "my-client-auth-source",
|
||||
"description": "Tool to execute sql",
|
||||
}
|
||||
tools["my-forecast-tool"] = map[string]any{
|
||||
"type": "bigquery-forecast",
|
||||
"kind": "bigquery-forecast",
|
||||
"source": "my-instance",
|
||||
"description": "Tool to forecast time series data.",
|
||||
}
|
||||
tools["my-auth-forecast-tool"] = map[string]any{
|
||||
"type": "bigquery-forecast",
|
||||
"kind": "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{
|
||||
"type": "bigquery-forecast",
|
||||
"kind": "bigquery-forecast",
|
||||
"source": "my-client-auth-source",
|
||||
"description": "Tool to forecast time series data with auth.",
|
||||
}
|
||||
tools["my-analyze-contribution-tool"] = map[string]any{
|
||||
"type": "bigquery-analyze-contribution",
|
||||
"kind": "bigquery-analyze-contribution",
|
||||
"source": "my-instance",
|
||||
"description": "Tool to analyze contribution.",
|
||||
}
|
||||
tools["my-auth-analyze-contribution-tool"] = map[string]any{
|
||||
"type": "bigquery-analyze-contribution",
|
||||
"kind": "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{
|
||||
"type": "bigquery-analyze-contribution",
|
||||
"kind": "bigquery-analyze-contribution",
|
||||
"source": "my-client-auth-source",
|
||||
"description": "Tool to analyze contribution with auth.",
|
||||
}
|
||||
tools["my-list-dataset-ids-tool"] = map[string]any{
|
||||
"type": "bigquery-list-dataset-ids",
|
||||
"kind": "bigquery-list-dataset-ids",
|
||||
"source": "my-instance",
|
||||
"description": "Tool to list dataset",
|
||||
}
|
||||
tools["my-auth-list-dataset-ids-tool"] = map[string]any{
|
||||
"type": "bigquery-list-dataset-ids",
|
||||
"kind": "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{
|
||||
"type": "bigquery-list-dataset-ids",
|
||||
"kind": "bigquery-list-dataset-ids",
|
||||
"source": "my-client-auth-source",
|
||||
"description": "Tool to list dataset",
|
||||
}
|
||||
tools["my-get-dataset-info-tool"] = map[string]any{
|
||||
"type": "bigquery-get-dataset-info",
|
||||
"kind": "bigquery-get-dataset-info",
|
||||
"source": "my-instance",
|
||||
"description": "Tool to show dataset metadata",
|
||||
}
|
||||
tools["my-auth-get-dataset-info-tool"] = map[string]any{
|
||||
"type": "bigquery-get-dataset-info",
|
||||
"kind": "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{
|
||||
"type": "bigquery-get-dataset-info",
|
||||
"kind": "bigquery-get-dataset-info",
|
||||
"source": "my-client-auth-source",
|
||||
"description": "Tool to show dataset metadata",
|
||||
}
|
||||
tools["my-list-table-ids-tool"] = map[string]any{
|
||||
"type": "bigquery-list-table-ids",
|
||||
"kind": "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{
|
||||
"type": "bigquery-list-table-ids",
|
||||
"kind": "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{
|
||||
"type": "bigquery-list-table-ids",
|
||||
"kind": "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{
|
||||
"type": "bigquery-get-table-info",
|
||||
"kind": "bigquery-get-table-info",
|
||||
"source": "my-instance",
|
||||
"description": "Tool to show dataset metadata",
|
||||
}
|
||||
tools["my-auth-get-table-info-tool"] = map[string]any{
|
||||
"type": "bigquery-get-table-info",
|
||||
"kind": "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{
|
||||
"type": "bigquery-get-table-info",
|
||||
"kind": "bigquery-get-table-info",
|
||||
"source": "my-client-auth-source",
|
||||
"description": "Tool to show dataset metadata",
|
||||
}
|
||||
tools["my-conversational-analytics-tool"] = map[string]any{
|
||||
"type": "bigquery-conversational-analytics",
|
||||
"kind": "bigquery-conversational-analytics",
|
||||
"source": "my-instance",
|
||||
"description": "Tool to ask BigQuery conversational analytics",
|
||||
}
|
||||
tools["my-auth-conversational-analytics-tool"] = map[string]any{
|
||||
"type": "bigquery-conversational-analytics",
|
||||
"kind": "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{
|
||||
"type": "bigquery-conversational-analytics",
|
||||
"kind": "bigquery-conversational-analytics",
|
||||
"source": "my-client-auth-source",
|
||||
"description": "Tool to ask BigQuery conversational analytics",
|
||||
}
|
||||
tools["my-search-catalog-tool"] = map[string]any{
|
||||
"type": "bigquery-search-catalog",
|
||||
"kind": "bigquery-search-catalog",
|
||||
"source": "my-instance",
|
||||
"description": "Tool to search the BiqQuery catalog",
|
||||
}
|
||||
tools["my-auth-search-catalog-tool"] = map[string]any{
|
||||
"type": "bigquery-search-catalog",
|
||||
"kind": "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{
|
||||
"type": "bigquery-search-catalog",
|
||||
"kind": "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{
|
||||
"type": BigquerySourceType,
|
||||
"kind": 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{
|
||||
"type": "bigquery-sql",
|
||||
"kind": "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{
|
||||
"type": "bigquery-sql",
|
||||
"kind": "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{
|
||||
"type": "bigquery-sql",
|
||||
"kind": "bigquery-sql",
|
||||
"source": "my-client-auth-source",
|
||||
"description": "Tool to test client authorization.",
|
||||
"statement": "SELECT 1",
|
||||
|
||||
@@ -50,7 +50,7 @@ func getBigtableVars(t *testing.T) map[string]any {
|
||||
}
|
||||
|
||||
return map[string]any{
|
||||
"type": BigtableSourceType,
|
||||
"kind": 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{
|
||||
"type": "bigtable-sql",
|
||||
"kind": "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{
|
||||
"type": "bigtable-sql",
|
||||
"kind": "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{
|
||||
"type": "bigtable-sql",
|
||||
"kind": "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{
|
||||
"type": "bigtable-sql",
|
||||
"kind": "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;",
|
||||
|
||||
@@ -49,7 +49,7 @@ func getCassandraVars(t *testing.T) map[string]any {
|
||||
t.Fatal("'Password' not set")
|
||||
}
|
||||
return map[string]any{
|
||||
"type": CassandraSourceType,
|
||||
"kind": CassandraSourceType,
|
||||
"hosts": strings.Split(Hosts, ","),
|
||||
"keyspace": Keyspace,
|
||||
"username": Username,
|
||||
|
||||
@@ -64,7 +64,7 @@ func getClickHouseVars(t *testing.T) map[string]any {
|
||||
}
|
||||
|
||||
return map[string]any{
|
||||
"type": ClickHouseSourceType,
|
||||
"kind": 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{
|
||||
"type": "clickhouse-execute-sql",
|
||||
"kind": "clickhouse-execute-sql",
|
||||
"source": "my-instance",
|
||||
"description": "Tool to execute sql",
|
||||
}
|
||||
tools["my-auth-exec-sql-tool"] = map[string]any{
|
||||
"type": "clickhouse-execute-sql",
|
||||
"kind": "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{
|
||||
"type": toolType,
|
||||
"kind": 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{
|
||||
"type": toolType,
|
||||
"kind": 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{
|
||||
"type": toolType,
|
||||
"kind": 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{
|
||||
"type": toolType,
|
||||
"kind": 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{
|
||||
"type": toolType,
|
||||
"kind": 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{
|
||||
"type": toolType,
|
||||
"kind": 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{
|
||||
"type": toolType,
|
||||
"kind": 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{
|
||||
"type": ClickHouseToolType,
|
||||
"kind": 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{
|
||||
"type": ClickHouseToolType,
|
||||
"kind": ClickHouseToolType,
|
||||
"source": "my-instance",
|
||||
"description": "Test select query",
|
||||
"statement": fmt.Sprintf("SELECT * FROM %s ORDER BY id", tableName),
|
||||
},
|
||||
"test-param-query": map[string]any{
|
||||
"type": ClickHouseToolType,
|
||||
"kind": 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{
|
||||
"type": ClickHouseToolType,
|
||||
"kind": 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{
|
||||
"type": ClickHouseToolType,
|
||||
"kind": 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{
|
||||
"type": "clickhouse-execute-sql",
|
||||
"kind": "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{
|
||||
"type": "clickhouse-execute-sql",
|
||||
"kind": "clickhouse-execute-sql",
|
||||
"source": "my-instance",
|
||||
"description": "Test create table",
|
||||
},
|
||||
"test-null-values": map[string]any{
|
||||
"type": "clickhouse-sql",
|
||||
"kind": "clickhouse-sql",
|
||||
"source": "my-instance",
|
||||
"description": "Test null values",
|
||||
"statement": fmt.Sprintf("SELECT * FROM %s ORDER BY id", tableName),
|
||||
},
|
||||
"test-concurrent": map[string]any{
|
||||
"type": "clickhouse-sql",
|
||||
"kind": "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 type
|
||||
// getClickHouseSQLParamToolInfo returns statements and param for my-tool clickhouse-sql kind
|
||||
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 type
|
||||
// getClickHouseSQLAuthToolInfo returns statements and param of my-auth-tool for clickhouse-sql kind
|
||||
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 type
|
||||
// getClickHouseSQLTmplToolStatement returns statements and param for template parameter test cases for clickhouse-sql kind
|
||||
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{
|
||||
"type": "clickhouse-list-databases",
|
||||
"kind": "clickhouse-list-databases",
|
||||
"source": "my-instance",
|
||||
"description": "Test listing databases",
|
||||
},
|
||||
"test-invalid-source": map[string]any{
|
||||
"type": "clickhouse-list-databases",
|
||||
"kind": "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{
|
||||
"type": "clickhouse-list-tables",
|
||||
"kind": "clickhouse-list-tables",
|
||||
"source": "my-instance",
|
||||
"description": "Test listing tables",
|
||||
},
|
||||
"test-invalid-source": map[string]any{
|
||||
"type": "clickhouse-list-tables",
|
||||
"kind": "clickhouse-list-tables",
|
||||
"source": "non-existent-source",
|
||||
"description": "Test with invalid source",
|
||||
},
|
||||
|
||||
@@ -205,13 +205,13 @@ func getCloudGdaToolsConfig() map[string]any {
|
||||
return map[string]any{
|
||||
"sources": map[string]any{
|
||||
"my-gda-source": map[string]any{
|
||||
"type": "cloud-gemini-data-analytics",
|
||||
"kind": "cloud-gemini-data-analytics",
|
||||
"projectId": "test-project",
|
||||
},
|
||||
},
|
||||
"tools": map[string]any{
|
||||
"cloud-gda-query": map[string]any{
|
||||
"type": cloudGdaToolType,
|
||||
"kind": cloudGdaToolType,
|
||||
"source": "my-gda-source",
|
||||
"description": "Test GDA Tool",
|
||||
"location": "us-central1",
|
||||
|
||||
@@ -92,7 +92,7 @@ func getHealthcareVars(t *testing.T) map[string]any {
|
||||
t.Fatal("'HEALTHCARE_PREPOPULATED_DICOM_STORE' not set")
|
||||
}
|
||||
return map[string]any{
|
||||
"type": healthcareSourceType,
|
||||
"kind": 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{
|
||||
"type": "cloud-healthcare-list-fhir-stores",
|
||||
"kind": "cloud-healthcare-list-fhir-stores",
|
||||
"source": "my-instance",
|
||||
"description": "Tool to list fhir stores",
|
||||
},
|
||||
"list-dicom-stores-restricted": map[string]any{
|
||||
"type": "cloud-healthcare-list-dicom-stores",
|
||||
"kind": "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{
|
||||
"type": getDatasetToolType,
|
||||
"kind": getDatasetToolType,
|
||||
"source": "my-instance",
|
||||
"description": "Tool to get a healthcare dataset",
|
||||
},
|
||||
"my-list-fhir-stores-tool": map[string]any{
|
||||
"type": listFHIRStoresToolType,
|
||||
"kind": listFHIRStoresToolType,
|
||||
"source": "my-instance",
|
||||
"description": "Tool to list FHIR stores",
|
||||
},
|
||||
"my-list-dicom-stores-tool": map[string]any{
|
||||
"type": listDICOMStoresToolType,
|
||||
"kind": listDICOMStoresToolType,
|
||||
"source": "my-instance",
|
||||
"description": "Tool to list DICOM stores",
|
||||
},
|
||||
"my-get-fhir-store-tool": map[string]any{
|
||||
"type": getFHIRStoreToolType,
|
||||
"kind": getFHIRStoreToolType,
|
||||
"source": "my-instance",
|
||||
"description": "Tool to get a FHIR store",
|
||||
},
|
||||
"my-get-fhir-store-metrics-tool": map[string]any{
|
||||
"type": getFHIRStoreMetricsToolType,
|
||||
"kind": getFHIRStoreMetricsToolType,
|
||||
"source": "my-instance",
|
||||
"description": "Tool to get FHIR store metrics",
|
||||
},
|
||||
"my-get-fhir-resource-tool": map[string]any{
|
||||
"type": getFHIRResourceToolType,
|
||||
"kind": getFHIRResourceToolType,
|
||||
"source": "my-instance",
|
||||
"description": "Tool to get FHIR resource",
|
||||
},
|
||||
"my-fhir-patient-search-tool": map[string]any{
|
||||
"type": fhirPatientSearchToolType,
|
||||
"kind": fhirPatientSearchToolType,
|
||||
"source": "my-instance",
|
||||
"description": "Tool to search for patients",
|
||||
},
|
||||
"my-fhir-patient-everything-tool": map[string]any{
|
||||
"type": fhirPatientEverythingToolType,
|
||||
"kind": fhirPatientEverythingToolType,
|
||||
"source": "my-instance",
|
||||
"description": "Tool for patient everything",
|
||||
},
|
||||
"my-fhir-fetch-page-tool": map[string]any{
|
||||
"type": fhirFetchPageToolType,
|
||||
"kind": fhirFetchPageToolType,
|
||||
"source": "my-instance",
|
||||
"description": "Tool to fetch a page of FHIR resources",
|
||||
},
|
||||
"my-get-dicom-store-tool": map[string]any{
|
||||
"type": getDICOMStoreToolType,
|
||||
"kind": getDICOMStoreToolType,
|
||||
"source": "my-instance",
|
||||
"description": "Tool to get a DICOM store",
|
||||
},
|
||||
"my-get-dicom-store-metrics-tool": map[string]any{
|
||||
"type": getDICOMStoreMetricsToolType,
|
||||
"kind": getDICOMStoreMetricsToolType,
|
||||
"source": "my-instance",
|
||||
"description": "Tool to get DICOM store metrics",
|
||||
},
|
||||
"my-search-dicom-studies-tool": map[string]any{
|
||||
"type": searchDICOMStudiesToolType,
|
||||
"kind": searchDICOMStudiesToolType,
|
||||
"source": "my-instance",
|
||||
"description": "Tool to search DICOM studies",
|
||||
},
|
||||
"my-search-dicom-series-tool": map[string]any{
|
||||
"type": searchDICOMSeriesToolType,
|
||||
"kind": searchDICOMSeriesToolType,
|
||||
"source": "my-instance",
|
||||
"description": "Tool to search DICOM series",
|
||||
},
|
||||
"my-search-dicom-instances-tool": map[string]any{
|
||||
"type": searchDICOMInstancesToolType,
|
||||
"kind": searchDICOMInstancesToolType,
|
||||
"source": "my-instance",
|
||||
"description": "Tool to search DICOM instances",
|
||||
},
|
||||
"my-retrieve-rendered-dicom-instance-tool": map[string]any{
|
||||
"type": retrieveRenderedDICOMInstanceToolType,
|
||||
"kind": retrieveRenderedDICOMInstanceToolType,
|
||||
"source": "my-instance",
|
||||
"description": "Tool to retrieve rendered DICOM instance",
|
||||
},
|
||||
"my-client-auth-get-dataset-tool": map[string]any{
|
||||
"type": getDatasetToolType,
|
||||
"kind": getDatasetToolType,
|
||||
"source": "my-client-auth-source",
|
||||
"description": "Tool to get a healthcare dataset",
|
||||
},
|
||||
"my-client-auth-list-fhir-stores-tool": map[string]any{
|
||||
"type": listFHIRStoresToolType,
|
||||
"kind": listFHIRStoresToolType,
|
||||
"source": "my-client-auth-source",
|
||||
"description": "Tool to list FHIR stores",
|
||||
},
|
||||
"my-client-auth-list-dicom-stores-tool": map[string]any{
|
||||
"type": listDICOMStoresToolType,
|
||||
"kind": listDICOMStoresToolType,
|
||||
"source": "my-client-auth-source",
|
||||
"description": "Tool to list DICOM stores",
|
||||
},
|
||||
"my-client-auth-get-fhir-store-tool": map[string]any{
|
||||
"type": getFHIRStoreToolType,
|
||||
"kind": getFHIRStoreToolType,
|
||||
"source": "my-client-auth-source",
|
||||
"description": "Tool to get a FHIR store",
|
||||
},
|
||||
"my-client-auth-get-fhir-store-metrics-tool": map[string]any{
|
||||
"type": getFHIRStoreMetricsToolType,
|
||||
"kind": getFHIRStoreMetricsToolType,
|
||||
"source": "my-client-auth-source",
|
||||
"description": "Tool to get FHIR store metrics",
|
||||
},
|
||||
"my-client-auth-get-fhir-resource-tool": map[string]any{
|
||||
"type": getFHIRResourceToolType,
|
||||
"kind": getFHIRResourceToolType,
|
||||
"source": "my-client-auth-source",
|
||||
"description": "Tool to get FHIR resource",
|
||||
},
|
||||
"my-client-auth-fhir-patient-search-tool": map[string]any{
|
||||
"type": fhirPatientSearchToolType,
|
||||
"kind": fhirPatientSearchToolType,
|
||||
"source": "my-client-auth-source",
|
||||
"description": "Tool to search for patients",
|
||||
},
|
||||
"my-client-auth-fhir-patient-everything-tool": map[string]any{
|
||||
"type": fhirPatientEverythingToolType,
|
||||
"kind": fhirPatientEverythingToolType,
|
||||
"source": "my-client-auth-source",
|
||||
"description": "Tool for patient everything",
|
||||
},
|
||||
"my-client-auth-fhir-fetch-page-tool": map[string]any{
|
||||
"type": fhirFetchPageToolType,
|
||||
"kind": 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{
|
||||
"type": getDICOMStoreToolType,
|
||||
"kind": getDICOMStoreToolType,
|
||||
"source": "my-client-auth-source",
|
||||
"description": "Tool to get a DICOM store",
|
||||
},
|
||||
"my-client-auth-get-dicom-store-metrics-tool": map[string]any{
|
||||
"type": getDICOMStoreMetricsToolType,
|
||||
"kind": getDICOMStoreMetricsToolType,
|
||||
"source": "my-client-auth-source",
|
||||
"description": "Tool to get DICOM store metrics",
|
||||
},
|
||||
"my-client-auth-search-dicom-studies-tool": map[string]any{
|
||||
"type": searchDICOMStudiesToolType,
|
||||
"kind": searchDICOMStudiesToolType,
|
||||
"source": "my-client-auth-source",
|
||||
"description": "Tool to search DICOM studies",
|
||||
},
|
||||
"my-client-auth-search-dicom-series-tool": map[string]any{
|
||||
"type": searchDICOMSeriesToolType,
|
||||
"kind": searchDICOMSeriesToolType,
|
||||
"source": "my-client-auth-source",
|
||||
"description": "Tool to search DICOM series",
|
||||
},
|
||||
"my-client-auth-search-dicom-instances-tool": map[string]any{
|
||||
"type": searchDICOMInstancesToolType,
|
||||
"kind": searchDICOMInstancesToolType,
|
||||
"source": "my-client-auth-source",
|
||||
"description": "Tool to search DICOM instances",
|
||||
},
|
||||
"my-client-auth-retrieve-rendered-dicom-instance-tool": map[string]any{
|
||||
"type": retrieveRenderedDICOMInstanceToolType,
|
||||
"kind": retrieveRenderedDICOMInstanceToolType,
|
||||
"source": "my-client-auth-source",
|
||||
"description": "Tool to retrieve rendered DICOM instance",
|
||||
},
|
||||
"my-auth-get-dataset-tool": map[string]any{
|
||||
"type": getDatasetToolType,
|
||||
"kind": 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{
|
||||
"type": listFHIRStoresToolType,
|
||||
"kind": 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{
|
||||
"type": listDICOMStoresToolType,
|
||||
"kind": 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{
|
||||
"type": getFHIRStoreToolType,
|
||||
"kind": 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{
|
||||
"type": getFHIRStoreMetricsToolType,
|
||||
"kind": 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{
|
||||
"type": getFHIRResourceToolType,
|
||||
"kind": 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{
|
||||
"type": fhirPatientSearchToolType,
|
||||
"kind": 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{
|
||||
"type": fhirPatientEverythingToolType,
|
||||
"kind": 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{
|
||||
"type": fhirFetchPageToolType,
|
||||
"kind": 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{
|
||||
"type": getDICOMStoreToolType,
|
||||
"kind": 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{
|
||||
"type": getDICOMStoreMetricsToolType,
|
||||
"kind": 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{
|
||||
"type": searchDICOMStudiesToolType,
|
||||
"kind": 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{
|
||||
"type": searchDICOMSeriesToolType,
|
||||
"kind": 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{
|
||||
"type": searchDICOMInstancesToolType,
|
||||
"kind": 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{
|
||||
"type": retrieveRenderedDICOMInstanceToolType,
|
||||
"kind": 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{
|
||||
"type": "google",
|
||||
"kind": "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{
|
||||
"type": healthcareSourceType,
|
||||
"kind": healthcareSourceType,
|
||||
"project": healthcareProject,
|
||||
"region": healthcareRegion,
|
||||
"dataset": healthcareDataset,
|
||||
|
||||
@@ -231,12 +231,12 @@ func getCloneInstanceToolsConfig() map[string]any {
|
||||
return map[string]any{
|
||||
"sources": map[string]any{
|
||||
"my-cloud-sql-source": map[string]any{
|
||||
"type": "cloud-sql-admin",
|
||||
"kind": "cloud-sql-admin",
|
||||
},
|
||||
},
|
||||
"tools": map[string]any{
|
||||
"clone-instance": map[string]any{
|
||||
"type": cloneInstanceToolType,
|
||||
"kind": cloneInstanceToolType,
|
||||
"source": "my-cloud-sql-source",
|
||||
},
|
||||
},
|
||||
|
||||
@@ -219,12 +219,12 @@ func getCreateBackupToolsConfig() map[string]any {
|
||||
return map[string]any{
|
||||
"sources": map[string]any{
|
||||
"my-cloud-sql-source": map[string]any{
|
||||
"type": "cloud-sql-admin",
|
||||
"kind": "cloud-sql-admin",
|
||||
},
|
||||
},
|
||||
"tools": map[string]any{
|
||||
"create-backup": map[string]any{
|
||||
"type": createBackupToolType,
|
||||
"kind": createBackupToolType,
|
||||
"source": "my-cloud-sql-source",
|
||||
},
|
||||
},
|
||||
|
||||
@@ -217,12 +217,12 @@ func getCreateDatabaseToolsConfig() map[string]any {
|
||||
return map[string]any{
|
||||
"sources": map[string]any{
|
||||
"my-cloud-sql-source": map[string]any{
|
||||
"type": "cloud-sql-admin",
|
||||
"kind": "cloud-sql-admin",
|
||||
},
|
||||
},
|
||||
"tools": map[string]any{
|
||||
"create-database": map[string]any{
|
||||
"type": createDatabaseToolType,
|
||||
"kind": createDatabaseToolType,
|
||||
"source": "my-cloud-sql-source",
|
||||
},
|
||||
},
|
||||
|
||||
@@ -229,12 +229,12 @@ func getCreateUsersToolsConfig() map[string]any {
|
||||
return map[string]any{
|
||||
"sources": map[string]any{
|
||||
"my-cloud-sql-source": map[string]any{
|
||||
"type": "cloud-sql-admin",
|
||||
"kind": "cloud-sql-admin",
|
||||
},
|
||||
},
|
||||
"tools": map[string]any{
|
||||
"create-user": map[string]any{
|
||||
"type": createUserToolType,
|
||||
"kind": createUserToolType,
|
||||
"source": "my-cloud-sql-source",
|
||||
},
|
||||
},
|
||||
|
||||
@@ -53,7 +53,7 @@ func (t *getInstancesTransport) RoundTrip(req *http.Request) (*http.Response, er
|
||||
|
||||
type instance struct {
|
||||
Name string `json:"name"`
|
||||
Type string `json:"type"`
|
||||
Type string `json:"kind"`
|
||||
}
|
||||
|
||||
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","type":"sql#instance"}`,
|
||||
want: `{"name":"instance-1","kind":"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{
|
||||
"type": "cloud-sql-admin",
|
||||
"kind": "cloud-sql-admin",
|
||||
},
|
||||
"my-invalid-cloud-sql-source": map[string]any{
|
||||
"type": "cloud-sql-admin",
|
||||
"kind": "cloud-sql-admin",
|
||||
"useClientOAuth": true,
|
||||
},
|
||||
},
|
||||
"tools": map[string]any{
|
||||
"get-instance-1": map[string]any{
|
||||
"type": getInstancesToolType,
|
||||
"kind": getInstancesToolType,
|
||||
"description": "get instance 1",
|
||||
"source": "my-cloud-sql-source",
|
||||
},
|
||||
"get-instance-2": map[string]any{
|
||||
"type": getInstancesToolType,
|
||||
"kind": getInstancesToolType,
|
||||
"description": "get instance 2",
|
||||
"source": "my-invalid-cloud-sql-source",
|
||||
},
|
||||
|
||||
@@ -200,12 +200,12 @@ func getListDatabasesToolsConfig() map[string]any {
|
||||
return map[string]any{
|
||||
"sources": map[string]any{
|
||||
"my-cloud-sql-source": map[string]any{
|
||||
"type": "cloud-sql-admin",
|
||||
"kind": "cloud-sql-admin",
|
||||
},
|
||||
},
|
||||
"tools": map[string]any{
|
||||
"list-databases": map[string]any{
|
||||
"type": listDatabasesToolType,
|
||||
"kind": listDatabasesToolType,
|
||||
"source": "my-cloud-sql-source",
|
||||
},
|
||||
},
|
||||
|
||||
@@ -171,20 +171,20 @@ func getListInstanceToolsConfig() map[string]any {
|
||||
return map[string]any{
|
||||
"sources": map[string]any{
|
||||
"my-cloud-sql-source": map[string]any{
|
||||
"type": "cloud-sql-admin",
|
||||
"kind": "cloud-sql-admin",
|
||||
},
|
||||
"my-invalid-cloud-sql-source": map[string]any{
|
||||
"type": "cloud-sql-admin",
|
||||
"kind": "cloud-sql-admin",
|
||||
"useClientOAuth": true,
|
||||
},
|
||||
},
|
||||
"tools": map[string]any{
|
||||
"list-instances": map[string]any{
|
||||
"type": "cloud-sql-list-instances",
|
||||
"kind": "cloud-sql-list-instances",
|
||||
"source": "my-cloud-sql-source",
|
||||
},
|
||||
"list-instances-fail": map[string]any{
|
||||
"type": "cloud-sql-list-instances",
|
||||
"kind": "cloud-sql-list-instances",
|
||||
"description": "list instances",
|
||||
"source": "my-invalid-cloud-sql-source",
|
||||
},
|
||||
|
||||
@@ -291,22 +291,22 @@ func getCloudSQLWaitToolsConfig() map[string]any {
|
||||
return map[string]any{
|
||||
"sources": map[string]any{
|
||||
"my-cloud-sql-source": map[string]any{
|
||||
"type": "cloud-sql-admin",
|
||||
"kind": "cloud-sql-admin",
|
||||
},
|
||||
},
|
||||
"tools": map[string]any{
|
||||
"wait-for-op1": map[string]any{
|
||||
"type": cloudsqlWaitToolType,
|
||||
"kind": cloudsqlWaitToolType,
|
||||
"source": "my-cloud-sql-source",
|
||||
"description": "wait for op1",
|
||||
},
|
||||
"wait-for-op2": map[string]any{
|
||||
"type": cloudsqlWaitToolType,
|
||||
"kind": cloudsqlWaitToolType,
|
||||
"source": "my-cloud-sql-source",
|
||||
"description": "wait for op2",
|
||||
},
|
||||
"wait-for-op3": map[string]any{
|
||||
"type": cloudsqlWaitToolType,
|
||||
"kind": cloudsqlWaitToolType,
|
||||
"source": "my-cloud-sql-source",
|
||||
"description": "wait for op3",
|
||||
},
|
||||
|
||||
@@ -260,16 +260,16 @@ func getCreateInstanceToolsConfig() map[string]any {
|
||||
return map[string]any{
|
||||
"sources": map[string]any{
|
||||
"my-cloud-sql-source": map[string]any{
|
||||
"type": "cloud-sql-admin",
|
||||
"kind": "cloud-sql-admin",
|
||||
},
|
||||
},
|
||||
"tools": map[string]any{
|
||||
"create-instance-prod": map[string]any{
|
||||
"type": createInstanceToolType,
|
||||
"kind": createInstanceToolType,
|
||||
"source": "my-cloud-sql-source",
|
||||
},
|
||||
"create-instance-dev": map[string]any{
|
||||
"type": createInstanceToolType,
|
||||
"kind": createInstanceToolType,
|
||||
"source": "my-cloud-sql-source",
|
||||
},
|
||||
},
|
||||
|
||||
@@ -61,7 +61,7 @@ func getCloudSQLMSSQLVars(t *testing.T) map[string]any {
|
||||
}
|
||||
|
||||
return map[string]any{
|
||||
"type": CloudSQLMSSQLSourceType,
|
||||
"kind": CloudSQLMSSQLSourceType,
|
||||
"project": CloudSQLMSSQLProject,
|
||||
"instance": CloudSQLMSSQLInstance,
|
||||
"region": CloudSQLMSSQLRegion,
|
||||
|
||||
@@ -261,16 +261,16 @@ func getCreateInstanceToolsConfig() map[string]any {
|
||||
return map[string]any{
|
||||
"sources": map[string]any{
|
||||
"my-cloud-sql-source": map[string]any{
|
||||
"type": "cloud-sql-admin",
|
||||
"kind": "cloud-sql-admin",
|
||||
},
|
||||
},
|
||||
"tools": map[string]any{
|
||||
"create-instance-prod": map[string]any{
|
||||
"type": createInstanceToolType,
|
||||
"kind": createInstanceToolType,
|
||||
"source": "my-cloud-sql-source",
|
||||
},
|
||||
"create-instance-dev": map[string]any{
|
||||
"type": createInstanceToolType,
|
||||
"kind": createInstanceToolType,
|
||||
"source": "my-cloud-sql-source",
|
||||
},
|
||||
},
|
||||
|
||||
@@ -60,7 +60,7 @@ func getCloudSQLMySQLVars(t *testing.T) map[string]any {
|
||||
}
|
||||
|
||||
return map[string]any{
|
||||
"type": CloudSQLMySQLSourceType,
|
||||
"kind": 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{
|
||||
"type": CloudSQLMySQLSourceType,
|
||||
"kind": CloudSQLMySQLSourceType,
|
||||
"project": CloudSQLMySQLProject,
|
||||
"instance": CloudSQLMySQLInstance,
|
||||
"region": CloudSQLMySQLRegion,
|
||||
@@ -208,7 +208,7 @@ func TestCloudSQLMySQLIAMConnection(t *testing.T) {
|
||||
"user": serviceAccountEmail,
|
||||
}
|
||||
noUserSourceConfig := map[string]any{
|
||||
"type": CloudSQLMySQLSourceType,
|
||||
"kind": CloudSQLMySQLSourceType,
|
||||
"project": CloudSQLMySQLProject,
|
||||
"instance": CloudSQLMySQLInstance,
|
||||
"region": CloudSQLMySQLRegion,
|
||||
@@ -216,7 +216,7 @@ func TestCloudSQLMySQLIAMConnection(t *testing.T) {
|
||||
"password": "random",
|
||||
}
|
||||
noUserNoPassSourceConfig := map[string]any{
|
||||
"type": CloudSQLMySQLSourceType,
|
||||
"kind": 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{
|
||||
"type": CloudSQLMySQLToolType,
|
||||
"kind": CloudSQLMySQLToolType,
|
||||
"source": uniqueSourceName,
|
||||
"description": "Simple tool to test end to end functionality.",
|
||||
"statement": "SELECT 1;",
|
||||
|
||||
@@ -262,16 +262,16 @@ func getCreateInstanceToolsConfig() map[string]any {
|
||||
return map[string]any{
|
||||
"sources": map[string]any{
|
||||
"my-cloud-sql-source": map[string]any{
|
||||
"type": "cloud-sql-admin",
|
||||
"kind": "cloud-sql-admin",
|
||||
},
|
||||
},
|
||||
"tools": map[string]any{
|
||||
"create-instance-prod": map[string]any{
|
||||
"type": createInstanceToolType,
|
||||
"kind": createInstanceToolType,
|
||||
"source": "my-cloud-sql-source",
|
||||
},
|
||||
"create-instance-dev": map[string]any{
|
||||
"type": createInstanceToolType,
|
||||
"kind": createInstanceToolType,
|
||||
"source": "my-cloud-sql-source",
|
||||
},
|
||||
},
|
||||
|
||||
@@ -59,7 +59,7 @@ func getCloudSQLPgVars(t *testing.T) map[string]any {
|
||||
}
|
||||
|
||||
return map[string]any{
|
||||
"type": CloudSQLPostgresSourceType,
|
||||
"kind": 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{
|
||||
"type": CloudSQLPostgresSourceType,
|
||||
"kind": CloudSQLPostgresSourceType,
|
||||
"project": CloudSQLPostgresProject,
|
||||
"instance": CloudSQLPostgresInstance,
|
||||
"region": CloudSQLPostgresRegion,
|
||||
@@ -231,7 +231,7 @@ func TestCloudSQLPgIAMConnection(t *testing.T) {
|
||||
}
|
||||
|
||||
noUserSourceConfig := map[string]any{
|
||||
"type": CloudSQLPostgresSourceType,
|
||||
"kind": CloudSQLPostgresSourceType,
|
||||
"project": CloudSQLPostgresProject,
|
||||
"instance": CloudSQLPostgresInstance,
|
||||
"region": CloudSQLPostgresRegion,
|
||||
@@ -240,7 +240,7 @@ func TestCloudSQLPgIAMConnection(t *testing.T) {
|
||||
}
|
||||
|
||||
noUserNoPassSourceConfig := map[string]any{
|
||||
"type": CloudSQLPostgresSourceType,
|
||||
"kind": CloudSQLPostgresSourceType,
|
||||
"project": CloudSQLPostgresProject,
|
||||
"instance": CloudSQLPostgresInstance,
|
||||
"region": CloudSQLPostgresRegion,
|
||||
|
||||
@@ -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."],"type":"","message":"This is a warning.","messageType":"WARNING"}]}`,
|
||||
want: `{"preCheckResponse":[{"actionsRequired":["Check documentation."],"kind":"","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."],"type":"","message":"This is a critical error.","messageType":"ERROR"}]}`,
|
||||
want: `{"preCheckResponse":[{"actionsRequired":["Fix this now."],"kind":"","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{
|
||||
"type": "cloud-sql-admin",
|
||||
"kind": "cloud-sql-admin",
|
||||
},
|
||||
},
|
||||
"tools": map[string]any{
|
||||
"precheck-tool": map[string]any{
|
||||
"type": preCheckToolType,
|
||||
"kind": preCheckToolType,
|
||||
"source": "my-cloud-sql-source",
|
||||
"authRequired": []string{
|
||||
"https://www.googleapis.com/auth/cloud-platform",
|
||||
|
||||
205
tests/common.go
205
tests/common.go
@@ -24,6 +24,7 @@ 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"
|
||||
@@ -41,19 +42,19 @@ func GetToolsConfig(sourceConfig map[string]any, toolType, paramToolStatement, i
|
||||
},
|
||||
"authServices": map[string]any{
|
||||
"my-google-auth": map[string]any{
|
||||
"type": "google",
|
||||
"kind": "google",
|
||||
"clientId": ClientId,
|
||||
},
|
||||
},
|
||||
"tools": map[string]any{
|
||||
"my-simple-tool": map[string]any{
|
||||
"type": toolType,
|
||||
"kind": toolType,
|
||||
"source": "my-instance",
|
||||
"description": "Simple tool to test end to end functionality.",
|
||||
"statement": "SELECT 1",
|
||||
},
|
||||
"my-tool": map[string]any{
|
||||
"type": toolType,
|
||||
"kind": toolType,
|
||||
"source": "my-instance",
|
||||
"description": "Tool to test invocation with params.",
|
||||
"statement": paramToolStatement,
|
||||
@@ -71,7 +72,7 @@ func GetToolsConfig(sourceConfig map[string]any, toolType, paramToolStatement, i
|
||||
},
|
||||
},
|
||||
"my-tool-by-id": map[string]any{
|
||||
"type": toolType,
|
||||
"kind": toolType,
|
||||
"source": "my-instance",
|
||||
"description": "Tool to test invocation with params.",
|
||||
"statement": idParamToolStmt,
|
||||
@@ -84,7 +85,7 @@ func GetToolsConfig(sourceConfig map[string]any, toolType, paramToolStatement, i
|
||||
},
|
||||
},
|
||||
"my-tool-by-name": map[string]any{
|
||||
"type": toolType,
|
||||
"kind": toolType,
|
||||
"source": "my-instance",
|
||||
"description": "Tool to test invocation with params.",
|
||||
"statement": nameParamToolStmt,
|
||||
@@ -98,7 +99,7 @@ func GetToolsConfig(sourceConfig map[string]any, toolType, paramToolStatement, i
|
||||
},
|
||||
},
|
||||
"my-array-tool": map[string]any{
|
||||
"type": toolType,
|
||||
"kind": toolType,
|
||||
"source": "my-instance",
|
||||
"description": "Tool to test invocation with array params.",
|
||||
"statement": arrayToolStatement,
|
||||
@@ -126,7 +127,7 @@ func GetToolsConfig(sourceConfig map[string]any, toolType, paramToolStatement, i
|
||||
},
|
||||
},
|
||||
"my-auth-tool": map[string]any{
|
||||
"type": toolType,
|
||||
"kind": toolType,
|
||||
"source": "my-instance",
|
||||
"description": "Tool to test authenticated parameters.",
|
||||
// statement to auto-fill authenticated parameter
|
||||
@@ -146,7 +147,7 @@ func GetToolsConfig(sourceConfig map[string]any, toolType, paramToolStatement, i
|
||||
},
|
||||
},
|
||||
"my-auth-required-tool": map[string]any{
|
||||
"type": toolType,
|
||||
"kind": toolType,
|
||||
"source": "my-instance",
|
||||
"description": "Tool to test auth required invocation.",
|
||||
"statement": "SELECT 1",
|
||||
@@ -155,7 +156,7 @@ func GetToolsConfig(sourceConfig map[string]any, toolType, paramToolStatement, i
|
||||
},
|
||||
},
|
||||
"my-fail-tool": map[string]any{
|
||||
"type": toolType,
|
||||
"kind": toolType,
|
||||
"source": "my-instance",
|
||||
"description": "Tool to test statement with incorrect syntax.",
|
||||
"statement": "SELEC 1;",
|
||||
@@ -173,12 +174,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{
|
||||
"type": toolType,
|
||||
"kind": toolType,
|
||||
"source": "my-instance",
|
||||
"description": "Tool to execute sql",
|
||||
}
|
||||
tools["my-auth-exec-sql-tool"] = map[string]any{
|
||||
"type": toolType,
|
||||
"kind": toolType,
|
||||
"source": "my-instance",
|
||||
"description": "Tool to execute sql",
|
||||
"authRequired": []string{
|
||||
@@ -220,99 +221,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{
|
||||
"type": PostgresListTablesToolType,
|
||||
"kind": PostgresListTablesToolType,
|
||||
"source": "my-instance",
|
||||
"description": "Lists tables in the database.",
|
||||
}
|
||||
tools["list_active_queries"] = map[string]any{
|
||||
"type": PostgresListActiveQueriesToolType,
|
||||
"kind": PostgresListActiveQueriesToolType,
|
||||
"source": "my-instance",
|
||||
"description": "Lists active queries in the database.",
|
||||
}
|
||||
tools["list_installed_extensions"] = map[string]any{
|
||||
"type": PostgresListInstalledExtensionsToolType,
|
||||
"kind": PostgresListInstalledExtensionsToolType,
|
||||
"source": "my-instance",
|
||||
"description": "Lists installed extensions in the database.",
|
||||
}
|
||||
tools["list_available_extensions"] = map[string]any{
|
||||
"type": PostgresListAvailableExtensionsToolType,
|
||||
"kind": PostgresListAvailableExtensionsToolType,
|
||||
"source": "my-instance",
|
||||
"description": "Lists available extensions in the database.",
|
||||
}
|
||||
tools["list_views"] = map[string]any{
|
||||
"type": PostgresListViewsToolType,
|
||||
"kind": PostgresListViewsToolType,
|
||||
"source": "my-instance",
|
||||
}
|
||||
tools["list_schemas"] = map[string]any{
|
||||
"type": PostgresListSchemasToolType,
|
||||
"kind": PostgresListSchemasToolType,
|
||||
"source": "my-instance",
|
||||
}
|
||||
tools["database_overview"] = map[string]any{
|
||||
"type": PostgresDatabaseOverviewToolType,
|
||||
"kind": PostgresDatabaseOverviewToolType,
|
||||
"source": "my-instance",
|
||||
}
|
||||
tools["list_triggers"] = map[string]any{
|
||||
"type": PostgresListTriggersToolType,
|
||||
"kind": PostgresListTriggersToolType,
|
||||
"source": "my-instance",
|
||||
}
|
||||
tools["list_indexes"] = map[string]any{
|
||||
"type": PostgresListIndexesToolType,
|
||||
"kind": PostgresListIndexesToolType,
|
||||
"source": "my-instance",
|
||||
}
|
||||
tools["list_sequences"] = map[string]any{
|
||||
"type": PostgresListSequencesToolType,
|
||||
"kind": PostgresListSequencesToolType,
|
||||
"source": "my-instance",
|
||||
}
|
||||
tools["list_publication_tables"] = map[string]any{
|
||||
"type": PostgresListPublicationTablesToolType,
|
||||
"kind": PostgresListPublicationTablesToolType,
|
||||
"source": "my-instance",
|
||||
}
|
||||
tools["long_running_transactions"] = map[string]any{
|
||||
"type": PostgresLongRunningTransactionsToolType,
|
||||
"kind": PostgresLongRunningTransactionsToolType,
|
||||
"source": "my-instance",
|
||||
}
|
||||
tools["list_locks"] = map[string]any{
|
||||
"type": PostgresListLocksToolType,
|
||||
"kind": PostgresListLocksToolType,
|
||||
"source": "my-instance",
|
||||
}
|
||||
tools["replication_stats"] = map[string]any{
|
||||
"type": PostgresReplicationStatsToolType,
|
||||
"kind": PostgresReplicationStatsToolType,
|
||||
"source": "my-instance",
|
||||
}
|
||||
tools["list_query_stats"] = map[string]any{
|
||||
"type": PostgresListQueryStatsToolType,
|
||||
"kind": PostgresListQueryStatsToolType,
|
||||
"source": "my-instance",
|
||||
}
|
||||
tools["get_column_cardinality"] = map[string]any{
|
||||
"type": PostgresGetColumnCardinalityToolType,
|
||||
"kind": PostgresGetColumnCardinalityToolType,
|
||||
"source": "my-instance",
|
||||
}
|
||||
|
||||
tools["list_table_stats"] = map[string]any{
|
||||
"type": PostgresListTableStats,
|
||||
"kind": PostgresListTableStats,
|
||||
"source": "my-instance",
|
||||
}
|
||||
|
||||
tools["list_tablespaces"] = map[string]any{
|
||||
"type": PostgresListTablespacesToolType,
|
||||
"kind": PostgresListTablespacesToolType,
|
||||
"source": "my-instance",
|
||||
}
|
||||
tools["list_pg_settings"] = map[string]any{
|
||||
"type": PostgresListPGSettingsToolType,
|
||||
"kind": PostgresListPGSettingsToolType,
|
||||
"source": "my-instance",
|
||||
}
|
||||
tools["list_database_stats"] = map[string]any{
|
||||
"type": PostgresListDatabaseStatsToolType,
|
||||
"kind": PostgresListDatabaseStatsToolType,
|
||||
"source": "my-instance",
|
||||
}
|
||||
|
||||
tools["list_roles"] = map[string]any{
|
||||
"type": PostgresListRolesToolType,
|
||||
"kind": PostgresListRolesToolType,
|
||||
"source": "my-instance",
|
||||
}
|
||||
|
||||
tools["list_stored_procedure"] = map[string]any{
|
||||
"type": PostgresListStoredProcedureToolType,
|
||||
"kind": PostgresListStoredProcedureToolType,
|
||||
"source": "my-instance",
|
||||
}
|
||||
config["tools"] = tools
|
||||
@@ -331,7 +332,7 @@ func AddTemplateParamConfig(t *testing.T, config map[string]any, toolType, tmplS
|
||||
}
|
||||
|
||||
toolsMap["create-table-templateParams-tool"] = map[string]any{
|
||||
"type": toolType,
|
||||
"kind": toolType,
|
||||
"source": "my-instance",
|
||||
"description": "Create table tool with template parameters",
|
||||
"statement": "CREATE TABLE {{.tableName}} ({{array .columns}})",
|
||||
@@ -341,7 +342,7 @@ func AddTemplateParamConfig(t *testing.T, config map[string]any, toolType, tmplS
|
||||
},
|
||||
}
|
||||
toolsMap["insert-table-templateParams-tool"] = map[string]any{
|
||||
"type": toolType,
|
||||
"kind": toolType,
|
||||
"source": "my-instance",
|
||||
"description": "Insert tool with template parameters",
|
||||
"statement": "INSERT INTO {{.tableName}} ({{array .columns}}) VALUES ({{.values}})",
|
||||
@@ -352,7 +353,7 @@ func AddTemplateParamConfig(t *testing.T, config map[string]any, toolType, tmplS
|
||||
},
|
||||
}
|
||||
toolsMap["select-templateParams-tool"] = map[string]any{
|
||||
"type": toolType,
|
||||
"kind": toolType,
|
||||
"source": "my-instance",
|
||||
"description": "Create table tool with template parameters",
|
||||
"statement": selectAll,
|
||||
@@ -361,7 +362,7 @@ func AddTemplateParamConfig(t *testing.T, config map[string]any, toolType, tmplS
|
||||
},
|
||||
}
|
||||
toolsMap["select-templateParams-combined-tool"] = map[string]any{
|
||||
"type": toolType,
|
||||
"kind": toolType,
|
||||
"source": "my-instance",
|
||||
"description": "Create table tool with template parameters",
|
||||
"statement": tmplSelectCombined,
|
||||
@@ -371,7 +372,7 @@ func AddTemplateParamConfig(t *testing.T, config map[string]any, toolType, tmplS
|
||||
},
|
||||
}
|
||||
toolsMap["select-fields-templateParams-tool"] = map[string]any{
|
||||
"type": toolType,
|
||||
"kind": toolType,
|
||||
"source": "my-instance",
|
||||
"description": "Create table tool with template parameters",
|
||||
"statement": "SELECT {{array .fields}} FROM {{.tableName}} ORDER BY id",
|
||||
@@ -381,7 +382,7 @@ func AddTemplateParamConfig(t *testing.T, config map[string]any, toolType, tmplS
|
||||
},
|
||||
}
|
||||
toolsMap["select-filter-templateParams-combined-tool"] = map[string]any{
|
||||
"type": toolType,
|
||||
"kind": toolType,
|
||||
"source": "my-instance",
|
||||
"description": "Create table tool with template parameters",
|
||||
"statement": tmplSelectFilterCombined,
|
||||
@@ -392,7 +393,7 @@ func AddTemplateParamConfig(t *testing.T, config map[string]any, toolType, tmplS
|
||||
},
|
||||
}
|
||||
toolsMap["drop-table-templateParams-tool"] = map[string]any{
|
||||
"type": toolType,
|
||||
"kind": toolType,
|
||||
"source": "my-instance",
|
||||
"description": "Drop table tool with template parameters",
|
||||
"statement": "DROP TABLE IF EXISTS {{.tableName}}",
|
||||
@@ -411,12 +412,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{
|
||||
"type": "mysql-execute-sql",
|
||||
"kind": "mysql-execute-sql",
|
||||
"source": "my-instance",
|
||||
"description": "Tool to execute sql",
|
||||
}
|
||||
tools["my-auth-exec-sql-tool"] = map[string]any{
|
||||
"type": "mysql-execute-sql",
|
||||
"kind": "mysql-execute-sql",
|
||||
"source": "my-instance",
|
||||
"description": "Tool to execute sql",
|
||||
"authRequired": []string{
|
||||
@@ -434,27 +435,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{
|
||||
"type": "mysql-list-tables",
|
||||
"kind": "mysql-list-tables",
|
||||
"source": "my-instance",
|
||||
"description": "Lists tables in the database.",
|
||||
}
|
||||
tools["list_active_queries"] = map[string]any{
|
||||
"type": "mysql-list-active-queries",
|
||||
"kind": "mysql-list-active-queries",
|
||||
"source": "my-instance",
|
||||
"description": "Lists active queries in the database.",
|
||||
}
|
||||
tools["list_tables_missing_unique_indexes"] = map[string]any{
|
||||
"type": "mysql-list-tables-missing-unique-indexes",
|
||||
"kind": "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{
|
||||
"type": "mysql-list-table-fragmentation",
|
||||
"kind": "mysql-list-table-fragmentation",
|
||||
"source": "my-instance",
|
||||
"description": "Lists table fragmentation in the database.",
|
||||
}
|
||||
tools["get_query_plan"] = map[string]any{
|
||||
"type": "mysql-get-query-plan",
|
||||
"kind": "mysql-get-query-plan",
|
||||
"source": "my-instance",
|
||||
"description": "Gets the query plan for a SQL statement.",
|
||||
}
|
||||
@@ -469,12 +470,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{
|
||||
"type": "mssql-execute-sql",
|
||||
"kind": "mssql-execute-sql",
|
||||
"source": "my-instance",
|
||||
"description": "Tool to execute sql",
|
||||
}
|
||||
tools["my-auth-exec-sql-tool"] = map[string]any{
|
||||
"type": "mssql-execute-sql",
|
||||
"kind": "mssql-execute-sql",
|
||||
"source": "my-instance",
|
||||
"description": "Tool to execute sql",
|
||||
"authRequired": []string{
|
||||
@@ -492,7 +493,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{
|
||||
"type": "mssql-list-tables",
|
||||
"kind": "mssql-list-tables",
|
||||
"source": "my-instance",
|
||||
"description": "Lists tables in the database.",
|
||||
}
|
||||
@@ -500,7 +501,7 @@ func AddMSSQLPrebuiltToolConfig(t *testing.T, config map[string]any) map[string]
|
||||
return config
|
||||
}
|
||||
|
||||
// GetPostgresSQLParamToolInfo returns statements and param for my-tool postgres-sql type
|
||||
// GetPostgresSQLParamToolInfo returns statements and param for my-tool postgres-sql kind
|
||||
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)
|
||||
@@ -512,7 +513,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 type
|
||||
// GetPostgresSQLAuthToolInfo returns statements and param of my-auth-tool for postgres-sql kind
|
||||
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)
|
||||
@@ -521,14 +522,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 type
|
||||
// GetPostgresSQLTmplToolStatement returns statements and param for template parameter test cases for postgres-sql kind
|
||||
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 type
|
||||
// GetMSSQLParamToolInfo returns statements and param for my-tool mssql-sql kind
|
||||
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)
|
||||
@@ -540,7 +541,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 type
|
||||
// GetMSSQLAuthToolInfo returns statements and param of my-auth-tool for mssql-sql kind
|
||||
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)
|
||||
@@ -549,14 +550,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 type
|
||||
// GetMSSQLTmplToolStatement returns statements and param for template parameter test cases for mysql-sql kind
|
||||
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 type
|
||||
// GetMySQLParamToolInfo returns statements and param for my-tool mysql-sql kind
|
||||
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)
|
||||
@@ -568,7 +569,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 type
|
||||
// GetMySQLAuthToolInfo returns statements and param of my-auth-tool for mysql-sql kind
|
||||
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)
|
||||
@@ -577,7 +578,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 type
|
||||
// GetMySQLTmplToolStatement returns statements and param for template parameter test cases for mysql-sql kind
|
||||
func GetMySQLTmplToolStatement() (string, string) {
|
||||
tmplSelectCombined := "SELECT * FROM {{.tableName}} WHERE id = ?"
|
||||
tmplSelectFilterCombined := "SELECT * FROM {{.tableName}} WHERE {{.columnFilter}} = ?"
|
||||
@@ -717,19 +718,19 @@ func GetRedisValkeyToolsConfig(sourceConfig map[string]any, toolType string) map
|
||||
},
|
||||
"authServices": map[string]any{
|
||||
"my-google-auth": map[string]any{
|
||||
"type": "google",
|
||||
"kind": "google",
|
||||
"clientId": ClientId,
|
||||
},
|
||||
},
|
||||
"tools": map[string]any{
|
||||
"my-simple-tool": map[string]any{
|
||||
"type": toolType,
|
||||
"kind": toolType,
|
||||
"source": "my-instance",
|
||||
"description": "Simple tool to test end to end functionality.",
|
||||
"commands": [][]string{{"PING"}},
|
||||
},
|
||||
"my-tool": map[string]any{
|
||||
"type": toolType,
|
||||
"kind": toolType,
|
||||
"source": "my-instance",
|
||||
"description": "Tool to test invocation with params.",
|
||||
"commands": [][]string{{"HGETALL", "row1"}, {"HGETALL", "row3"}},
|
||||
@@ -747,7 +748,7 @@ func GetRedisValkeyToolsConfig(sourceConfig map[string]any, toolType string) map
|
||||
},
|
||||
},
|
||||
"my-tool-by-id": map[string]any{
|
||||
"type": toolType,
|
||||
"kind": toolType,
|
||||
"source": "my-instance",
|
||||
"description": "Tool to test invocation with params.",
|
||||
"commands": [][]string{{"HGETALL", "row4"}},
|
||||
@@ -760,7 +761,7 @@ func GetRedisValkeyToolsConfig(sourceConfig map[string]any, toolType string) map
|
||||
},
|
||||
},
|
||||
"my-tool-by-name": map[string]any{
|
||||
"type": toolType,
|
||||
"kind": toolType,
|
||||
"source": "my-instance",
|
||||
"description": "Tool to test invocation with params.",
|
||||
"commands": [][]string{{"GET", "null"}},
|
||||
@@ -774,7 +775,7 @@ func GetRedisValkeyToolsConfig(sourceConfig map[string]any, toolType string) map
|
||||
},
|
||||
},
|
||||
"my-array-tool": map[string]any{
|
||||
"type": toolType,
|
||||
"kind": toolType,
|
||||
"source": "my-instance",
|
||||
"description": "Tool to test invocation with array params.",
|
||||
"commands": [][]string{{"HGETALL", "row1"}, {"$cmdArray"}},
|
||||
@@ -792,7 +793,7 @@ func GetRedisValkeyToolsConfig(sourceConfig map[string]any, toolType string) map
|
||||
},
|
||||
},
|
||||
"my-auth-tool": map[string]any{
|
||||
"type": toolType,
|
||||
"kind": toolType,
|
||||
"source": "my-instance",
|
||||
"description": "Tool to test authenticated parameters.",
|
||||
// statement to auto-fill authenticated parameter
|
||||
@@ -812,7 +813,7 @@ func GetRedisValkeyToolsConfig(sourceConfig map[string]any, toolType string) map
|
||||
},
|
||||
},
|
||||
"my-auth-required-tool": map[string]any{
|
||||
"type": toolType,
|
||||
"kind": toolType,
|
||||
"source": "my-instance",
|
||||
"description": "Tool to test auth required invocation.",
|
||||
"commands": [][]string{{"PING"}},
|
||||
@@ -821,7 +822,7 @@ func GetRedisValkeyToolsConfig(sourceConfig map[string]any, toolType string) map
|
||||
},
|
||||
},
|
||||
"my-fail-tool": map[string]any{
|
||||
"type": toolType,
|
||||
"kind": toolType,
|
||||
"source": "my-instance",
|
||||
"description": "Tool to test statement with incorrect syntax.",
|
||||
"commands": [][]string{{"SELEC 1;"}},
|
||||
@@ -842,15 +843,15 @@ func TestCloudSQLMySQL_IPTypeParsingFromYAML(t *testing.T) {
|
||||
{
|
||||
desc: "IPType Defaulting to Public",
|
||||
in: `
|
||||
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
|
||||
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
|
||||
`,
|
||||
want: server.SourceConfigs{
|
||||
"my-mysql-instance": cloudsqlmysql.Config{
|
||||
@@ -869,16 +870,16 @@ func TestCloudSQLMySQL_IPTypeParsingFromYAML(t *testing.T) {
|
||||
{
|
||||
desc: "IPType Explicit Public",
|
||||
in: `
|
||||
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
|
||||
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
|
||||
`,
|
||||
want: server.SourceConfigs{
|
||||
"my-mysql-instance": cloudsqlmysql.Config{
|
||||
@@ -897,16 +898,16 @@ func TestCloudSQLMySQL_IPTypeParsingFromYAML(t *testing.T) {
|
||||
{
|
||||
desc: "IPType Explicit Private",
|
||||
in: `
|
||||
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
|
||||
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
|
||||
`,
|
||||
want: server.SourceConfigs{
|
||||
"my-mysql-instance": cloudsqlmysql.Config{
|
||||
@@ -925,12 +926,16 @@ func TestCloudSQLMySQL_IPTypeParsingFromYAML(t *testing.T) {
|
||||
}
|
||||
for _, tc := range tcs {
|
||||
t.Run(tc.desc, func(t *testing.T) {
|
||||
got, _, _, _, _, _, err := server.UnmarshalResourceConfig(context.Background(), testutils.FormatYaml(tc.in))
|
||||
got := struct {
|
||||
Sources server.SourceConfigs `yaml:"sources"`
|
||||
}{}
|
||||
// Parse contents
|
||||
err := yaml.Unmarshal(testutils.FormatYaml(tc.in), &got)
|
||||
if err != nil {
|
||||
t.Fatalf("unable to unmarshal: %s", err)
|
||||
}
|
||||
if !cmp.Equal(tc.want, got) {
|
||||
t.Fatalf("incorrect parse: diff (-want +got):\n%s", cmp.Diff(tc.want, got))
|
||||
if !cmp.Equal(tc.want, got.Sources) {
|
||||
t.Fatalf("incorrect parse: diff (-want +got):\n%s", cmp.Diff(tc.want, got.Sources))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ func getCouchbaseVars(t *testing.T) map[string]any {
|
||||
}
|
||||
|
||||
return map[string]any{
|
||||
"type": couchbaseSourceType,
|
||||
"kind": 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 type
|
||||
// getCouchbaseParamToolInfo returns statements and params for my-tool couchbase-sql kind
|
||||
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 type
|
||||
// getCouchbaseAuthToolInfo returns statements and param of my-auth-tool for couchbase-sql kind
|
||||
func getCouchbaseAuthToolInfo(collectionName string) (string, []map[string]any) {
|
||||
toolStatement := fmt.Sprintf("SELECT name FROM %s WHERE email = $email", collectionName)
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ func TestDataformCompileTool(t *testing.T) {
|
||||
toolsFile := map[string]any{
|
||||
"tools": map[string]any{
|
||||
"my-dataform-compiler": map[string]any{
|
||||
"type": "dataform-compile-local",
|
||||
"kind": "dataform-compile-local",
|
||||
"description": "Tool to compile dataform projects",
|
||||
},
|
||||
},
|
||||
|
||||
@@ -53,7 +53,7 @@ func getDataplexVars(t *testing.T) map[string]any {
|
||||
t.Fatal("'DATAPLEX_PROJECT' not set")
|
||||
}
|
||||
return map[string]any{
|
||||
"type": DataplexSourceType,
|
||||
"kind": 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{
|
||||
"type": "google",
|
||||
"kind": "google",
|
||||
"clientId": tests.ClientId,
|
||||
},
|
||||
},
|
||||
"tools": map[string]any{
|
||||
"my-dataplex-search-entries-tool": map[string]any{
|
||||
"type": DataplexSearchEntriesToolType,
|
||||
"kind": 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{
|
||||
"type": DataplexSearchEntriesToolType,
|
||||
"kind": 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{
|
||||
"type": DataplexLookupEntryToolType,
|
||||
"kind": 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{
|
||||
"type": DataplexLookupEntryToolType,
|
||||
"kind": 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{
|
||||
"type": DataplexSearchAspectTypesToolType,
|
||||
"kind": 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{
|
||||
"type": DataplexSearchAspectTypesToolType,
|
||||
"kind": DataplexSearchAspectTypesToolType,
|
||||
"source": "my-dataplex-instance",
|
||||
"description": "Simple dataplex search aspect types tool to test end to end functionality.",
|
||||
"authRequired": []string{"my-google-auth"},
|
||||
|
||||
@@ -41,7 +41,7 @@ func getDgraphVars(t *testing.T) map[string]any {
|
||||
t.Fatal("'DGRAPH_URL' not set")
|
||||
}
|
||||
return map[string]any{
|
||||
"type": DgraphSourceType,
|
||||
"kind": 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{
|
||||
"type": "dgraph-dql",
|
||||
"kind": "dgraph-dql",
|
||||
"source": "my-dgraph-instance",
|
||||
"description": "Simple tool to test end to end functionality.",
|
||||
"statement": "{result(func: uid(0x0)) {constant: math(1)}}",
|
||||
|
||||
@@ -43,7 +43,7 @@ func getElasticsearchVars(t *testing.T) map[string]any {
|
||||
t.Fatal("'ELASTICSEARCH_HOST' not set")
|
||||
}
|
||||
return map[string]any{
|
||||
"type": ElasticsearchSourceType,
|
||||
"kind": 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{
|
||||
"type": "google",
|
||||
"kind": "google",
|
||||
"clientId": tests.ClientId,
|
||||
},
|
||||
},
|
||||
"tools": map[string]any{
|
||||
"my-simple-tool": map[string]any{
|
||||
"type": toolType,
|
||||
"kind": 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{
|
||||
"type": toolType,
|
||||
"kind": 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{
|
||||
"type": toolType,
|
||||
"kind": 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{
|
||||
"type": toolType,
|
||||
"kind": 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{
|
||||
"type": toolType,
|
||||
"kind": 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{
|
||||
"type": toolType,
|
||||
"kind": 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{
|
||||
"type": toolType,
|
||||
"kind": 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{
|
||||
"type": toolType,
|
||||
"kind": toolType,
|
||||
"source": "my-instance",
|
||||
"description": "Tool to test statement with incorrect syntax.",
|
||||
"query": "SELEC 1;",
|
||||
|
||||
@@ -56,7 +56,7 @@ func getFirebirdVars(t *testing.T) map[string]any {
|
||||
}
|
||||
|
||||
return map[string]any{
|
||||
"type": FirebirdSourceType,
|
||||
"kind": 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{
|
||||
"type": toolType,
|
||||
"kind": 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{
|
||||
"type": toolType,
|
||||
"kind": 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{
|
||||
"type": toolType,
|
||||
"kind": 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{
|
||||
"type": toolType,
|
||||
"kind": 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{
|
||||
"type": toolType,
|
||||
"kind": 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{
|
||||
"type": toolType,
|
||||
"kind": 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{
|
||||
"type": toolType,
|
||||
"kind": 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{
|
||||
"type": "firebird-execute-sql",
|
||||
"kind": "firebird-execute-sql",
|
||||
"source": "my-instance",
|
||||
"description": "Tool to execute sql",
|
||||
}
|
||||
tools["my-auth-exec-sql-tool"] = map[string]any{
|
||||
"type": "firebird-execute-sql",
|
||||
"kind": "firebird-execute-sql",
|
||||
"source": "my-instance",
|
||||
"description": "Tool to execute sql",
|
||||
"authRequired": []string{
|
||||
|
||||
@@ -48,7 +48,7 @@ func getFirestoreVars(t *testing.T) map[string]any {
|
||||
}
|
||||
|
||||
vars := map[string]any{
|
||||
"type": FirestoreSourceType,
|
||||
"kind": 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{
|
||||
"type": "firestore-get-documents",
|
||||
"kind": "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{
|
||||
"type": "firestore-get-documents",
|
||||
"kind": "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{
|
||||
"type": "firestore-get-documents",
|
||||
"kind": "firestore-get-documents",
|
||||
"source": "my-instance",
|
||||
"description": "Tool that will fail",
|
||||
},
|
||||
// Firestore specific tools
|
||||
"firestore-get-docs": map[string]any{
|
||||
"type": "firestore-get-documents",
|
||||
"kind": "firestore-get-documents",
|
||||
"source": "my-instance",
|
||||
"description": "Get multiple documents from Firestore",
|
||||
},
|
||||
"firestore-list-colls": map[string]any{
|
||||
"type": "firestore-list-collections",
|
||||
"kind": "firestore-list-collections",
|
||||
"source": "my-instance",
|
||||
"description": "List Firestore collections",
|
||||
},
|
||||
"firestore-delete-docs": map[string]any{
|
||||
"type": "firestore-delete-documents",
|
||||
"kind": "firestore-delete-documents",
|
||||
"source": "my-instance",
|
||||
"description": "Delete documents from Firestore",
|
||||
},
|
||||
"firestore-query-coll": map[string]any{
|
||||
"type": "firestore-query-collection",
|
||||
"kind": "firestore-query-collection",
|
||||
"source": "my-instance",
|
||||
"description": "Query a Firestore collection",
|
||||
},
|
||||
"firestore-query-param": map[string]any{
|
||||
"type": "firestore-query",
|
||||
"kind": "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{
|
||||
"type": "firestore-query",
|
||||
"kind": "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{
|
||||
"type": "firestore-get-rules",
|
||||
"kind": "firestore-get-rules",
|
||||
"source": "my-instance",
|
||||
"description": "Get Firestore security rules",
|
||||
},
|
||||
"firestore-validate-rules": map[string]any{
|
||||
"type": "firestore-validate-rules",
|
||||
"kind": "firestore-validate-rules",
|
||||
"source": "my-instance",
|
||||
"description": "Validate Firestore security rules",
|
||||
},
|
||||
"firestore-add-docs": map[string]any{
|
||||
"type": "firestore-add-documents",
|
||||
"kind": "firestore-add-documents",
|
||||
"source": "my-instance",
|
||||
"description": "Add documents to Firestore",
|
||||
},
|
||||
"firestore-update-doc": map[string]any{
|
||||
"type": "firestore-update-document",
|
||||
"kind": "firestore-update-document",
|
||||
"source": "my-instance",
|
||||
"description": "Update a document in Firestore",
|
||||
},
|
||||
|
||||
@@ -46,7 +46,7 @@ func getHTTPSourceConfig(t *testing.T) map[string]any {
|
||||
idToken = "Bearer " + idToken
|
||||
|
||||
return map[string]any{
|
||||
"type": HttpSourceType,
|
||||
"kind": 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{
|
||||
"type": "google",
|
||||
"kind": "google",
|
||||
"clientId": tests.ClientId,
|
||||
},
|
||||
},
|
||||
"tools": map[string]any{
|
||||
"my-simple-tool": map[string]any{
|
||||
"type": toolType,
|
||||
"kind": 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{
|
||||
"type": toolType,
|
||||
"kind": 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{
|
||||
"type": toolType,
|
||||
"kind": 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{
|
||||
"type": toolType,
|
||||
"kind": 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{
|
||||
"type": toolType,
|
||||
"kind": 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{
|
||||
"type": toolType,
|
||||
"kind": 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{
|
||||
"type": toolType,
|
||||
"kind": 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{
|
||||
"type": toolType,
|
||||
"kind": toolType,
|
||||
"source": "other-instance",
|
||||
"method": "get",
|
||||
"path": "/{{.path}}?id=2",
|
||||
|
||||
@@ -62,7 +62,7 @@ func getLookerVars(t *testing.T) map[string]any {
|
||||
}
|
||||
|
||||
return map[string]any{
|
||||
"type": LookerSourceType,
|
||||
"kind": 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{
|
||||
"type": "looker-get-models",
|
||||
"kind": "looker-get-models",
|
||||
"source": "my-instance",
|
||||
"description": "Simple tool to test end to end functionality.",
|
||||
},
|
||||
"get_explores": map[string]any{
|
||||
"type": "looker-get-explores",
|
||||
"kind": "looker-get-explores",
|
||||
"source": "my-instance",
|
||||
"description": "Simple tool to test end to end functionality.",
|
||||
},
|
||||
"get_dimensions": map[string]any{
|
||||
"type": "looker-get-dimensions",
|
||||
"kind": "looker-get-dimensions",
|
||||
"source": "my-instance",
|
||||
"description": "Simple tool to test end to end functionality.",
|
||||
},
|
||||
"get_measures": map[string]any{
|
||||
"type": "looker-get-measures",
|
||||
"kind": "looker-get-measures",
|
||||
"source": "my-instance",
|
||||
"description": "Simple tool to test end to end functionality.",
|
||||
},
|
||||
"get_filters": map[string]any{
|
||||
"type": "looker-get-filters",
|
||||
"kind": "looker-get-filters",
|
||||
"source": "my-instance",
|
||||
"description": "Simple tool to test end to end functionality.",
|
||||
},
|
||||
"get_parameters": map[string]any{
|
||||
"type": "looker-get-parameters",
|
||||
"kind": "looker-get-parameters",
|
||||
"source": "my-instance",
|
||||
"description": "Simple tool to test end to end functionality.",
|
||||
},
|
||||
"query": map[string]any{
|
||||
"type": "looker-query",
|
||||
"kind": "looker-query",
|
||||
"source": "my-instance",
|
||||
"description": "Simple tool to test end to end functionality.",
|
||||
},
|
||||
"query_sql": map[string]any{
|
||||
"type": "looker-query-sql",
|
||||
"kind": "looker-query-sql",
|
||||
"source": "my-instance",
|
||||
"description": "Simple tool to test end to end functionality.",
|
||||
},
|
||||
"query_url": map[string]any{
|
||||
"type": "looker-query-url",
|
||||
"kind": "looker-query-url",
|
||||
"source": "my-instance",
|
||||
"description": "Simple tool to test end to end functionality.",
|
||||
},
|
||||
"get_looks": map[string]any{
|
||||
"type": "looker-get-looks",
|
||||
"kind": "looker-get-looks",
|
||||
"source": "my-instance",
|
||||
"description": "Simple tool to test end to end functionality.",
|
||||
},
|
||||
"make_look": map[string]any{
|
||||
"type": "looker-make-look",
|
||||
"kind": "looker-make-look",
|
||||
"source": "my-instance",
|
||||
"description": "Simple tool to test end to end functionality.",
|
||||
},
|
||||
"get_dashboards": map[string]any{
|
||||
"type": "looker-get-dashboards",
|
||||
"kind": "looker-get-dashboards",
|
||||
"source": "my-instance",
|
||||
"description": "Simple tool to test end to end functionality.",
|
||||
},
|
||||
"make_dashboard": map[string]any{
|
||||
"type": "looker-make-dashboard",
|
||||
"kind": "looker-make-dashboard",
|
||||
"source": "my-instance",
|
||||
"description": "Simple tool to test end to end functionality.",
|
||||
},
|
||||
"add_dashboard_filter": map[string]any{
|
||||
"type": "looker-add-dashboard-filter",
|
||||
"kind": "looker-add-dashboard-filter",
|
||||
"source": "my-instance",
|
||||
"description": "Simple tool to test end to end functionality.",
|
||||
},
|
||||
"add_dashboard_element": map[string]any{
|
||||
"type": "looker-add-dashboard-element",
|
||||
"kind": "looker-add-dashboard-element",
|
||||
"source": "my-instance",
|
||||
"description": "Simple tool to test end to end functionality.",
|
||||
},
|
||||
"conversational_analytics": map[string]any{
|
||||
"type": "looker-conversational-analytics",
|
||||
"kind": "looker-conversational-analytics",
|
||||
"source": "my-instance",
|
||||
"description": "Simple tool to test end to end functionality.",
|
||||
},
|
||||
"health_pulse": map[string]any{
|
||||
"type": "looker-health-pulse",
|
||||
"kind": "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{
|
||||
"type": "looker-health-analyze",
|
||||
"kind": "looker-health-analyze",
|
||||
"source": "my-instance",
|
||||
"description": "Provides analysis of a Looker instance's projects, models, or explores.",
|
||||
},
|
||||
"health_vacuum": map[string]any{
|
||||
"type": "looker-health-vacuum",
|
||||
"kind": "looker-health-vacuum",
|
||||
"source": "my-instance",
|
||||
"description": "Vacuums unused content from a Looker instance.",
|
||||
},
|
||||
"dev_mode": map[string]any{
|
||||
"type": "looker-dev-mode",
|
||||
"kind": "looker-dev-mode",
|
||||
"source": "my-instance",
|
||||
"description": "Simple tool to test end to end functionality.",
|
||||
},
|
||||
"get_projects": map[string]any{
|
||||
"type": "looker-get-projects",
|
||||
"kind": "looker-get-projects",
|
||||
"source": "my-instance",
|
||||
"description": "Simple tool to test end to end functionality.",
|
||||
},
|
||||
"get_project_files": map[string]any{
|
||||
"type": "looker-get-project-files",
|
||||
"kind": "looker-get-project-files",
|
||||
"source": "my-instance",
|
||||
"description": "Simple tool to test end to end functionality.",
|
||||
},
|
||||
"get_project_file": map[string]any{
|
||||
"type": "looker-get-project-file",
|
||||
"kind": "looker-get-project-file",
|
||||
"source": "my-instance",
|
||||
"description": "Simple tool to test end to end functionality.",
|
||||
},
|
||||
"create_project_file": map[string]any{
|
||||
"type": "looker-create-project-file",
|
||||
"kind": "looker-create-project-file",
|
||||
"source": "my-instance",
|
||||
"description": "Simple tool to test end to end functionality.",
|
||||
},
|
||||
"update_project_file": map[string]any{
|
||||
"type": "looker-update-project-file",
|
||||
"kind": "looker-update-project-file",
|
||||
"source": "my-instance",
|
||||
"description": "Simple tool to test end to end functionality.",
|
||||
},
|
||||
"delete_project_file": map[string]any{
|
||||
"type": "looker-delete-project-file",
|
||||
"kind": "looker-delete-project-file",
|
||||
"source": "my-instance",
|
||||
"description": "Simple tool to test end to end functionality.",
|
||||
},
|
||||
"generate_embed_url": map[string]any{
|
||||
"type": "looker-generate-embed-url",
|
||||
"kind": "looker-generate-embed-url",
|
||||
"source": "my-instance",
|
||||
"description": "Simple tool to test end to end functionality.",
|
||||
},
|
||||
"get_connections": map[string]any{
|
||||
"type": "looker-get-connections",
|
||||
"kind": "looker-get-connections",
|
||||
"source": "my-instance",
|
||||
"description": "Simple tool to test end to end functionality.",
|
||||
},
|
||||
"get_connection_schemas": map[string]any{
|
||||
"type": "looker-get-connection-schemas",
|
||||
"kind": "looker-get-connection-schemas",
|
||||
"source": "my-instance",
|
||||
"description": "Simple tool to test end to end functionality.",
|
||||
},
|
||||
"get_connection_databases": map[string]any{
|
||||
"type": "looker-get-connection-databases",
|
||||
"kind": "looker-get-connection-databases",
|
||||
"source": "my-instance",
|
||||
"description": "Simple tool to test end to end functionality.",
|
||||
},
|
||||
"get_connection_tables": map[string]any{
|
||||
"type": "looker-get-connection-tables",
|
||||
"kind": "looker-get-connection-tables",
|
||||
"source": "my-instance",
|
||||
"description": "Simple tool to test end to end functionality.",
|
||||
},
|
||||
"get_connection_table_columns": map[string]any{
|
||||
"type": "looker-get-connection-table-columns",
|
||||
"kind": "looker-get-connection-table-columns",
|
||||
"source": "my-instance",
|
||||
"description": "Simple tool to test end to end functionality.",
|
||||
},
|
||||
|
||||
@@ -60,7 +60,7 @@ func getMariaDBVars(t *testing.T) map[string]any {
|
||||
}
|
||||
|
||||
return map[string]any{
|
||||
"type": MariaDBSourceType,
|
||||
"kind": MariaDBSourceType,
|
||||
"host": MariaDBHost,
|
||||
"port": MariaDBPort,
|
||||
"database": MariaDBDatabase,
|
||||
|
||||
@@ -66,7 +66,7 @@ func getMindsDBVars(t *testing.T) map[string]any {
|
||||
}
|
||||
|
||||
return map[string]any{
|
||||
"type": MindsDBSourceType,
|
||||
"kind": 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{
|
||||
"type": "google",
|
||||
"kind": "google",
|
||||
"clientId": tests.ClientId,
|
||||
},
|
||||
},
|
||||
"tools": map[string]any{
|
||||
"my-simple-tool": map[string]any{
|
||||
"type": MindsDBToolType,
|
||||
"kind": MindsDBToolType,
|
||||
"source": "my-instance",
|
||||
"description": "Simple tool to test end to end functionality.",
|
||||
"statement": "SELECT 1",
|
||||
},
|
||||
"my-tool": map[string]any{
|
||||
"type": MindsDBToolType,
|
||||
"kind": 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{
|
||||
"type": MindsDBToolType,
|
||||
"kind": 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{
|
||||
"type": MindsDBToolType,
|
||||
"kind": 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{
|
||||
"type": MindsDBToolType,
|
||||
"kind": 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{
|
||||
"type": MindsDBToolType,
|
||||
"kind": 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{
|
||||
"type": MindsDBToolType,
|
||||
"kind": 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{
|
||||
"type": MindsDBToolType,
|
||||
"kind": MindsDBToolType,
|
||||
"source": "my-instance",
|
||||
"description": "Tool to test statement with incorrect syntax.",
|
||||
"statement": "INVALID SQL STATEMENT",
|
||||
},
|
||||
"my-exec-sql-tool": map[string]any{
|
||||
"type": "mindsdb-execute-sql",
|
||||
"kind": "mindsdb-execute-sql",
|
||||
"source": "my-instance",
|
||||
"description": "Tool to execute sql",
|
||||
},
|
||||
"my-auth-exec-sql-tool": map[string]any{
|
||||
"type": "mindsdb-execute-sql",
|
||||
"kind": "mindsdb-execute-sql",
|
||||
"source": "my-instance",
|
||||
"description": "Tool to execute sql with auth",
|
||||
"authRequired": []string{
|
||||
|
||||
@@ -48,7 +48,7 @@ func getMongoDBVars(t *testing.T) map[string]any {
|
||||
t.Fatal("'MongoDbDatabase' not set")
|
||||
}
|
||||
return map[string]any{
|
||||
"type": MongoDbSourceType,
|
||||
"kind": 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{
|
||||
"type": "google",
|
||||
"kind": "google",
|
||||
"clientId": tests.ClientId,
|
||||
},
|
||||
},
|
||||
"tools": map[string]any{
|
||||
"my-simple-tool": map[string]any{
|
||||
"type": "mongodb-find-one",
|
||||
"kind": "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{
|
||||
"type": toolType,
|
||||
"kind": 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{
|
||||
"type": toolType,
|
||||
"kind": 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{
|
||||
"type": toolType,
|
||||
"kind": 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{
|
||||
"type": toolType,
|
||||
"kind": 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{
|
||||
"type": toolType,
|
||||
"kind": 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{
|
||||
"type": toolType,
|
||||
"kind": 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{
|
||||
"type": toolType,
|
||||
"kind": 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{
|
||||
"type": "mongodb-delete-one",
|
||||
"kind": "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{
|
||||
"type": "mongodb-delete-many",
|
||||
"kind": "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{
|
||||
"type": "mongodb-insert-one",
|
||||
"kind": "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{
|
||||
"type": "mongodb-insert-many",
|
||||
"kind": "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{
|
||||
"type": "mongodb-update-one",
|
||||
"kind": "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{
|
||||
"type": "mongodb-update-many",
|
||||
"kind": "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{
|
||||
"type": "mongodb-aggregate",
|
||||
"kind": "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{
|
||||
"type": "mongodb-aggregate",
|
||||
"kind": "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{
|
||||
"type": "mongodb-aggregate",
|
||||
"kind": "mongodb-aggregate",
|
||||
"source": "my-instance",
|
||||
"description": "Tool to test an aggregation.",
|
||||
"authRequired": []string{},
|
||||
|
||||
@@ -56,7 +56,7 @@ func getMsSQLVars(t *testing.T) map[string]any {
|
||||
}
|
||||
|
||||
return map[string]any{
|
||||
"type": MSSQLSourceType,
|
||||
"kind": MSSQLSourceType,
|
||||
"host": MSSQLHost,
|
||||
"port": MSSQLPort,
|
||||
"database": MSSQLDatabase,
|
||||
|
||||
@@ -54,7 +54,7 @@ func getMySQLVars(t *testing.T) map[string]any {
|
||||
}
|
||||
|
||||
return map[string]any{
|
||||
"type": MySQLSourceType,
|
||||
"kind": MySQLSourceType,
|
||||
"host": MySQLHost,
|
||||
"port": MySQLPort,
|
||||
"database": MySQLDatabase,
|
||||
|
||||
@@ -56,7 +56,7 @@ func getNeo4jVars(t *testing.T) map[string]any {
|
||||
}
|
||||
|
||||
return map[string]any{
|
||||
"type": Neo4jSourceType,
|
||||
"kind": 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{
|
||||
"type": "neo4j-cypher",
|
||||
"kind": "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{
|
||||
"type": "neo4j-execute-cypher",
|
||||
"kind": "neo4j-execute-cypher",
|
||||
"source": "my-neo4j-instance",
|
||||
"description": "Simple tool to test end to end functionality.",
|
||||
},
|
||||
"my-readonly-execute-cypher-tool": map[string]any{
|
||||
"type": "neo4j-execute-cypher",
|
||||
"kind": "neo4j-execute-cypher",
|
||||
"source": "my-neo4j-instance",
|
||||
"description": "A readonly cypher execution tool.",
|
||||
"readOnly": true,
|
||||
},
|
||||
"my-schema-tool": map[string]any{
|
||||
"type": "neo4j-schema",
|
||||
"kind": "neo4j-schema",
|
||||
"source": "my-neo4j-instance",
|
||||
"description": "A tool to get the Neo4j schema.",
|
||||
},
|
||||
"my-schema-tool-with-cache": map[string]any{
|
||||
"type": "neo4j-schema",
|
||||
"kind": "neo4j-schema",
|
||||
"source": "my-neo4j-instance",
|
||||
"description": "A schema tool with a custom cache expiration.",
|
||||
"cacheExpireMinutes": 10,
|
||||
},
|
||||
"my-populated-schema-tool": map[string]any{
|
||||
"type": "neo4j-schema",
|
||||
"kind": "neo4j-schema",
|
||||
"source": "my-neo4j-instance",
|
||||
"description": "A tool to get the Neo4j schema from a populated DB.",
|
||||
},
|
||||
|
||||
@@ -56,7 +56,7 @@ func getOceanBaseVars(t *testing.T) map[string]any {
|
||||
}
|
||||
|
||||
return map[string]any{
|
||||
"type": OceanBaseSourceType,
|
||||
"kind": 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{
|
||||
"type": "oceanbase-execute-sql",
|
||||
"kind": "oceanbase-execute-sql",
|
||||
"source": "my-instance",
|
||||
"description": "Tool to execute sql",
|
||||
}
|
||||
tools["my-auth-exec-sql-tool"] = map[string]any{
|
||||
"type": "oceanbase-execute-sql",
|
||||
"kind": "oceanbase-execute-sql",
|
||||
"source": "my-instance",
|
||||
"description": "Tool to execute sql",
|
||||
"authRequired": []string{
|
||||
|
||||
@@ -41,7 +41,7 @@ func getOracleVars(t *testing.T) map[string]any {
|
||||
}
|
||||
|
||||
return map[string]any{
|
||||
"type": OracleSourceType,
|
||||
"kind": OracleSourceType,
|
||||
"connectionString": OracleConnStr,
|
||||
"useOCI": true,
|
||||
"user": OracleUser,
|
||||
|
||||
@@ -55,7 +55,7 @@ func getPostgresVars(t *testing.T) map[string]any {
|
||||
}
|
||||
|
||||
return map[string]any{
|
||||
"type": PostgresSourceType,
|
||||
"kind": PostgresSourceType,
|
||||
"host": PostgresHost,
|
||||
"port": PostgresPort,
|
||||
"database": PostgresDatabase,
|
||||
|
||||
@@ -42,7 +42,7 @@ func getRedisVars(t *testing.T) map[string]any {
|
||||
t.Fatal("'REDIS_PASS' not set")
|
||||
}
|
||||
return map[string]any{
|
||||
"type": RedisSourceType,
|
||||
"kind": RedisSourceType,
|
||||
"address": []string{RedisAddress},
|
||||
"password": RedisPass,
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ func getServerlessSparkVars(t *testing.T) map[string]any {
|
||||
}
|
||||
|
||||
return map[string]any{
|
||||
"type": "serverless-spark",
|
||||
"kind": "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{
|
||||
"type": "google",
|
||||
"kind": "google",
|
||||
"clientId": tests.ClientId,
|
||||
},
|
||||
},
|
||||
"tools": map[string]any{
|
||||
"list-batches": map[string]any{
|
||||
"type": "serverless-spark-list-batches",
|
||||
"kind": "serverless-spark-list-batches",
|
||||
"source": "my-spark",
|
||||
},
|
||||
"list-batches-with-auth": map[string]any{
|
||||
"type": "serverless-spark-list-batches",
|
||||
"kind": "serverless-spark-list-batches",
|
||||
"source": "my-spark",
|
||||
"authRequired": []string{"my-google-auth"},
|
||||
},
|
||||
"get-batch": map[string]any{
|
||||
"type": "serverless-spark-get-batch",
|
||||
"kind": "serverless-spark-get-batch",
|
||||
"source": "my-spark",
|
||||
},
|
||||
"get-batch-with-auth": map[string]any{
|
||||
"type": "serverless-spark-get-batch",
|
||||
"kind": "serverless-spark-get-batch",
|
||||
"source": "my-spark",
|
||||
"authRequired": []string{"my-google-auth"},
|
||||
},
|
||||
"cancel-batch": map[string]any{
|
||||
"type": "serverless-spark-cancel-batch",
|
||||
"kind": "serverless-spark-cancel-batch",
|
||||
"source": "my-spark",
|
||||
},
|
||||
"cancel-batch-with-auth": map[string]any{
|
||||
"type": "serverless-spark-cancel-batch",
|
||||
"kind": "serverless-spark-cancel-batch",
|
||||
"source": "my-spark",
|
||||
"authRequired": []string{"my-google-auth"},
|
||||
},
|
||||
"create-pyspark-batch": map[string]any{
|
||||
"type": "serverless-spark-create-pyspark-batch",
|
||||
"kind": "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{
|
||||
"type": "serverless-spark-create-pyspark-batch",
|
||||
"kind": "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{
|
||||
"type": "serverless-spark-create-pyspark-batch",
|
||||
"kind": "serverless-spark-create-pyspark-batch",
|
||||
"source": "my-spark",
|
||||
"authRequired": []string{"my-google-auth"},
|
||||
},
|
||||
"create-spark-batch": map[string]any{
|
||||
"type": "serverless-spark-create-spark-batch",
|
||||
"kind": "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{
|
||||
"type": "serverless-spark-create-spark-batch",
|
||||
"kind": "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{
|
||||
"type": "serverless-spark-create-spark-batch",
|
||||
"kind": "serverless-spark-create-spark-batch",
|
||||
"source": "my-spark",
|
||||
"authRequired": []string{"my-google-auth"},
|
||||
},
|
||||
|
||||
@@ -54,7 +54,7 @@ func getSingleStoreVars(t *testing.T) map[string]any {
|
||||
}
|
||||
|
||||
return map[string]any{
|
||||
"type": SingleStoreSourceType,
|
||||
"kind": 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 type
|
||||
// getSingleStoreTmplToolStatement returns statements and param for template parameter test cases for singlestore-sql kind
|
||||
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{
|
||||
"type": "singlestore-execute-sql",
|
||||
"kind": "singlestore-execute-sql",
|
||||
"source": "my-instance",
|
||||
"description": "Tool to execute sql",
|
||||
}
|
||||
tools["my-auth-exec-sql-tool"] = map[string]any{
|
||||
"type": "singlestore-execute-sql",
|
||||
"kind": "singlestore-execute-sql",
|
||||
"source": "my-instance",
|
||||
"description": "Tool to execute sql",
|
||||
"authRequired": []string{
|
||||
|
||||
@@ -65,7 +65,7 @@ func getSnowflakeVars(t *testing.T) map[string]any {
|
||||
}
|
||||
|
||||
return map[string]any{
|
||||
"type": SnowflakeSourceType,
|
||||
"kind": 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{
|
||||
"type": "snowflake-execute-sql",
|
||||
"kind": "snowflake-execute-sql",
|
||||
"source": "my-instance",
|
||||
"description": "Tool to execute sql",
|
||||
}
|
||||
|
||||
tools["my-auth-exec-sql-tool"] = map[string]any{
|
||||
"type": "snowflake-execute-sql",
|
||||
"kind": "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 type
|
||||
// getSnowflakeParamToolInfo returns statements and param for my-param-tool snowflake-sql kind
|
||||
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 type
|
||||
// getSnowflakeAuthToolInfo returns statements and param of my-auth-tool for snowflake-sql kind
|
||||
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 type
|
||||
// getSnowflakeTmplToolStatement returns statements and param for template parameter test cases for snowflake-sql kind
|
||||
func getSnowflakeTmplToolStatement() (string, string) {
|
||||
tmplSelectCombined := "SELECT * FROM {{.tableName}} WHERE id = ?"
|
||||
tmplSelectFilterCombined := "SELECT * FROM {{.tableName}} WHERE {{.columnFilter}} = ?"
|
||||
|
||||
@@ -43,7 +43,7 @@ func RunSourceConnectionTest(t *testing.T, sourceConfig map[string]any, toolType
|
||||
},
|
||||
"tools": map[string]any{
|
||||
"my-simple-tool": map[string]any{
|
||||
"type": toolType,
|
||||
"kind": toolType,
|
||||
"source": "my-instance",
|
||||
"description": "Simple tool to test end to end functionality.",
|
||||
"statement": "SELECT 1;",
|
||||
|
||||
@@ -55,7 +55,7 @@ func getSpannerVars(t *testing.T) map[string]any {
|
||||
}
|
||||
|
||||
return map[string]any{
|
||||
"type": SpannerSourceType,
|
||||
"kind": 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 type
|
||||
// getSpannerToolInfo returns statements and param for my-tool for spanner-sql kind
|
||||
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 type
|
||||
// getSpannerAuthToolInfo returns statements and param of my-auth-tool for spanner-sql kind
|
||||
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{
|
||||
"type": "spanner-execute-sql",
|
||||
"kind": "spanner-execute-sql",
|
||||
"source": "my-instance",
|
||||
"description": "Tool to execute sql",
|
||||
"readOnly": true,
|
||||
}
|
||||
tools["my-exec-sql-tool"] = map[string]any{
|
||||
"type": "spanner-execute-sql",
|
||||
"kind": "spanner-execute-sql",
|
||||
"source": "my-instance",
|
||||
"description": "Tool to execute sql",
|
||||
}
|
||||
tools["my-auth-exec-sql-tool"] = map[string]any{
|
||||
"type": "spanner-execute-sql",
|
||||
"kind": "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{
|
||||
"type": "spanner-sql",
|
||||
"kind": "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{
|
||||
"type": "spanner-sql",
|
||||
"kind": "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{
|
||||
"type": "spanner-list-tables",
|
||||
"kind": "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{
|
||||
"type": "spanner-list-graphs",
|
||||
"kind": "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{
|
||||
"type": "spanner-sql",
|
||||
"kind": "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{
|
||||
"type": "spanner-sql",
|
||||
"kind": "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{
|
||||
"type": "spanner-sql",
|
||||
"kind": "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{
|
||||
"type": "spanner-sql",
|
||||
"kind": "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{
|
||||
"type": "spanner-sql",
|
||||
"kind": "spanner-sql",
|
||||
"source": "my-instance",
|
||||
"description": "Create table tool with template parameters",
|
||||
"statement": "SELECT * FROM {{.tableName}} WHERE {{.columnFilter}} = @name",
|
||||
|
||||
@@ -39,7 +39,7 @@ var (
|
||||
|
||||
func getSQLiteVars(t *testing.T) map[string]any {
|
||||
return map[string]any{
|
||||
"type": SQLiteSourceType,
|
||||
"kind": 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{
|
||||
"type": "sqlite-execute-sql",
|
||||
"kind": "sqlite-execute-sql",
|
||||
"source": "my-instance",
|
||||
"description": "Tool to execute SQL statements",
|
||||
},
|
||||
|
||||
@@ -54,7 +54,7 @@ func getTiDBVars(t *testing.T) map[string]any {
|
||||
}
|
||||
|
||||
return map[string]any{
|
||||
"type": TiDBSourceType,
|
||||
"kind": 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{
|
||||
"type": "tidb-execute-sql",
|
||||
"kind": "tidb-execute-sql",
|
||||
"source": "my-instance",
|
||||
"description": "Tool to execute sql",
|
||||
}
|
||||
tools["my-auth-exec-sql-tool"] = map[string]any{
|
||||
"type": "tidb-execute-sql",
|
||||
"kind": "tidb-execute-sql",
|
||||
"source": "my-instance",
|
||||
"description": "Tool to execute sql",
|
||||
"authRequired": []string{
|
||||
|
||||
@@ -55,7 +55,7 @@ func getTrinoVars(t *testing.T) map[string]any {
|
||||
}
|
||||
|
||||
return map[string]any{
|
||||
"type": TrinoSourceType,
|
||||
"kind": 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 type
|
||||
// getTrinoParamToolInfo returns statements and param for my-tool trino-sql kind
|
||||
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 type
|
||||
// getTrinoAuthToolInfo returns statements and param of my-auth-tool for trino-sql kind
|
||||
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 type
|
||||
// getTrinoTmplToolStatement returns statements and param for template parameter test cases for trino-sql kind
|
||||
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{
|
||||
"type": "trino-execute-sql",
|
||||
"kind": "trino-execute-sql",
|
||||
"source": "my-instance",
|
||||
"description": "Tool to execute sql",
|
||||
}
|
||||
tools["my-auth-exec-sql-tool"] = map[string]any{
|
||||
"type": "trino-execute-sql",
|
||||
"kind": "trino-execute-sql",
|
||||
"source": "my-instance",
|
||||
"description": "Tool to execute sql",
|
||||
"authRequired": []string{
|
||||
|
||||
@@ -37,7 +37,7 @@ func RunWaitTool(t *testing.T) {
|
||||
toolsFile := map[string]any{
|
||||
"tools": map[string]any{
|
||||
"my-wait-for-tool": map[string]any{
|
||||
"type": "wait",
|
||||
"kind": "wait",
|
||||
"description": "Wait for a specified duration.",
|
||||
"timeout": "30s",
|
||||
},
|
||||
|
||||
@@ -39,7 +39,7 @@ func getValkeyVars(t *testing.T) map[string]any {
|
||||
t.Fatal("'VALKEY_ADDRESS' not set")
|
||||
}
|
||||
return map[string]any{
|
||||
"type": ValkeySourceType,
|
||||
"kind": ValkeySourceType,
|
||||
"address": []string{ValkeyAddress},
|
||||
"disableCache": true,
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ func getYBVars(t *testing.T) map[string]any {
|
||||
}
|
||||
|
||||
return map[string]any{
|
||||
"type": YBDB_SOURCE_KIND,
|
||||
"kind": YBDB_SOURCE_KIND,
|
||||
"host": YBDB_HOST,
|
||||
"port": YBDB_PORT,
|
||||
"database": YBDB_DATABASE,
|
||||
|
||||
Reference in New Issue
Block a user