mirror of
https://github.com/googleapis/genai-toolbox.git
synced 2026-01-11 16:38:15 -05:00
fix: explicitly set query location for BigQuery queries (#586)
For issue https://github.com/googleapis/genai-toolbox/issues/567 --------- Co-authored-by: Yuan <45984206+Yuan325@users.noreply.github.com>
This commit is contained in:
@@ -121,6 +121,7 @@ func (t Tool) Invoke(ctx context.Context, params tools.ParamValues) ([]any, erro
|
||||
|
||||
query := t.Client.Query(t.Statement)
|
||||
query.Parameters = namedArgs
|
||||
query.Location = t.Client.Location
|
||||
|
||||
it, err := query.Read(ctx)
|
||||
if err != nil {
|
||||
|
||||
@@ -123,7 +123,7 @@ func TestBigQueryToolEndpoints(t *testing.T) {
|
||||
|
||||
select1Want := "[{\"f0_\":1}]"
|
||||
// Partial message; the full error message is too long.
|
||||
failInvocationWant := `{"jsonrpc":"2.0","id":"invoke-fail-tool","result":{"content":[{"type":"text","text":"unable to execute query: googleapi: Error 400: Syntax error: Unexpected identifier \"SELEC\" at [1:1], invalidQuery"}],"isError":true}}`
|
||||
failInvocationWant := `{"jsonrpc":"2.0","id":"invoke-fail-tool","result":{"content":[{"type":"text","text":"unable to execute query: googleapi: Error 400: Syntax error: Unexpected identifier \"SELEC\" at [1:1]`
|
||||
invokeParamWant, mcpInvokeParamWant := tests.GetNonSpannerInvokeParamWant()
|
||||
tests.RunToolInvokeTest(t, select1Want, invokeParamWant)
|
||||
tests.RunMCPToolCallMethod(t, mcpInvokeParamWant, failInvocationWant)
|
||||
|
||||
Reference in New Issue
Block a user