From 251ef2283942cf56c68614490843d7f7df6c87b1 Mon Sep 17 00:00:00 2001 From: RUN Date: Fri, 30 Jan 2026 17:41:37 +0100 Subject: [PATCH] fix: update Oracle tool arguments and improve test structure --- docs/en/how-to/connect-ide/oracle_mcp.md | 14 +++---- tests/oracle/oracle_integration_test.go | 48 +++++++----------------- 2 files changed, 20 insertions(+), 42 deletions(-) diff --git a/docs/en/how-to/connect-ide/oracle_mcp.md b/docs/en/how-to/connect-ide/oracle_mcp.md index 22d278d8bd..0a9d06c13f 100644 --- a/docs/en/how-to/connect-ide/oracle_mcp.md +++ b/docs/en/how-to/connect-ide/oracle_mcp.md @@ -91,7 +91,7 @@ curl -O https://storage.googleapis.com/genai-toolbox/v0.26.0/windows/amd64/toolb "mcpServers": { "oracle": { "command": "./PATH/TO/toolbox", - "args": ["--prebuilt","oracle","--stdio"], + "args": ["--prebuilt","oracledb","--stdio"], "env": { "ORACLE_HOST": "", "ORACLE_PORT": "1521", @@ -121,7 +121,7 @@ curl -O https://storage.googleapis.com/genai-toolbox/v0.26.0/windows/amd64/toolb "mcpServers": { "oracle": { "command": "./PATH/TO/toolbox", - "args": ["--prebuilt","oracle","--stdio"], + "args": ["--prebuilt","oracledb","--stdio"], "env": { "ORACLE_HOST": "", "ORACLE_PORT": "1521", @@ -154,7 +154,7 @@ curl -O https://storage.googleapis.com/genai-toolbox/v0.26.0/windows/amd64/toolb "mcpServers": { "oracle": { "command": "./PATH/TO/toolbox", - "args": ["--prebuilt","oracle","--stdio"], + "args": ["--prebuilt","oracledb","--stdio"], "env": { "ORACLE_HOST": "", "ORACLE_PORT": "1521", @@ -185,7 +185,7 @@ curl -O https://storage.googleapis.com/genai-toolbox/v0.26.0/windows/amd64/toolb "mcpServers": { "oracle": { "command": "./PATH/TO/toolbox", - "args": ["--prebuilt","oracle","--stdio"], + "args": ["--prebuilt","oracledb","--stdio"], "env": { "ORACLE_HOST": "", "ORACLE_PORT": "1521", @@ -246,7 +246,7 @@ curl -O https://storage.googleapis.com/genai-toolbox/v0.26.0/windows/amd64/toolb "mcpServers": { "oracle": { "command": "./PATH/TO/toolbox", - "args": ["--prebuilt","oracle","--stdio"], + "args": ["--prebuilt","oracledb","--stdio"], "env": { "ORACLE_HOST": "", "ORACLE_PORT": "1521", @@ -275,7 +275,7 @@ curl -O https://storage.googleapis.com/genai-toolbox/v0.26.0/windows/amd64/toolb "mcpServers": { "oracle": { "command": "./PATH/TO/toolbox", - "args": ["--prebuilt","oracle","--stdio"], + "args": ["--prebuilt","oracledb","--stdio"], "env": { "ORACLE_HOST": "", "ORACLE_PORT": "1521", @@ -302,7 +302,7 @@ curl -O https://storage.googleapis.com/genai-toolbox/v0.26.0/windows/amd64/toolb "mcpServers": { "oracle": { "command": "./PATH/TO/toolbox", - "args": ["--prebuilt","oracle","--stdio"], + "args": ["--prebuilt","oracledb","--stdio"], "env": { "ORACLE_HOST": "", "ORACLE_PORT": "1521", diff --git a/tests/oracle/oracle_integration_test.go b/tests/oracle/oracle_integration_test.go index 76d939c1d5..519daedaa2 100644 --- a/tests/oracle/oracle_integration_test.go +++ b/tests/oracle/oracle_integration_test.go @@ -142,25 +142,15 @@ func initOracleConnection(ctx context.Context, user, pass, connStr string) (*sql } // TestOracleSimpleToolEndpoints tests Oracle SQL tool endpoints -func TestOracleTools(t *testing.T) { +func TestOracleSimpleToolEndpoints(t *testing.T) { + sourceConfig := getOracleVars(t) ctx, cancel := context.WithTimeout(context.Background(), time.Minute) defer cancel() var args []string - ctx, err := testutils.ContextWithNewLogger() - if err != nil { - t.Fatalf("unexpected error: %s", err) - } - - cfg := getOracleConfigFromEnv(t) - source, err := cfg.Initialize(ctx, nil) - if err != nil { - t.Fatalf("unable to initialize oracle source: %v", err) - } - db := source.(*oracle.Source).DB - + db, err := initOracleConnection(ctx, OracleUser, OraclePass, OracleConnStr) if err != nil { t.Fatalf("unable to create Oracle connection pool: %s", err) } @@ -208,28 +198,16 @@ func TestOracleTools(t *testing.T) { createTableStatement := `"CREATE TABLE t (id NUMBER GENERATED AS IDENTITY PRIMARY KEY, name VARCHAR2(255))"` mcpSelect1Want := `{"jsonrpc":"2.0","id":"invoke my-auth-required-tool","result":{"content":[{"type":"text","text":"{\"1\":1}"}]}}` - t.Run("oracle-source-parsing", func(t *testing.T) { - // This test implicitly checks if the Oracle source configuration - // is parsed correctly by the toolbox server at startup. - // A failure in StartCmd or WaitForString would indicate a parsing issue. - if err != nil { - t.Errorf("Oracle source configuration failed to parse: %v", err) - } else { - fmt.Println("Oracle source configuration parsed successfully.") - } - }) - - t.Run("tool-endpoints", func(t *testing.T) { - tests.RunToolGetTest(t) - tests.RunToolInvokeTest(t, select1Want, - tests.DisableOptionalNullParamTest(), - tests.WithMyToolById4Want(`[{"id":4,"name":""}]`), - tests.DisableArrayTest(), - ) - tests.RunMCPToolCallMethod(t, mcpMyFailToolWant, mcpSelect1Want) - tests.RunExecuteSqlToolInvokeTest(t, createTableStatement, select1Want) - tests.RunToolInvokeWithTemplateParameters(t, tableNameTemplateParam) - }) + // Run tests + tests.RunToolGetTest(t) + tests.RunToolInvokeTest(t, select1Want, + tests.DisableOptionalNullParamTest(), + tests.WithMyToolById4Want("[{\"id\":4,\"name\":\"\"}]"), + tests.DisableArrayTest(), + ) + tests.RunMCPToolCallMethod(t, mcpMyFailToolWant, mcpSelect1Want) + tests.RunExecuteSqlToolInvokeTest(t, createTableStatement, select1Want) + tests.RunToolInvokeWithTemplateParameters(t, tableNameTemplateParam) }