Skip to main content
Glama

MCP Toolbox for Databases

by googleapis
Apache 2.0
11,041
  • Linux
quickstart_test.go2.39 kB
// Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package main import ( "bytes" "os" "os/exec" "path/filepath" "strings" "testing" ) func TestQuickstartSample(t *testing.T) { framework := os.Getenv("ORCH_NAME") if framework == "" { t.Skip("Skipping test: ORCH_NAME environment variable is not set.") } t.Logf("--- Testing: %s ---", framework) if framework == "openAI" { if os.Getenv("OPENAI_API_KEY") == "" { t.Skip("Skipping test: OPENAI_API_KEY environment variable is not set for openAI framework.") } } else { if os.Getenv("GOOGLE_API_KEY") == "" { t.Skipf("Skipping test for %s: GOOGLE_API_KEY environment variable is not set.", framework) } } sampleDir := filepath.Join(".", framework) if _, err := os.Stat(sampleDir); os.IsNotExist(err) { t.Fatalf("Test setup failed: directory for framework '%s' not found.", framework) } cmd := exec.Command("go", "run", ".") cmd.Dir = sampleDir var stdout, stderr bytes.Buffer cmd.Stdout = &stdout cmd.Stderr = &stderr err := cmd.Run() actualOutput := stdout.String() if err != nil { t.Fatalf("Script execution failed with error: %v\n--- STDERR ---\n%s", err, stderr.String()) } if len(actualOutput) == 0 { t.Fatal("Script ran successfully but produced no output.") } goldenFile, err := os.ReadFile("../golden.txt") if err != nil { t.Fatalf("Could not read golden.txt to check for keywords: %v", err) } keywords := strings.Split(string(goldenFile), "\n") var missingKeywords []string outputLower := strings.ToLower(actualOutput) for _, keyword := range keywords { kw := strings.TrimSpace(keyword) if kw != "" && !strings.Contains(outputLower, strings.ToLower(kw)) { missingKeywords = append(missingKeywords, kw) } } if len(missingKeywords) > 0 { t.Fatalf("FAIL: The following keywords were missing from the output: [%s]", strings.Join(missingKeywords, ", ")) } }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/googleapis/genai-toolbox'

If you have feedback or need assistance with the MCP directory API, please join our Discord server